3

I noticed the default pool size for a Rails 5 App using Puma is equal to:

<%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

Which means that you can establish a max number of threads as an environment variable or it will default to 5 database connections.

I have seen some apps that use about 600 as limit for the connection pool, which makes me think it is really not related to the threads, but it seems it is used to keep performance on the green.

What is the logic behind determining the max number of threads, is it related to the processor architecture?

Is the database connection pool completely dependent on the threads, or am I able to keep some flexibility when having a large load of users (about 20,000)?

Jorge Cuevas
  • 131
  • 3
  • I suspect this question is a bit abstract and a bit simple for Server Fault. You might be better off on Stack Overflow. Suggest you do some reading on threading. No point having more database connections available than threads, in most circumstances. Number of threads really depends on what you're doing with them, hardware, software, etc. – Tim Mar 04 '17 at 21:15

0 Answers0