← Graph

Use bouncing IO.select to avoid spin-lock in bidirectional proxies

takeaway 2 connections

When proxying in both directions with IO.select, a naive loop spin-locks at 100% CPU when only one side is ready. The fix is to dynamically remove ready sockets from the select arrays and only bounce them back after a successful transmission, so IO.select can wait passively when the pair is not ready.

type
lesson-learned
takeaway Use bouncing IO.select to avoid spin-lock in bidirectional proxies
about
Bouncing Select concept
Describes the bouncing-select technique
takeaway Use bouncing IO.select to avoid spin-lock in bidirectional proxies
from_talk
Key lesson of the talk

Provenance