I am building TCP Proxy: client
<-> proxy
<-> Vertica
I have a net.TCPListener
, which takes incoming requests by AcceptTCP()
and creating connections, then, making connection to destination socket by net.DialTCP("tcp", nil, raddr)
. Looks like a bridge. Default proxy model.
Firstly, at first version, i have a trouble: if i have 59 parallel incoming request, everything is fine. But if i have one more (60), i have a trouble: 1-59 connections are OK, but 60 and newer are fault. I cant catch error properly. Looks like some socket unexpectedly closes
Secondly, i tried to set queue for listener. It helps me a lot: but if i have more than 258 requests, i get error again.
My question: is there any limit of connections in net
package? May be it is system limitation?
For external info: Vertica running in docker container, hw/system: macbook, vertica limit connection pool: 5, but pool logic implemented into proxy.
I also tried set "raw" proxy without pool logic (thats why i set queue for listener: i must not exceed threshold of Vertica User's pool), result is 258 requests..
UPDATED: (05.04.2020)
Looks like it is system limitations fault. Did I mention anywhere that I trying to run the whole system on one PC?
So, what I had:
- 300 parallel processes as requests (making by multiprocessing.Pool Python) (300 sockets)
- Listener that creates 300 connections (once more 300 sockets)
- And series of rapidly creating/closing sockets in deep of proxy (according to queue and Vertica pool)
What I have now:
- 300 python requests making from another PC in my local network (on Windows)
- Proxy works fine
- But I have several errors on Windows PC, which creating requests to my proxy. Errors like low memory in "swap file".
I still need to make some stress test for proxy. Adding less memory for swap file didn't solve my problem on Windows PC. I will be grateful for any suggestions and ideas. Thanks!