Spinning (busy-wait)

Onload User Guide (UG1586)

Document ID
Release Date
1.2 English

Conventionally, when an application attempts to read from a socket and no data is available, the application will enter the OS kernel and block. When data becomes available, the network adapter will interrupt the CPU, allowing the kernel to reschedule the application to continue.

Blocking and interrupts are relatively expensive operations, and can adversely affect bandwidth, latency and CPU efficiency.

Onload can be configured to spin on the processor in user mode for up to a specified number of microseconds waiting for data from the network. If the spin period expires the processor will revert to conventional blocking behavior. Non-blocking sockets will always return immediately as these are unaffected by spinning.

Onload uses the EF_POLL_USEC environment variable to configure the length of the spin timeout.

export EF_POLL_USEC=100000

will set the busy-wait period to 100 milliseconds. See Processing at User-Level for a worked example, and Meta Options for more details.