semashkinvg / Bitmex.NET

Wrapper for BitMEX.com REST & WebSocket API
MIT License
52 stars 26 forks source link

REST connection is opened & closed on every request #18

Closed tekr closed 6 years ago

tekr commented 6 years ago

Currently every REST API call uses a new TCP connection. The unnecessarily slows down operations (due to TCP handshake overhead), as well as consuming additional resources.

semashkinvg commented 6 years ago

@tekr you are totally right, but due to the fact that we have a quite small limit of requests per minute, it doesn't bring drastic impact on performance or traffic.
you won't be able to execute thousands of requests whether you dispose of httpclient or not.

however, I think it would be better to dispose of httpClient along with its proxy, so it would make the developer able to manage client lifecycle.

much appreciated if you get it done

thanks,

tekr commented 6 years ago

The main driver was removing TCP connection establishment delay (min 1.5x round-trip time) which can be hundreds of ms depending on network distance.

I'll have a go at disposing HttpClient.

semashkinvg commented 6 years ago

perfect, thanks