I am using this website analytics tool: Umami
I am currently looking at the postgresql.conf
file and I see that max_connections
is set to 100.
At peak times, my site may have 1000 concurrent users.
Is Postgresql configured to support that, or does the max_connections
means it will only support 100 at a time and disregard the other 900 users.
Should I increase this value? Is there anything else I need to increase?
If it helps, I’m using NGINX+Ubuntu to store the Postgresql Database
2
Answers
Change in
postgresql.conf
Sample: https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample#L64
Few helpful commands:
default value is 100.
reset
https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS
As a comment, you can use connection pool by programming language (for example, Java, JDBC): https://jdbc.postgresql.org/documentation/head/datasource.html
I think it is also a good practice.
Don’t mix up "concurrent application users" and "concurrent database queries". If your queries are short, you may be able to handle thousands of application users with a handful of database connections.
Use a connection pool, that way you will get the best efficiency, and you won’t risk overloading the database with too many concurrent queries.