I have a server where wslink is the bridge to a VTK.js client. Both are running locally on my machine.
On the frontend there is a slider that on change is calling a
exportRpc('slider.change') on the server which in turn is calling
actor.SetInputData(*something else*) and then update the renderwindow.
The first thing I noticed was that the server could not handle the amount of requests coming from the client, so I started throttling the events on the client (12fps). But even this seems to be too much for the server to handle.
The thing is the server is able to maintain the 30fps when moving the scene with the mouse without any problem.
I understand changing the actor input data is more expensive then moving the camera, but running the same code on VTK.py without a client renders without any effort + everything is running locally so there’s no lag to blame.
Is exportRpc the best way to receive a stream of events from the client? Or is there a better way?
You also have the publish/subscribe infrastructure but that won’t fundamentally change anything.
I’m not sure I follow all the details of what you’ve done and what you are facing. Are you doing local rendering (view synchronization) with everything defined on the C++/Python side?
If that is the case, the bottle neck could be the scene serialization.
Otherwise in general when changing a variable, I usually throttle the request on server availability and end up squashing the update change if that make any sense.
With trame this is built-in by default. Feel free to give it a try or provide some context example of what you are trying to do via a simple trame example.
I’m sorry for the late reply, I’ve been away on holidays and came back ill.
I am currently doing server-side rendering. I have a React + VTK.js on the frontend and Python + VTK on the backend, communicating via wslink.
We are very invested in our current libraries that use VTK directly, but I can use trame as an example of doing things the correct way.
How do you throttle the request on server availability, can I see that code anywhere?
Thank you very much for your help.
You can use trame as server side and keep your implementation on the client side.
For the code example of throttling on server availability, the code is managed here in trame. But now looking at the code I think I’m missing a line of retry after the
await ... updateState(deltaState).
Actually a better example of what I mean is available in that function.