fix: In high concurrency (200+), V-Hono experiences an error where the connection is reset problem

This commit is contained in:
meiseayoung
2025-12-30 19:23:09 +08:00
parent 8e1007a1b4
commit d0298ea577
4 changed files with 103 additions and 5 deletions
+7 -2
View File
@@ -342,8 +342,13 @@ pub fn (mut app Hono) listen(port string) {
return
}
// 默认使用 picoev 高性能服务器
app.listen_picoev(port_num)
// 使用优化配置的 picoev 高性能服务器(支持高并发)
app.listen_picoev_with_config(PicoevConfig{
port: port_num
timeout_secs: 120 // 高并发场景需要更长超时
keepalive_timeout: 30 // Keep-Alive 超时 30 秒
max_keepalive_req: 10000 // 单连接最大请求数
})
}
// 使用传统 http.Server 启动(保留兼容性)