mdenet / educationplatform

Eclipse Public License 2.0
2 stars 3 forks source link

Performance issue #212

Open szschaler opened 1 month ago

szschaler commented 1 month ago

I just tried to get somewhere around 40 students to generate an Xtext grammar at the same time and it crashed the server. As far as I can tell, the Xtext container and possibly even the Docker daemon got killed. The Xtext container would attempt to restart automatically, which would create extra load on the server, together with all clients continuing to poll for console updates.

It would be worth doing some performance testing to work out what we can do to improve this. It may be an issue to do with the polling for successful editor generation, which we should probably change to server-side events / websockets to improve efficiency.

szschaler commented 1 month ago

We can also consider queuing requests in the Xtext tool so that it doesn't get overloaded.

aryaei2000 commented 1 month ago

The number of polling requests can be the culprit here. It's helpful if we can look into the monitoring software to see what resource was used the most. I believe the current polling method is server-side events, or at least it looks like SSE from the browser side. Switching to web sockets can reduce some overheads.

szschaler commented 1 month ago

Thanks, @aryaei2000 for looking at this. The current polling method is, I think, even worse: it's plain polling :-) The culprit is this recursive call here:

https://github.com/mdenet/educationplatform/blob/fe88277fd9cca3e4b9adbfcc4448e10423c828cd/platform/src/EducationPlatformApp.js#L731

Instead, checkEditorReady should be replaced by a server-side events or websocket implementation where it's the server's responsibility rather than the client's to send updates whenever they're ready.