# Max\_connections and thread pooling?

**URL:** <https://forums.percona.com/t/max-connections-and-thread-pooling/4801>\
**Category:** Other MySQL® Questions\
**Created:** [March 22, 2016, 11:34am UTC](https://forums.percona.com/t/max-connections-and-thread-pooling/4801 "2016-03-22T11:34:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KBlack](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@KBlack](https://forums.percona.com/u/KBlack)\
**Post date:** [March 22, 2016, 11:34am UTC](https://forums.percona.com/t/max-connections-and-thread-pooling/4801/1 "2016-03-22T11:34:25Z")

</div>

Currently running Mysql 5.6 with the default one client per thread connection model. I want to switch to the thread\_pool model but was wonderiing if the max\_connections variable in my.cnf becomes obsolete once you switch to thread\_pools. Does anyone know for sure?

---

<div class="post-metadata">

**Author:** ![Igor](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@Igor](https://forums.percona.com/u/Igor)\
**Post date:** [April 12, 2016, 7:04am UTC](https://forums.percona.com/t/max-connections-and-thread-pooling/4801/2 "2016-04-12T07:04:14Z")

</div>

Yes and no:

Imagine you have a quad core processor with HT, so you end up with 8 possible threads (default if you don’t manually set thread\_pool\_size).  
You are also using max\_connections=100.

Without using thread pool feature, if you have 80 incoming connections MySQL would try to handle all connections in parallel. So if all of your connections are just reading you would end up with 80 concurrent queries at maximum (or 100 due to max\_connections).

When using thread pool feature you would end up with only running 8 queries in parallel. So what will happen to the other 72 connections? They will hang in the queue and wait for execution.

So is max\_connections now obsolete when using thread pooling? No! max\_connections are controlling your “backlog”, i.e. how many connections are allowed to wait.

Imagine, if you would set max\_connections to the same value like thread\_pool\_size your applications would probably throw “Too many connections” errors when you have more than 8 clients.

It is important to understand that when using thread pooling feature your max\_connections setting no longer affects your memory usage like before. Before using a thread pool you had to calculate buffer settings & co. \* max\_connections to make sure you won’t run out of memory when all possible connections are active. Now when using thread pool you only have to multiply with thread\_pool\_size when calculating memory usage which allows you to spend more memory on other things.
