Algocode is a DSA practice platform just like Leetcode!
Read the blog Β»
Algocode Auth Service .
Code Manager Service .
RCE Engine Service
Algocode is an online data structure and algorithm practice backend built in microservices architecture.
Algocode currently has three services: Algocode Auth Service . Code Manager Service . and RCE Engine Service
RCE Engine Service is responsible to execute the user submitted code in the Algocode Platform. The current RCE Engine has C++ Judge that can compile,execute and compare testcases against the output of the code execution.
RCE Engine for Java Judge and RCE Engine for Python Judge are under development.
The Code Manager service publishes the user codes in RabbitMQ instance, the RCE Engine listen to C++ queue and compiles, executes and compares the testcases with the code execution output. Once a result is produced either comparing the testcases, or any error occurred during the code execution, RCE Engine publishes the result to a unified result queue which is consumed by the Code Manager service to finally cache the result in Redis and store the result in MongoDB for persistence.
To learn more about Algocode and the architecture, please READ-THE-BLOG-URL or visit Algocode here.
A. About the Judge
Algocode is built from scratch.
No 3rd party APIsor3rd party packageshas been used to implement theJudge. It is purely a docker implementation with secure and protected environment.
B. Connectivity
The
RCE Engineis completely isolated service. No API has been exposed in theRCE Engine. It is only connected through theMessage Queue.
C. Documentation
As the
RCE Enginedoes not have any API to interact with, there's no dedicated documentation page for RCE Engine. However, adequate comment has been added in the codebase.
D. Deployment
The service is deployed in AWS EC2 Ubuntu 22.04 server.
E. About Algocode
This is RCE Engine Service specific guideline.
Please visit Algocode to learn the mircroservices architecture of Algocode and more in-depth guideline how to submit a solution to Algocode platform.
Details
The Algocode RCE Engine (C++ Judge) uses the following services to serve the request during Production Stage.
a. Docker to securely execute the user submitted code
b. Portainer to manage and monitor docker container in RCE Engine
c. RabbitMQ for asynchronous message processig.
d. Django as backend.
e. Docker to containerize the service.
The Code Manager Service is deployed in AWS EC2 Ubuntu 22.04 Server.
RCE Engine is the heart behind the Algocode platform. It executes the user submitted code that was published by Code Manager Service to a RabbitMQ instance, and finally publishes the result to a unified result queue that is consumed by the Code Manager service.
The client can not directly interact with the RCE Engine Service as RCE Engine is isolated, secure service and it is only accessible to Message Queue.
The C++ Judge in the RCE Engine works in sibling containers architecture. The host docker container for the RCE Engine is capable of spawning sibling containers to execute the code submitted by the user. The sibling container spawned by the host docker container is secure, non-privileged and restricted container. The sibling containers are capable of fighting any potential malicious code execution such as fork-bomb, resource exhaustion file-hijacking etc.
Please visit Online Judge, it is a
PoCof theC++ Judgeimplemented in the RCE Engine. You will find more in-depth analytical documentation on the various state ofC++ Judgein the Prototype of C++ Judge.
A separate light-weight prototype for the C++ Judge is also available. This prototype is a PoC for the C++ Judge and easier to test and manage. It can handle API requests as well as preset question to test the PoC of C++ Judge.
Please visit the FAQ of Online Judge to learn more about the Prototype of the C++ Judge. It has more detailed and analytical comparisons between the various state of the C++ Judge.
- Watch from
16:30for code execution begin and18:30for code submission result.
- Watch from
09:30for code execution begin and11:30for code submission result.
The Code Manager Service publishes the user submitted code to C++ Queue and the RCE Engine consumes from a C++ Queue to execute the code.
Once the RCE Engine consumes from the queue, it processes the data and prepares for the code execution.
As the pre-processing is completed, the C++ Judge compiles and executes the code.
Finally, the RCE Engine compares the testcases against the code execution output, if the code execution is successful, or it processes the error occurred during the compilation or execution stage, and publishes the final result to a unified result queue.
This unified result queue is consumed by the Code Manager Service to cache the result in Redis and finally store the result in MongoDB database for persistence.
Please fork and clone this development branch of Algocode RCE Engine (C++ Judge) Service, and follow along with the envs-examples.
cd to src and create a virtual environment. Activate the virtual environment.
Run make docker-up and the development setup will start running. Please install make in your host machine.
If you use Windows Operating System, please run the respective docker commands from the dev.yml docker compose file.
You are always welcome to contribute to the project. Please open an issue or raise a PR on the project.