node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

connection limit "500" exceeded for non-bootstrap users

Open jagadeeshmarthy opened this issue 10 years ago • 4 comments

Hi, I'm using node-postgres for connecting to redshift and I'm getting the above error often when I'm starting my new Node server. I'm creating connections using pool.

Regards jagadeesh

jagadeeshmarthy avatar Oct 22 '16 12:10 jagadeeshmarthy

Maybe you should share some code...

Tigerino avatar Oct 24 '16 11:10 Tigerino

var config = { user: "sampleUser", database: "sampledb", password: "sample", port: "xyz...", host: "xyz...", min: 10, max: 50, idleTimeoutMillis: 30000 };

var pool = new pg.Pool(config);

This is the code i'm using for each request and each request have some 8 to 10 queries.

2 kinds of errors i'm getting often: 1.connection limit "500" exceeded for non-bootstrap users 2.ECONN timed out

jagadeeshmarthy avatar Oct 24 '16 17:10 jagadeeshmarthy

You should only create the Pool once and re-use it in each request.

Tigerino avatar Oct 25 '16 07:10 Tigerino

Yah, instantiate one pool for your app and it will limit connections down to 50 in your case (max: 50)

Thanks for the help @Tigerino

brianc avatar Oct 25 '16 17:10 brianc