Serverless Postgres: database connections at Serverless scale

MatteoIn a serverless application a function can scale almost "infinitely" by creating separate container instances for each concurrent user. Each container can correspond to a database connection which, for performance purposes, is left opened for further re-utilization. If we have a sudden spike of concurrent traffic, the available connections can be quickly maxed out by other competing functions. If we reach the max connections limit, Postgres will automatically reject any frontend trying to connect to its backend. This can cause heavy disruption in your application.
Serverless-postgres is a Javascript open source library for Node.js that adds a connection management component specifically for FaaS based applications. By calling the method .clean() at the end of your functions, the module will constantly monitor the status of all the processes running in the PostgreSQL backend and then, based on the configuration provided, will garbage collect the "zombie" connections. If the client fails to connect with "sorry, too many clients already" error, the module will retry using trusted backoff algorithms.


Postgres explain

postgres-logoFor now a simple Postgres query explain, it visualizes the query plan outputted from Postgres.
I am currently improving and adding new features.


Waves8: migration and architecture improvement

MatteoWaves is an audio and podcasting platform for the Vietnamese and Indonesian market which was looking to modernize their infrastructures.
I have helped their organization to migrate and refactor their entire workload on AWS.
By moving to a modern cloud environment, Waves was to able offer their customers a more reliable and resilient service without any major additional costs in man power.
By automating their deployments, patching and testing, the development flow became much more robust and faster so they could release more often and with more confidence.
MatteoI coached and mentored their engineering team to adopt best practices for the cloud and AWS.
I have managed to reduce their audio processing costs, by re-architecting part of the workload to a serverless event-driven architecture using AWS Media Converter, Lambda, S3, SNS and API Gateway websocket.

Infinity technology: hybrid serverless and containers architecture

MatteoThis was one of the most exciting project so far and I have worked in collaboration with Infinity Technology  to bring to life a gaming hosting solution for a client.
For the gaming servers we used a container based orchestrator ECS and we packed the game instance into a Docker image. We then used Lambda, API Gateway, SNS and Golang to create the API to expose to the end user.
On Cognito signup the API would trigger an ECS service deployment with a dedicated Route53 DNS subdomain. The user could control his gaming server settings and status through an Angular dashboard.

SAML Proxy

Small SAML 2.0 service provider authentication proxy. I mainly built this to leverage direct AWS SSO authentication with external services such Kubernetes, Linkerd, Grafana dashboards.
You can use it as well with any other compatible providers such as Auth0, Okta, ect....

Helm chart:
Docker image:

This website use cookies for statistics purposes. By visiting it you will accept our privacy policy