I'm working on a small weekend project, which is basically an online IDE that allows you to run PHP, Ruby or Python code from the browser. I have everything setup and working, but the way i created the system, if a user runs a badly-written script, or a script with heavy-calculation, the system might slow down for everyone until i reach the timeout (15 seconds).
My system does not pass the fibonacci test. How can i run the process in isolation, that would allow users to create:
while (true) { fibonacci() } // pseudo-code
Without crashing the server? I have considered the following courses of action:
- Running each process inside a Docker (https://www.docker.io) container, but i'm not sure how docker deals with slow containers
- Running each process inside a VM
- Running each process in an instantly-created EC2 instance (which is not really an option, since this is slow and expensive)