Skip to content

Request Limits (Hard Rules)

This system enforces strict limits to prevent OOM and service instability.

Important: 120s is a hard safety cap, not a design target.


1. Hard Safety Caps (Server-Enforced)

SettingLimitNotes
PHP-FPM request timeout120sRequests beyond this may be terminated
PHP max execution time120sSafety cap to prevent stuck workers
PHP memory per request256MBPrevents runaway memory usage

✅ These caps protect production stability.
❌ These are not recommended targets for normal web requests.


2. Web Request Design Targets (Developer Rules)

All HTTP requests must be designed to complete quickly.

Request TypeIdealMax
Public pages200ms – 2s10s
APIs< 1s5–10s
Forms/auth flows< 2s10–15s
Admin actions (rare)< 5s30s (absolute max)

If a request cannot reliably complete within these limits, it must be moved to a queue job.


3. Queue / Background Jobs (Where Heavy Work Belongs)

Heavy processing is allowed only in background jobs.

Work TypeWhereTypical Timeout
Reports/exportsQueue job120–300s (split if needed)
Bulk processingQueue job120–300s
Image/video processingQueue job120–300s

Required Pattern

  • HTTP request should:
    • Validate input
    • Dispatch job
    • Return immediately (Accepted / Processing)
  • Job should:
    • Run with memory/time caps
    • Be retry-safe and idempotent

4. Strictly Forbidden in Code

Runtime overrides that bypass safety caps are not allowed:

php
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 100000);
ini_set('upload_max_filesize', '2G');
ini_set('post_max_size', '2G');