Bandwidth limiter jitter (protocol.c:30-58): The token bucket throttle uses nanosleep() for deficit sleep. Short sleeps on a loaded system can overrun. The 65536-byte chunk size for throttling may cause burstiness.
SSL thread-local statics (protocol.c:11-13): io_read_fd, io_write_fd, io_ssl are __thread statics. This works with fork()-per-connection but prevents using a thread pool on the server side without complex TLS context management.
Replace nanosleep with timerfd for precise bandwidth shaping, or use ppoll() with a deadline.
Move IO state into a per-connection context struct passed through the call chain instead of thread-local statics.
Severity
low
Category
performance
Sub-Agent
perf-analyst (PA-6, PA-7)
This issue was automatically generated by the issue-creator agent.
## Description
Two performance issues in the I/O layer:
1. **Bandwidth limiter jitter** (protocol.c:30-58): The token bucket throttle uses `nanosleep()` for deficit sleep. Short sleeps on a loaded system can overrun. The 65536-byte chunk size for throttling may cause burstiness.
2. **SSL thread-local statics** (protocol.c:11-13): `io_read_fd`, `io_write_fd`, `io_ssl` are `__thread` statics. This works with `fork()`-per-connection but prevents using a thread pool on the server side without complex TLS context management.
## Location
- src/shared/protocol.c:11-13 (thread-local statics)
- src/shared/protocol.c:30-58 (bw_throttle)
## Suggested Fix
1. Replace nanosleep with `timerfd` for precise bandwidth shaping, or use `ppoll()` with a deadline.
2. Move IO state into a per-connection context struct passed through the call chain instead of thread-local statics.
## Severity
low
## Category
performance
## Sub-Agent
perf-analyst (PA-6, PA-7)
---
_This issue was automatically generated by the issue-creator agent._
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
Two performance issues in the I/O layer:
Bandwidth limiter jitter (protocol.c:30-58): The token bucket throttle uses
nanosleep()for deficit sleep. Short sleeps on a loaded system can overrun. The 65536-byte chunk size for throttling may cause burstiness.SSL thread-local statics (protocol.c:11-13):
io_read_fd,io_write_fd,io_sslare__threadstatics. This works withfork()-per-connection but prevents using a thread pool on the server side without complex TLS context management.Location
Suggested Fix
timerfdfor precise bandwidth shaping, or useppoll()with a deadline.Severity
low
Category
performance
Sub-Agent
perf-analyst (PA-6, PA-7)
This issue was automatically generated by the issue-creator agent.
Fixed in PR #148 — merged into main on 2026-07-29.