Skip to content

slice serve: low-concurrency per-request overhead (c=1 is 2.7× slower than Bun) #38

Closed

Description

@hassidan

Summary

Under a closed-loop load test with a fresh TCP connection per request, slice serve is competitive at concurrency 8 but noticeably slower at concurrency 1:

numeric/100 handler c = 1 req/s (p50) c = 8 req/s (p50)
slice serve 1,679 (0.406 ms) 5,655 (1.151 ms)
Bun.serve 4,532 (0.163 ms) 6,662 (0.974 ms)
Deno.serve 4,210 (0.170 ms) 6,328 (1.044 ms)
Node http 3,517 (0.178 ms) 5,302 (1.089 ms)

Same machine, same Python client, 3 × 1,000 requests each, all 24,000 responses validated. (The in-repo report shows 148k req/s with 8 sockets × 8-deep pipelining and keep-alive — a different regime where connection setup and isolate acquisition are amortised.)

Interpretation

At c=1 each request pays the full path: accept → parse → acquire warm isolate from pool → run → release. ~0.25 ms of fixed overhead per request versus Bun suggests the per-request isolate acquisition/reset (prelude shard check, VFS/KV snapshot bookkeeping, fuel reset) or the accept path is the cost, not the handler.

Proposal

  • Profile a single-request path with --trace and publish the breakdown (accept, parse, acquire, exec, respond).
  • Keep a per-worker-thread hot isolate bound for the lifetime of a keep-alive connection instead of acquire/release per request; re-acquire only on tenant change.
  • Make isolate reset lazy: snapshot only the state the previous request actually mutated (VFS/KV dirty bits are already tracked for time-travel).
  • Consider SO_REUSEPORT + per-worker accept loops to avoid a shared accept lock at low concurrency.
  • Add a c=1 fresh-connection case to tests/reports so this regime is tracked alongside the pipelined one.

Activity

  1. siktec-lab commented on Nov 9, 2026

    @siktec-lab
    Collaborator

    Addressed in #41 (�0.10.6).

    • Reused a persistent SliceIsolate per worker thread across TCP connections in slice serve, cached the resolved entrypoint handler across requests, and added single-pass __slice_http_url(), lazy LiveReqProto getters, and LazyResProto for zero-header-allocation responses.
    • Measured speedup: Single-socket Keep-Alive throughput increased +28.6% (11,917 -> 15,329 req/s) and multi-core throughput scaled cleanly across worker threads while preserving
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions