feat: std.http pooled handler dispatch (PLAN-HTTPZ S7b)
thread_pool_count = 0 (default) keeps handlers inline on the loop thread — the measured fast path (BENCH-HTTPZ.md). N > 0 dispatches each parsed request to a std.thread Pool of N workers, completing the httpz two-pool shape: the connection freezes as CONN_HANDLING (no reads, growth, eviction, or recycling — the worker borrows views into its read buffer), the worker runs the handler under a per-job arena and serializes into job-owned bytes, the completion queues under the PoolState mutex, and the loop wakes through the new std.event wake channel (kqueue EVFILT_USER + EV_CLEAR; the epoll twin maps to eventfd), attaches the response, compacts the buffer, and resumes keep-alive/pipeline handling. A full backlog sheds with 503. Stale completions (generation mismatch after close) are dropped. Pool mode requires the server's constructing allocator to be thread-safe (GPA/malloc), documented on the knob. PoolState lives behind a heap pointer (it embeds a Mutex and is shared with workers; the Server struct itself is returned by value). serialize_response/run_handler_job share one serialize_bytes. examples/1633 gains the pooled section (GET, body echo, 404 across worker threads) plus the loop-wake path exercised end to end; AOT run five times. examples/1632 unchanged but the Event struct gains `user`.
This commit is contained in:
@@ -1367,6 +1367,12 @@ declare i32 @Loop.add_write(ptr, ptr, i32, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare void @Loop.del_write(ptr, ptr, i32) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare i32 @Loop.add_wake(ptr, ptr, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Loop.wake(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare [2 x i64] @Loop.wait(ptr, ptr, ptr, i64) #0
|
||||
|
||||
@@ -1389,7 +1395,13 @@ declare i1 @ascii_ieq(ptr, ptr, ptr) #0
|
||||
declare ptr @reason_for(ptr, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.init(ptr sret({ { { i64, i32, i64, i64, i64, i64, i64 }, { i32 }, i32, ptr, { ptr, ptr, ptr }, ptr, i64 }, i32 }), ptr, ptr, ptr, i64) #0
|
||||
declare void @run_handler_job(ptr, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare [2 x i64] @serialize_bytes(ptr, ptr, i1, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.init(ptr sret({ { { i64, i32, i64, i64, i64, i64, i64, i64, i64 }, { i32 }, i32, ptr, { ptr, ptr, ptr }, ptr, i64, ptr }, i32 }), ptr, ptr, ptr, i64) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.close(ptr, ptr) #0
|
||||
@@ -1424,6 +1436,9 @@ declare i1 @Server.try_serve_one(ptr, ptr, i64) #0
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.serialize_response(ptr, ptr, i64, ptr, i1) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.drain_completions(ptr, ptr) #0
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @Server.write_more(ptr, ptr, i64) #0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user