talostrading / sonic

Sonic is a Go library for network and I/O programming that provides developers with a consistent asynchronous model, with a focus on achieving the lowest possible latency and jitter in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prioritize certain events over others

sergiu128 opened this issue · comments

I think the way to go here is to encode the priority in one of the transparent poller fields (i think udata64 for epoll and kqueue) as a 32-bit num, leaving the remaining bits to contain the actualy fd. Then when we poll, we first execute the high priority callbacks, and only then the low-prio ones

Certain low prio events might even be dispatched only in empty cycles of Poll.