DEV Community

Discussion on: Chasing down modest database scaling issues when you're not sure what's going on

Collapse
 
samcj profile image
Sam Johnson

If you haven't already it would probably make sense to add connection pooling. I believe Heroku allows you to funnel all of your connections through pgbouncer. Postgres doesn't like having a lot of connections open so it really only scales vertically to a specific limit (connection wise).

In any case it is better to have less connections open since there is a fairly high overheard per postgres connection.

Additionally, if you have workers connecting as well as web servers you can pool them separately in pgbouncer to make sure one doesn't starve the other.

Good luck!

Collapse
 
ben profile image
Ben Halpern

Yeah I think you're right. I feel like I wrongly assumed we weren't as close to this bottleneck as we were. These seem like the obvious next steps.