Building Scalable Online Judge Systems
A deep dive into creating competitive programming platforms with load balancing, security, and multi-language support. Lessons learned from building Andalus Judge for Ethiopian programmers.
Introduction
Building an online judge system is one of the most challenging and rewarding projects I've undertaken. When I started Andalus Judge, my goal was simple: create a platform where Ethiopian programmers could practice competitive programming without relying on international platforms with high latency.
The Architecture
An online judge has several critical components:
1. Submission Queue
We used Celery with Redis as the message broker to handle the queue of submissions. This allows us to process submissions asynchronously and scale horizontally.
2. Sandboxed Execution
Security is paramount. Each submission runs in an isolated Docker container with:
3. Test Case Management
Test cases are stored separately and streamed to the judge during evaluation. This prevents memory issues with large test files.
Challenges Faced
Load Balancing
During contests with 200+ participants, we needed to distribute the load across multiple judge servers. We implemented a custom load balancer that considers:
Security Concerns
Users will try to break your system. We encountered:
Each required specific countermeasures in our sandbox configuration.
Results
After two years of development and iteration:
Lessons Learned
The journey of building Andalus Judge taught me more about system design than any course or book could.