标签: timeout
与该标签相关的所有文章 "timeout".
-
tower(三):内置中间件-限流、重试、超时与缓冲
tower 提供协议无关的通用中间件, 每个都通过 feature flag 独立启用. 核心六个: ConcurrencyLimit (并发数上限), RateLimit (速率限制), Timeout (超时), Retry (重试 + Policy trait), Buffer (mpsc 通道使 Service 可 Clone), LoadShed (过载丢弃). 它们与 tower-http 的 HTTP 专用中间件互补而非重复.
-
Go 网络(一):goroutine-per-connection 模型与生产实践
Go 的网络编程模型是 goroutine-per-connection:每个连接一个 goroutine,写同步阻塞风格的代码,runtime 的 netpoller 在底层用 epoll/kqueue 实现异步 I/O。关键在于超时管理(Deadline 是绝对时间不是超时)和连接池配置(MaxIdleConnsPerHost 默认 2 是生产环境的坑)。