# Too many connections error

**URL:** <https://forums.percona.com/t/too-many-connections-error/5274>\
**Category:** PMM 1.x\
**Created:** [December 8, 2016, 1:56pm UTC](https://forums.percona.com/t/too-many-connections-error/5274 "2016-12-08T13:56:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tyler/32/1153_2.png) [@Tyler](https://forums.percona.com/u/Tyler)\
**Post date:** [December 8, 2016, 1:56pm UTC](https://forums.percona.com/t/too-many-connections-error/5274/1 "2016-12-08T13:56:01Z")

</div>

I spun up a pmm 1.0.6 server. After enabling qan on about 60 servers I get errors like:

2016/12/08 19:20:13 server.go:2317: http: response.WriteHeader on hijacked connection  
2016/12/08 19:20:13 server.go:2317: http: response.Write on hijacked connection  
2016/12/08 19:20:13.252 127.0.0.1 500 705.712µs WS /agents/f47e5df7c29446a04ea13530da9a21d2/data  
ERROR 2016/12/08 19:20:14 init.go:229: auth agent: auth.MySQLHandler.GetAgentId: dbm.Open: Error 1040: Too many connections

Is this a parameter I can change?

Any ideas about how many mysql instances I could support with a single pmm server if I only run qan?

Thanks!

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 8, 2016, 2:56pm UTC](https://forums.percona.com/t/too-many-connections-error/5274/2 "2016-12-08T14:56:40Z")

</div>

In theory, it is only limited by the amount of resources available for container or underlying host.

Looks like there is an issue with MySQL in the container “Error 1040: Too many connections”  
If you enter container how many connections do you see?

docker exec -it pmm-server mysql -vv -e ‘show processlist’

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tyler/32/1153_2.png) [@Tyler](https://forums.percona.com/u/Tyler)\
**Post date:** [December 8, 2016, 3:43pm UTC](https://forums.percona.com/t/too-many-connections-error/5274/3 "2016-12-08T15:43:13Z")

</div>

152 rows of:

```auto
| 11521 | qan-api | localhost:33840 | pmm | Sleep | 2752 | | NULL |
| 11550 | qan-api | localhost:33953 | pmm | Sleep | 2744 | | NULL |
| 11551 | qan-api | localhost:33956 | pmm | Sleep | 40 | | NULL |
| 11567 | qan-api | localhost:34054 | pmm | Sleep | 2732 | | NULL |
| 11568 | qan-api | localhost:34056 | pmm | Sleep | 14 | | NULL |
| 11805 | qan-api | localhost:35108 | pmm | Sleep | 2645 | | NULL |
| 11806 | qan-api | localhost:35110 | pmm | Sleep | 2645 | | NULL |
| 11820 | qan-api | localhost:35179 | pmm | Sleep | 2642 | | NULL |

```

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tyler/32/1153_2.png) [@Tyler](https://forums.percona.com/u/Tyler)\
**Post date:** [December 8, 2016, 5:49pm UTC](https://forums.percona.com/t/too-many-connections-error/5274/4 "2016-12-08T17:49:14Z")

</div>

Seems like I can handle around 25 mysql servers

---

<div class="post-metadata">

**Author:** ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)\
**Post date:** [December 9, 2016, 1:32am UTC](https://forums.percona.com/t/too-many-connections-error/5274/5 "2016-12-09T01:32:31Z")

</div>

We have found 1 potential place in the code where it may not close connections. In the next release next week.
