mikekonan / exchange-proxy

exchange-proxy
GNU General Public License v3.0
110 stars 32 forks source link

Concurrency limit? #31

Closed xmflsct closed 2 years ago

xmflsct commented 2 years ago

Getting

2021/12/29 17:24:25 The incoming connection cannot be served, because 262144 concurrent connections are served. Try increasing Server.Concurrency

How to increase concurrency? Thanks!

mikekonan commented 2 years ago

Hello, how many proxy clients do you have? Is it freqtrade bots or something else?

xmflsct commented 2 years ago

Not so many, it was around 10-11 freqtrade instances running. I have another VM which runs perfectly with 18 freqtrade instances. I suspect it is because of pairs not clients?

mikekonan commented 2 years ago

It's because of amounts of requests, so the limit has to be increased.

mikekonan commented 2 years ago

Has proxy crashed?

xmflsct commented 2 years ago

No, the proxy did not crash, at least not from Docker's point of view.

The situation just appeared on my other VM which hosts that 18 freqtrade instances. Very weird. Don't know how to properly reproduce the situation. Will monitor a bit further.

mikekonan commented 2 years ago

fastHttp server has its own connection pool with a 1024*256 connection limit. So I will make it configurable in the next release

mikekonan commented 2 years ago

#v1.2.1 added -concurrency-limit parameter

xmflsct commented 2 years ago

Thanks! What is a reasonable amount to set? 1024*256 seems already high, but not sure how many to count for each instance?

mikekonan commented 2 years ago

Actually, I don't know, so I recommend you increase that twice until the issue would not occurs. Also, it's could be an issue with freqtrade HTTP client that does not close connections in time.

mikekonan commented 2 years ago

What is the output of "ulimit -n"?

xmflsct commented 2 years ago

ulimit -n

In which context?

mikekonan commented 2 years ago

On your Linux instance

xmflsct commented 2 years ago

On the Linux VM, the result is 1024. In the docker container that runs freqtrade instance, the result is 1048576.

mikekonan commented 2 years ago

What is the output of sudo lsof -Pi -p $PROXY_PID? From your host

mikekonan commented 2 years ago

Also, I suggest checking the amount of opened file descriptions on your instance - https://www.cyberciti.biz/tips/linux-procfs-file-descriptors.html

xmflsct commented 2 years ago

sudo lsof -Pi -p $PROXY_PID shows a long list.

The total count currently is 222.