radiasoft / sirepo

Sirepo is a framework for scientific cloud computing. Try it out!
https://sirepo.com
Apache License 2.0
64 stars 32 forks source link

cancel sim_frame calls with websockets? #6868

Open moellep opened 8 months ago

moellep commented 8 months ago

If a sim_frame takes a while to run it will stay in the queue even after the page is left.

For example, in activait if you are viewing an image-to-image simulation, the Regression tab has several sim_frame calls which take many seconds to complete (run on the 6722-compare-model-outputs branch which removed the stateless-compute calls).

With no client caching (see #6866), the page will always take 30 seconds or so to load all the plots. If you change tabs back and forth, the queue of requests keeps growing, and can lead to a really long lag time for the most recent sim_frame requests to complete. The sim_frame requests continue to be processed even after the user leaves the simulation to the simulation list.

This behavior also existed with the old http-get sim_frame requests, but once the first response was received, it would get cached and immediately clear all the other requests to the same sim_frame url.

robnagler commented 8 months ago

I think we need to communicate that the "page" is switched in the websocket session. This is some work in that we have to introduce a true session on the server side, but that's easier with websockets, since the requests can be attached to that object. The other thing is canceling requests when the websocket goes away. This is important.