Skip to content

Perf/execution pipeline optimization - #70

Open
kumar-veerendra wants to merge 4 commits into
mainfrom
perf/execution-pipeline-optimization
Open

kumar-veerendra wants to merge 4 commits into
mainfrom
perf/execution-pipeline-optimization

Conversation

@kumar-veerendra

Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to the backend code execution pipeline, focusing on queue management, error handling, and benchmarking/load testing capabilities. The main changes include enforcing queue limits with clear error responses, optimizing database writes, adding robust benchmarking and load testing scripts, and enhancing resource management for code execution.

Queue Management and Error Handling:

  • Added a QueueCapacityError class and enforced a maximum queue size in the CompilerQueue, returning HTTP 429 errors when the queue is full, and handling queue wait timeouts for jobs that wait too long. [1] [2] [3] [4] [5]
  • Improved error handling in the submission and run endpoints to return user-friendly messages when the queue is full or overloaded. [1] [2]

Resource and Execution Management:

  • Added periodic pruning of stale temporary directories used for code execution to prevent disk space leaks, with an initial and recurring cleanup.
  • Introduced configurable execution and queue limits via environment variables for better scalability and control. [1] [2] [3]

Performance and Benchmarking:

  • Added a comprehensive benchmarking script (benchmark_pipeline_baseline.js) to simulate user submissions, measure backend and user-perceived latencies, and report performance metrics across Python, C++, and Java.
  • Added a load testing script (load_test_queue.js) to simulate various submission scenarios, measure throughput, latency, memory impact, and test queue overload behavior.

Database and Submission Logic:

  • Optimized submission handling by parallelizing independent database writes (submission creation, question stats update, user save) to improve throughput and reduce latency.
  • Improved robustness of user statistics updates to handle cases where the user might not exist (e.g., guest submissions).

Other Improvements:

  • Adjusted estimated wait times for queued jobs for more accurate feedback to users. [1] [2]
  • Added resource limits for code execution, such as maximum output bytes and Java heap sizes, configurable via environment variables.

These changes collectively enhance system reliability under load, provide better feedback to users, and enable thorough performance evaluation and monitoring.

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kumar-veerendra-nqtcoder Ready Ready Preview Aug 31, 2026 4:32pm

This branch was successfully deployed

1 active deployment
Preview — 8d75715b Deployed Aug 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant