# max concurrency can not be greater than 300

**URL:** <https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710>\
**Category:** General\
**Created:** [June 21, 2022, 6:11am UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710 "2022-06-21T06:11:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fxsjy](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/fxsjy/32/11077_2.png) [@fxsjy](https://community.fly.io/u/fxsjy)\
**Post date:** [June 21, 2022, 6:11am UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/1 "2022-06-21T06:11:55Z")

</div>

I use a benchmark tool called “hey” to do the performance test.

The target of the test if just a nginx serve static small files about 30 bytes.

here is the command, which means 1000 request with 300 concurrent client.

hey -n 1000 -c 300 https://${myapp}.fly.dev/hello

However, I got many “connection reset by peer”.

And, when I decrease the “-c” paramter to smaller, like 200, then all the requests is succesfull.

I don’t know why, could you help me to figure it out? Many thanks to you guys.

> **[GitHub - rakyll/hey: HTTP load generator, ApacheBench (ab) replacement](https://github.com/rakyll/hey)**
>
> HTTP load generator, ApacheBench (ab) replacement. Contribute to rakyll/hey development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![michael](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/michael/32/16_2.png) [@michael](https://community.fly.io/u/michael)\
**Post date:** [June 21, 2022, 7:01am UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/2 "2022-06-21T07:01:49Z")

</div>

Can you share your fly.toml file? I’m curious what [concurrency](https://fly.io/docs/reference/configuration/#services-concurrency) values you have set.

---

<div class="post-metadata">

**Author:** ![fxsjy](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/fxsjy/32/11077_2.png) [@fxsjy](https://community.fly.io/u/fxsjy)\
**Post date:** [June 21, 2022, 1:19pm UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/3 "2022-06-21T13:19:27Z")

</div>

Thank you for your quick response.  
It may be caused by https. The benchmark for http://$[myapp.fly.dev](http://myapp.fly.dev) works well, however, if I replace “http” with “https”, the server can only serve at most 200 concurrent connections.

---

<div class="post-metadata">

**Author:** ![fxsjy](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/fxsjy/32/11077_2.png) [@fxsjy](https://community.fly.io/u/fxsjy)\
**Post date:** [June 21, 2022, 1:20pm UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/4 "2022-06-21T13:20:08Z")

</div>

kill\_signal = “SIGINT”

kill\_timeout = 5

processes =

[env]

PORT = “3000”

[experimental]

allowed\_public\_ports =

auto\_rollback = true

[[services]]

http\_checks =

internal\_port = 3000

processes = [“app”]

protocol = “tcp”

script\_checks =

[services.concurrency]

hard\_limit = 100

soft\_limit = 50

type = “connections”

[[services.ports]]

force\_https = false

handlers = [“http”]

port = 80

[[services.ports]]

handlers = [“tls”, “http”]

port = 443

[[services.tcp\_checks]]

grace\_period = “1s”

interval = “15s”

restart\_limit = 0

timeout = “2s”

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [June 21, 2022, 1:27pm UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/5 "2022-06-21T13:27:44Z")

</div>

Try changing the concurrency `type` to `requests`. Connections concurrency means our proxy is opening a new connecting to your VM each time. nginx does not like that and tends to behave better when we pool connections.

`type="requests"` lets us pool connections.

---

<div class="post-metadata">

**Author:** ![amos](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/amos/32/2036_2.png) [@amos](https://community.fly.io/u/amos)\
**Post date:** [June 21, 2022, 2:23pm UTC](https://community.fly.io/t/max-concurrency-can-not-be-greater-than-300/5710/6 "2022-06-21T14:23:12Z")

</div>

> [@fxsjy](#):
>
> However, I got many “connection reset by peer”.

This is expected behavior — there’s concurrency limits on TLS handshakes (max concurrent handshakes per IP). You’ll need to spread your test across several IPs to make it look more like organic traffic to get meaningful numbers.
