Skip to content

Commit

Permalink
increase default max_conn, limit min_conn
Browse files Browse the repository at this point in the history
  • Loading branch information
karlseguin committed Sep 18, 2024
1 parent 496a9f5 commit b5a46d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ try httpz.listen(allocator, &router, .{
// Maximum number of concurrent connection each worker can handle
// (blocking mode: currently ignored)
.max_conn = 500,
.max_conn = 8_192,
// Minimum number of connection states each worker should maintain
// (blocking mode: currently ignored)
.min_conn = 32,
.min_conn = 64,
// A pool of larger buffers that can be used for any data larger than configured
// static buffers. For example, if response headers don't fit in in
Expand Down
4 changes: 2 additions & 2 deletions src/worker.zig
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ pub fn NonBlocking(comptime S: type, comptime WSH: type) type {
.websocket = websocket,
.allocator = allocator,
.signal = .{ .read_fd = signals[0], .write_fd = signals[1] },
.max_conn = config.workers.max_conn orelse 512,
.max_conn = config.workers.max_conn orelse 8_192,
};
}

Expand Down Expand Up @@ -1107,7 +1107,7 @@ const HTTPConnPool = struct {
websocket: *anyopaque,

fn init(allocator: Allocator, buffer_pool: *BufferPool, websocket: *anyopaque, config: *const Config) !HTTPConnPool {
const min = config.workers.min_conn orelse config.workers.max_conn orelse 64;
const min = config.workers.min_conn orelse @min(config.workers.max_conn orelse 64, 64);

var conns = try allocator.alloc(*HTTPConn, min);
errdefer allocator.free(conns);
Expand Down

0 comments on commit b5a46d1

Please sign in to comment.