Commit 25949aa
Fabio Angius
feat: reject_throttle — pace connection opens after establishment failures
Opt-in (default off; off is behaviourally identical to today). When a connection
fails to ESTABLISH, the pool otherwise retries every connection immediately and in
lockstep — stampeding a server that is already rejecting connections. With
reject_throttle enabled the pool keeps a single failed connection as the lone
prober (retrying with backoff), blocks the rest, and on each prober handshake
success admits an exponentially growing batch of waiters (slow-start, capped at
`max`), disengaging once the backlog drains.
This complements the existing per-connection `backoff`: backoff only delays each
retry, and since its counter is pool-shared every connection waits the same delay
and then fires together — a delayed herd. reject_throttle instead keeps exactly one
attempt in flight during an outage.
It governs only the clean-close establishment-reconnect path
(`if (initial) return reconnect()`); error-close (RST) and connect-timeout still
reject as before.
Tests in tests/reject_throttle.js (21 cases): option plumbing, throttle-vs-herd,
single prober, ramp collapse, recovery and disengagement (including large backlogs
and max:1), drop-path intact via max_lifetime, and boundaries (RST reject,
connect_timeout, off == vanilla).1 parent e7dfa14 commit 25949aa
4 files changed
Lines changed: 438 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
365 | 417 | | |
366 | 418 | | |
367 | 419 | | |
| |||
447 | 499 | | |
448 | 500 | | |
449 | 501 | | |
450 | | - | |
451 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
452 | 508 | | |
453 | 509 | | |
454 | 510 | | |
455 | | - | |
| 511 | + | |
456 | 512 | | |
457 | 513 | | |
458 | 514 | | |
| |||
566 | 622 | | |
567 | 623 | | |
568 | 624 | | |
| 625 | + | |
569 | 626 | | |
570 | 627 | | |
571 | 628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
391 | 409 | | |
392 | 410 | | |
393 | 411 | | |
394 | 412 | | |
395 | 413 | | |
396 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
397 | 445 | | |
398 | 446 | | |
399 | 447 | | |
400 | 448 | | |
401 | 449 | | |
402 | | - | |
| 450 | + | |
| 451 | + | |
403 | 452 | | |
| 453 | + | |
404 | 454 | | |
405 | 455 | | |
406 | 456 | | |
| |||
416 | 466 | | |
417 | 467 | | |
418 | 468 | | |
| 469 | + | |
| 470 | + | |
419 | 471 | | |
420 | 472 | | |
421 | 473 | | |
422 | 474 | | |
423 | 475 | | |
424 | 476 | | |
425 | 477 | | |
426 | | - | |
| 478 | + | |
427 | 479 | | |
428 | 480 | | |
429 | 481 | | |
| |||
455 | 507 | | |
456 | 508 | | |
457 | 509 | | |
| 510 | + | |
458 | 511 | | |
459 | 512 | | |
460 | 513 | | |
| |||
495 | 548 | | |
496 | 549 | | |
497 | 550 | | |
498 | | - | |
| 551 | + | |
499 | 552 | | |
500 | 553 | | |
501 | 554 | | |
| |||
0 commit comments