Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what exactly 'connections' mean in heroku postgres

I am building a website on Django hosted at Heroku. I think at the peak time about 500-600 users can use it simultaneously. I can't figure out what is the best postgres plan. According to this: https://elements.heroku.com/addons/heroku-postgresql#details

heroku-postgresql:standard-0 has a connection limit of 120, and heroku-postgresql:standard-2 has a connection limit of 400.

Is it enough to have connections of 120 for about 500 users? Or it is entirely irrelevant?

like image 252
Philipp Chapkovski Avatar asked Oct 27 '25 14:10

Philipp Chapkovski


1 Answers

Is it enough to have connections of 120 for about 500 users?

This isn't something that can be answered with certainty by anyone other than you but there's some general understanding that might be helpful here.

In most cases for basic web applications, one user on your website != one connection used for as long as they're using the app. For instance, that user might need a connection while they log in and load their profile, but not while they're simply viewing the content. While they're idling on a page, those database connections can service other users. With sensible defaults and connection pooling, 120 connections should be plenty for 500 concurrent users.

All that being said, it's on the application developer to manage database connections and pooling to ensure that this behavior is enforced. Also, this position only represents an average web app and there are certainly apps out there whose users require longer-lived connections.

like image 53
RangerRanger Avatar answered Oct 30 '25 14:10

RangerRanger