Skip to content

Lightpanda: the headless browser designed for AI and automation

perf: Increase default max connections

Karl Seguinf1e49aae6e5c
diff --git a/src/Config.zig b/src/Config.zig
index 68db591aa..11a89fb6a 100644
--- a/src/Config.zig
+++ b/src/Config.zig
@@ -353,14 +353,14 @@ pub fn proxyBearerToken(self: *const Config) ?[:0]const u8 {
pub fn httpMaxConcurrent(self: *const Config) u8 {
return switch (self.mode) {
- inline .serve, .fetch, .mcp, .agent => |opts| opts.http_max_concurrent orelse 10,
+ inline .serve, .fetch, .mcp, .agent => |opts| opts.http_max_concurrent orelse 40,
else => unreachable,
};
}
pub fn httpMaxHostOpen(self: *const Config) u8 {
return switch (self.mode) {
- inline .serve, .fetch, .mcp, .agent => |opts| opts.http_max_host_open orelse 4,
+ inline .serve, .fetch, .mcp, .agent => |opts| opts.http_max_host_open orelse 6,
else => unreachable,
};
}
diff --git a/src/agent/Agent.zig b/src/agent/Agent.zig
index b62333243..4b7c61c80 100644
--- a/src/agent/Agent.zig
+++ b/src/agent/Agent.zig
@@ -162,7 +162,7 @@ const script_skill =
\\ await Promise.all(pages.map((p, i) => p.goto(items[i].url))); // all in flight at once
\\ return pages.map((p, i) => ({ ...items[i], ...p.extract({ /* schema */ }) }));
\\ ```
- \\ - Concurrency is bounded by the HTTP connection pool (10 by default, `--http-max-concurrent`); extra navigations queue rather than fail. For long lists, fan out in batches and `page.close()` each page once read so its memory is reclaimed.
+ \\ - Concurrency is bounded by the HTTP connection pool (40 by default, `--http-max-concurrent`); extra navigations queue rather than fail. For long lists, fan out in batches and `page.close()` each page once read so its memory is reclaimed.
\\ - `Promise.all` rejects the whole batch if any `goto` *fails* (a timeout does not reject); use `Promise.allSettled` when partial results are fine.
\\ - Walk **serially** on one page (`for (const it of items) { await page.goto(it.url); … }`) only when the steps depend on each other — each page decides the next URL, or they share login/session state.
\\3. **`evaluate` is a last resort, not a reading tool.** A `querySelectorAll`-and-parse `page.evaluate` block is always wrong: lift the raw strings with `page.extract`, then trim/split/parse them in top-level JS. Reserve `page.evaluate` for behavior that must run inside the page and no builtin covers — and remember its state dies on every navigation/reload, while script variables persist.
diff --git a/src/help.zon b/src/help.zon
index eb9d11c2d..718561ef8 100644
--- a/src/help.zon
+++ b/src/help.zon
@@ -307,10 +307,10 @@
\\ Proxy-Authorization: Bearer <token>.
\\ --http-max-concurrent <INT>
\\ Maximum number of concurrent HTTP requests.
- \\ Defaults to 10.
+ \\ Defaults to 40.
\\ --http-max-host-open <INT>
\\ Maximum open connections to a given host:port.
- \\ Defaults to 4.
+ \\ Defaults to 6.
\\ --http-connect-timeout <INT>
\\ Time in ms to establish an HTTP connection before timing out. 0 means
\\ never.