2 min read
PostgreSQL - remaining connection slots are reserved for non-replication superuser connections

Postgresql 에서 종종 위와같은 메세지가 나옴. 아래 두가지 명령어로 활성화된 connection과 max_connection를 확인할 수 있음.

SELECT * FROM pg_stat_activity;
show max_connections;

ALTER COMMAND로 buffer, connection 수를 변경할 수 있다. (참고)

ALTER SYSTEM SET max_connections TO '150'; -- increase the value by 50
ALTER SYSTEM SET shared_buffers TO '256MB' -- Increase the value by 128MB

AWS 인스턴스 사이즈에 따른 커넥션 수

MODEL      max_connections innodb_buffer_pool_size
---------  --------------- -----------------------
t1.micro   34                326107136 (  311M)
m1-small   125              1179648000 ( 1125M,  1.097G)
m1-large   623              5882511360 ( 5610M,  5.479G)
m1-xlarge  1263            11922309120 (11370M, 11.103G)
m2-xlarge  1441            13605273600 (12975M, 12.671G)
m2-2xlarge 2900            27367833600 (26100M, 25.488G)
m2-4xlarge 5816            54892953600 (52350M, 51.123G)