Home / Companies / RevenueCat / Blog / Post Details
Content Deep Dive

Running PgBouncer on AWS ECS

Blog post from RevenueCat

Post Details
Company
Date Published
Author
Tony Cosentini
Word Count
1,477
Language
English
Hacker News Points
-
Summary

RevenueCat implemented PgBouncer to manage database connections efficiently as the company scaled its web servers using AWS infrastructure. By introducing this connection pooler, RevenueCat was able to mitigate limitations caused by each server managing its own connections to an AWS RDS cluster based on PostgreSQL, which lacks a built-in connection pooler. The team utilized the AWS Elastic Container Service and Terraform for configuration management and deployed PgBouncer on AWS Fargate, taking advantage of its efficient C-based architecture and asynchronous I/O capabilities. They optimized their setup by configuring transaction pooling, adjusting connection limits, and addressing potential TCP keepalive issues with AWS Network Load Balancer. Monitoring was facilitated through a Prometheus exporter, integrated with Elastic's Metricbeat to track key metrics and performance. The implementation resulted in reduced database load and allowed RevenueCat to efficiently handle concurrent application connections, demonstrating PgBouncer's value in supporting the company's expanding subscription services.