websocket reconnect / page reload jitter #3990
Replies: 3 comments 5 replies
-
Maybe your page does to much cpu-bound or io-bound work on the main thread? See https://github.com/zauberzeug/nicegui/wiki/FAQs#why-is-my-long-running-function-blocking-ui-updates for more infos. |
Beta Was this translation helpful? Give feedback.
-
My app is dealing with a small-medium amount of data (about 70MB) which it transmits to the client to show in aggrid. However, the initial data load is done using an I have done various levels of instrumentation around all these operations and the highest timing is about 0.5s which occurs in the application start up when I the data on start up. Sending each batch out to clients on startup runs in about 0.13s. Once the application has booted up successfully, there do not appear to be any particular performance issues, it is only on initial boot up where it seems that the influx of reconnecting clients all at once is causing sockets to timeout, page reloads, and a new connection attempt is made, and it goes in a bit of a loop until it finally makes it through everything. My assumption is that the startup is fine (in my logs, that startup routine is called with normal looking timings prior to client connection logs being made). It also seems that, in so far as a client connection is made and served, that is also fine (I don't see increased timings in sending data to the client when there are more connections, but rather that the clients experience socket time outs.. Perhaps I can try to measure a delta between page invocation and client connection to attempt to discern where the delay is occurring. I will try to put together a slimmed down example of the use case and how I am structuring things to help the discussion - but if you have any thoughts / ideas on the above in the meantime, I would be glad to hear them! |
Beta Was this translation helpful? Give feedback.
-
Do you think there is any merit to adding an option that allows you to jitter the reconnects? socket.io itself has options for that around reconnects and avoiding a pile up of connections.. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have an issue with a nicegui application where, if there are many people who have the application window open (perhaps lost in a sea of tabs) whenever I deploy code updates and restart the server, it appears that the more people have the app open, the more connections come in at once and seem to block the app from booting quickly and serving requests.
I am going to experiment with adding a jitter around where
window.location.reload()
is called for reconnects - also wondering if anyone else has this problem, or if there are other workarounds / patterns for handling many reconnects on boot.Beta Was this translation helpful? Give feedback.
All reactions