Answer the question
In order to leave comments, you need to log in
Which is better - many small requests or one big one?
Something tells me that the question is rather stupid, but unfortunately Google did not give an answer to it.
Actually, on several single-board mini-pc, once every 5 seconds, the node processes certain data, after which it sends it via a web socket to the site page, where the JS script simply renders the received data on the page, without loading the data into the database or anywhere else. From each piece of iron comes from 20 to 30 data packets every 5 seconds.
The question is, did I do the right thing? Or would it be more correct to pack all the data in one package, and send instead of 20 packages, but very small, one, but 20 times more?
At the moment, everything is working stably, without any failures or brakes, but still I'm not sure about the correctness of the current solution.
Answer the question
In order to leave comments, you need to log in
It can be done either way, depending on which side is better.
small packages are more reliable, if something happens to a large one (for example, while it was being collected, the Internet fell and you can’t send it) - you will lose more data. If you have a websocket, then the connection costs are not so big.
But a large packet is most likely more efficient in terms of traffic (if you, for example, have a mobile Internet)
You can generally send via UDP - if one is not scary - sometimes lose the other. This will be the most efficient way to collect monitoring.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question