Skip to content

NUT swarm stress testing (WIN32): upsd should prepare an array of all handles ready to talk, and iterate it like in POSIX code path #3376

@jimklimov

Description

@jimklimov

Currently the POSIX code path in upsd::mainloop() uses poll() to highlight an array of file descriptors ready for immediate interaction, and iterates that array before the next loop for a new set of file descriptors (drivers, clients, listeners...) to check the status of.

The Windows code path relies on WaitForMultipleObjects() which takes an array of handles and returns the array index of the first handle ready to talk, then we interact with that one handle and repeat the whole mainloop() from scratch.

This RFE is about using a series of WaitForMultipleObjects() with a sliding window (to restart from the last highlighted handle, checking up to sysmaxconn handles at a a time), so we can prepare the array of all known active handles and then walk it in the sub-loop before repeating the mainloop() from scratch -- like we do in POSIX code path. This might be the less resource-intensive approach, and should preclude an early-listed extremely active connection from starving all others of their time-share of the server's attention (this point is generally stressed in #3365).

Bonus aspect: maybe as a result of this, the code base for POSIX and WIN32 builds can be de-duplicated (if there would be replaceable implementations for polling of a huge array of FD/HANDLE instances, and checking their status (incoming, closed, etc.) and so we would simplify its maintenance and evolution.

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    WindowsWindows-not-on-par-with-POSIXAspect of Windows builds known to be dysfunctional compared to POSIX builds; fix needed to be on parenhancement

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions