-1

I'm using a Linux server (Ubunto 18.04) that hosts the Postgres database. PostgreSQL makes CPU Usage up-to 100% and sometimes the related web site is down and after server restarting the site turns to work fine.

Running the query:

SELECT
(now() - pg_stat_activity.query_start) as interval,  state
FROM pg_stat_activity

Results more than complex queries running at the same time responding to site navigation requests and depending on the number of connected users.

The problem is of the number of connected users increases the site is blocked and after restarting the database server it turns to work fine.

Could you please tell me how to solve this problem?

The server RAM is more than 23GB.

1
  • 1
    SHOW config_file; to see your settings, As well, please share your logs so we can see what is going on I think the webserver logs should show what is causing this, as well as the postgres logs. Commented Nov 5, 2020 at 15:57

1 Answer 1

0

I believe you have to increase the connection pool as well as shared memory. This link should get you in the right place.

https://stackoverflow.com/questions/30778015/how-to-increase-the-max-connections-in-postgres

In retrospect though, what are the users all doing to cause these lockups?

2
  • 1
    there are complex queries at the same time that cause this problem and over 180 users block the site because the CPU is overused. This is the configuration max_connections = 1000 shared_buffers =4GB #wal_buffers = 16MB work_mem =82MB maintenance_work_mem =512MB Commented Nov 5, 2020 at 16:11
  • I think you must have a bad quary somewhere. Try this cybertec-postgresql.com/en/…. Commented Nov 6, 2020 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .