v0.7.0

Resource Limits

Last updated


HakoRun caps every function run on CPU, memory, request size, and time.

Limits at a Glance


LimitDefaultSettingWhen ExceededPlatform
CPU1 core (CPUQuota=100%)MAX_CPUSThrottled by cgroupLinux
Memory128M, swap 0MAX_MEMORYKilled by cgroup OOMLinux
Request body256 KiBCODE_MAX_SIZEHTTP 400All
Execution time30 s + 5 sTIMEOUT_SCRIPTProcess killed; 500 in non-stream, error event in streamAll

systemd Slice


At startup sandbox.NewSlice() writes ~/.config/systemd/user/hakorun.slice, then runs systemctl --user daemon-reload and start:
  1. [Unit]
  2. Description=FaaS Sandbox
  3. [Slice]
  4. CPUQuota=100%
  5. MemoryMax=128M
  6. MemorySwapMax=0

Each sandbox process joins this slice through systemd-run --scope --slice=hakorun.slice, so the caps are shared by all concurrently running functions, not allotted per function. A failed slice setup only logs a warning and the server still starts, without CPU or memory caps.

Time and Size


  • Timeout: TIMEOUT_SCRIPT seconds plus a 5-second buffer form the context deadline; in stream mode a client disconnect also kills the process immediately.
  • Request size: http.MaxBytesReader applies to /run and /run-now bodies; /upload is not limited.


中文