Ask HN: How did Codeacdemy run code so damn fast?
Thanks!
Thanks!
1) Lightweight sandboxes: unlike many services we don't start full-blown VMs for each user to sandbox they're code and execution environment.
2) Persistent interpreter sessions and environments: Not having to suffer interpreter startup time each time you want to run a piece of code.
3) Websockets: Use of websockets on the browser to open a bi-directional communication channel with the server, which is much faster than ajax. Falling back to xhr-polling, jsonp etc. for older browsers or clients behind firewalls.
4) Output buffering: Stdout from interpreters are buffered and debounced.
5) Responsive server: This is basically like saying we did a good job programming our servers. We thought an event-driven server would be best for our use case (many child processes, idling connections etc.), but then you still have to do a very good job making sure you never block or do anything time intensive.
6) Easily scalable: Investing time in deployment and build process, setting up load balancers etc. allows us to bring new nodes fairly easily when we need them.