How do I set the size of the connection pool?

I’m trying to improve the TechEmpower results for Hanami.

The tests that talk to the database are disproportionately slower than the tests that don’t talk to the database.

As the tests are run on a machine with a lot of cores, Puma (with AUTO_CONCURRENCY=1) will create 57 workers with 3 threads per worker.

I suspect the connection pool size needs to be increased, but I can’t seem to find documentation on how to change it.

Thanks for your help on Hanami’s TechEmpower entry, @p81! :heart:

For increasing the connection pool size, I think you might want one of these?

Set max_connections via database URL, e.g.

DATABASE_URL=postgres://localhost:5432/bookshelf_development?max_connections=10

Or by code inside the :db provider:

Hanami.app.configure_provider :db do
  config.gateway :default do |gw|
    gw.connection_options max_connections: 10
  end
end

Both of these are mentioned here in our database guide. If you think something is missing here or there is any way we could make it clearer, I’m always happy to receive feedback :slight_smile:

And please keep us in the loop regarding your TechEmpower experiments. If this adjustment doesn’t work, I’d love to help you figure it out.

Thanks @timriley
I’ve tried both of them, but setting them to either 1 or 16 doesn’t seem to change the performance.