flowhub / jsjob

Run arbitrary JavaScript code as jobs, in a browser-based sandbox.
MIT License
18 stars 0 forks source link

Long-running browser instead of starting per job #8

Open bergie opened 8 years ago

bergie commented 8 years ago

Currently we start up PhantomJS for each job, which likely takes a non-trivial amount of time. Related TODO, add instrumentation to figure out how long exactly this takes.

Possibly best done by using WebDriver protocol. This will also future-proof us a bit, as it eases changing to a different browser (like Chromium, Firefox etc). However, there are cases where we likely will need to kill the process, like when job hangs forever (longer than deadline).

Need to ensure that this does not interfere with concurrency #4. Might be best to try to keep N (where N = concurrency) webbrowser running. Would then have to hold incoming jobs until for the next available browser is available for new work. Quite tricky compared to current situation...

jonnor commented 8 years ago

For security reasons, each job will need their own JavaScript context. And we need to be able to communicate in a token to that particular job context without other jobs being able to intercept it (see #9).

jonnor commented 8 years ago

It actually looks like startup is on the order of 100 ms on a small laptop with SSD. So I'm leaning towards making this a wont-fix