How to find current connection pool size on heroku

后端 未结 2 1403
不思量自难忘°
不思量自难忘° 2021-02-02 10:32

We have a rails 3.2(.11) app with many dynos running on the heroku bamboo stack, connecting to a MySQL RDS server. There seem to be some issues with our current database connect

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-02 11:14

    To check the pool size, start a heroku console heroku run rails c, and run:

    ActiveRecord::Base.connection_pool.size
    

    Some webservers such as Puma are multithreaded, so the DB pool size matters. You can also run a multi-threaded worker such as Sidekiq, which also will be affected by the pool size.

    Note that Heroku will ignore your database.yml file. To set the pool size you can append ?pool=25 to the DATABASE_URL in your heroku app's configuation.

提交回复
热议问题