0

I recently tried out an RDS serverless with my node-js based chat engine, almost everything works fine except one problem.

I create my MySQL connection pools as below,

    host       : config.database.host_read,
    user: config.database.user,
    password : config.database.password,
    database : config.database.database,
    port       : config.database.port,
    waitForConnections: true,
    connectionLimit: 2000,
    queueLimit: 10
});

The issue is that RDS serverless DB Count just keep on growing and growing hence it thinks that server is busy and upgrades to the next level for no reason. When it reaches 2000 it just goes back to 0 and start again, I think the issue is connection pool is keeping connections alive even there is no users to use it, which is fine, thats how connections pools are designed to use, however in a serverless cloud environment ideally i want the connections to be expired after certain time, i could not find any documentation on that

Some people said to reduce DB parameter wait timeout, but none of them actually worked. see below for my DB varaibles

connect_timeout
30
delayed_insert_timeout
300
innodb_flush_log_at_timeout
1
innodb_lock_wait_timeout
15
innodb_rollback_on_timeout
OFF
interactive_timeout
30
lock_wait_timeout
15
net_read_timeout
30
net_write_timeout
60
rpl_stop_slave_timeout
31536000
slave_net_timeout
3600
wait_timeout
15

Any ideas on how to solve this issue?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
mahen3d
  • 7,047
  • 13
  • 51
  • 103

1 Answers1

0

I have written this article talking about Serverless, lambda e db connections. There are some good concepts which could help you to find the root cause of your problem. There are also examples and use cases of how to mitigate connection pool issues.

Serverless: Dynamodb x Mongodb x Aurora serverless

Cleriston
  • 750
  • 5
  • 11