A brief overview of how Codecademy has scaled their code evaluation system to handle up to 5,000 submissions a second for a variety of languages, frameworks, and APIs.
Handles web sockets (sockm/sockjs) • Negotiates the codex protocol (simple JSON) • All messages are events on the connection object, with an optional payload: client requests a spawn event [{"type": "spawn", "data": "ruby"}] WE’RE HIRING: http://codecademy.com/jobs
hosted ◦ HAProxy (round robin software lb) ◦ HAProxy handles websockets out of the box • N-number codex-hosts (this changes as the service scales up or down) WE’RE HIRING: http://codecademy.com/jobs
OS level virtualization, ve with its own process and network space (uses linux kernel groups, think Heroku Dyno rather than VMware) • User separation (unix file system permissions, home directories) • Port restrictions • Resource limiting (rlimit and nice, no core dumps, limit child procs, etc)
Runner management ◦ Process management ▪ Kill/respwan ◦ Lifetime of the runner ◦ Infinite loop detection • File management • Authentication • Error handling (response back to the user/browser)
(language dependent) to run passed in code • Do sanity checks/clean up • Ability to run correctness tests, think of these like unit tests for user submissions • Adapter communicates with the runners over STDIO • Runners read from STDIN, respond on STDOUT and/or STDERR