cubes icon indicating copy to clipboard operation
cubes copied to clipboard

synchronous web API

Open dtheodor opened this issue 11 years ago • 1 comments

Hi,

The requests supported by the web API can potentially hit the database with very expensive queries and take a while to finish. This creates some issues:

  • the API can become a liability if exposed to a malicious user, since it can very easily bring the database and the web server to a halt.
  • the scalability of the web server is limited. Web requests that require some long-running (where long is defined as more than few seconds) computation need to offload that to some background task processing. The requester can be updated through polling/pushing on when the result is available.

Is there interest to provide an option to turn the API requests "async", say with integrating with an asynchronous task queue (such as Celery)?

dtheodor avatar Mar 07 '15 21:03 dtheodor

That sounds like a useful feature. Can you please elaborate the implementation in more details?

Few notes: I would suggest not to include dependency on Celery in Cubes though. If you have a suggestion that would involve creation of some async-supporting API, let's discuss it. There is new plugin system planned (see #259), so it might be kind of Slicer/server plugin? We just need to define the plugin hooks.

Stiivi avatar Mar 19 '15 03:03 Stiivi