Commit b642136
committed
perf: reduce latency via timing constant tuning
Tighten all relay timing constants to cut dead-wait time and flow-control
stalls without touching any logic paths.
tunnel_client.rs:
- REPLY_TIMEOUT 35s -> 20s: GAS hard execution limit is 30s, so 35s
can never catch a live-but-killed session; 20s still covers slow
legitimate responses (~5-10s) with margin.
- Pre-fill poll stagger 1s -> 100ms per slot: eliminated 1s dead time
at every session startup (INFLIGHT_OPTIMIST=2 means 1 slot was always
delayed by 1s).
domain_fronter.rs:
- POOL_TTL_SECS 60 -> 30: faster turnover when IP/DNS changes.
- POOL_REFILL_INTERVAL_SECS 5 -> 2: halves h1 pool recovery window
after an h2 outage.
- H2_READY_TIMEOUT_SECS 5 -> 3: faster h1 fallback on saturated h2
connections.
- H1_KEEPALIVE_INTERVAL_SECS 240 -> 60: keeps GAS containers warm
after 1-min idle instead of 4-min; eliminates 1-3s cold-start
penalty for users who pause streaming. Quota cost is ~360
extra invocations/day, well under the free-tier 6M/day limit.
- H2 flow-control windows 4MB/8MB -> 16MB/32MB: eliminates flow-
control stalls during range-parallel streaming (256 KB chunks).
Memory overhead is zero on idle pooled connections.
- Body Vec pre-sized from content-length header: avoids O(log n)
realloc-and-copy cycles on large GAS responses (up to 40 MB).1 parent b37f7be commit b642136
2 files changed
Lines changed: 22 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
1405 | 1405 | | |
1406 | 1406 | | |
1407 | 1407 | | |
1408 | | - | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
1409 | 1412 | | |
1410 | | - | |
1411 | | - | |
| 1413 | + | |
| 1414 | + | |
1412 | 1415 | | |
1413 | 1416 | | |
1414 | 1417 | | |
| |||
1626 | 1629 | | |
1627 | 1630 | | |
1628 | 1631 | | |
1629 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
1630 | 1635 | | |
1631 | | - | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
1632 | 1641 | | |
1633 | 1642 | | |
1634 | 1643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
1543 | 1543 | | |
1544 | 1544 | | |
1545 | 1545 | | |
1546 | | - | |
| 1546 | + | |
| 1547 | + | |
1547 | 1548 | | |
1548 | 1549 | | |
1549 | 1550 | | |
1550 | 1551 | | |
1551 | 1552 | | |
1552 | | - | |
| 1553 | + | |
1553 | 1554 | | |
1554 | 1555 | | |
1555 | 1556 | | |
| |||
0 commit comments