LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
680 stars 165 forks source link

Number of connections CPUs, Memory... #139

Closed bashman closed 3 years ago

bashman commented 3 years ago

Greetings.

I would like to know some of your experiences regarding the number of connections and resources in the system. For example, I have 10 users that I must monitor positions and orders. At the moment I have an exclusive server for connections through websockets. I have 2 gb ram and 2 cpu and I would like to know what number of connections by WS I can keep active.

I understand that from a single ip address you can handle 200 connections, according to the binance documentation and that depending on the type of subscription the connection could be kept active 24 hours, I think this changed recently (https://binance-docs.github.io/apidocs/futures/en/#websocket-market-streams).

My doubt arises because before I saw in the documentation, that the connection would be disconnected in 60 minutes and only 100 connections from a single ip. if 24 hours arrive in a connection, Unicorn Binance Websocket Api handles this automatically for keep alive te connection?, or I must do it on my own within one while cycle (unsubscribe and reconect???), regarding CPU and memory usage, how much cpu and memory could I need for example for 10 users?. I am working in binance futures.

Thanks.

oliver-zehentleitner commented 3 years ago

hi bashman!

for userdata streams you need the api keys and secret. for all other you dont. I dont know if binance handles those types in a different manner. maybe the userdata streams are not restricted to X streams per IP, but all others are.

you can ask this question direct to binance via telegram: https://t.me/binance_api_english

please share the answer you get there!

yes, this lib aims to manage your streams. you create them and process the receives, everything else (reconnect, subscriptions, pings, keep alive listenkeys,... ) is the job of ubwa. If it doesnt restart please open an issue on github and we try to fix that.

I dont know your system in detail, but i have a similar one (2vcpus and 2 or 4 GB RAM) and it streams everything from binance.com. The peak on this server was handling 15000 received records in one second. (https://ubwa-demo.lucit.co/print_summary.php)

From my experience not receiving the data is the problem, but how you are processing it.

best regards, Oliver

oliver-zehentleitner commented 3 years ago

Then I close this! You can still post the answer of binance! thanks!

bashman commented 3 years ago

you can ask this question direct to binance via telegram: https://t.me/binance_api_english

Yes I am in Telegram group.