Skip to content

Multi-core serving via SO_REUSEPORT #7

Description

@hellerve

The event loop is single-threaded, saturating at roughly 60k req/s on one core. For multi-core scaling, the standard approach is fork + SO_REUSEPORT: each child process runs its own event loop bound to the same port, and the kernel distributes incoming connections.

Requires:

  • TcpListener.set-reuseport in the socket library
  • System.fork exposed in Carp
  • A serve-with-workers variant or a worker-count parameter on serve

Blocked on a clean concurrency story in Carp. The thread-based alternative (pthreads or green threads) needs the StaticFn proposal or a fix for the closure-capture-mutation issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions