Repository navigation
v1.1.13
@morojs/engine 1.1.13
A scheduling release for the epoll transport. Nothing on the wire changes;
no export or capability flag is added, removed or renamed. The default
behaviour is 1.1.12's; one environment variable selects two more service
orders.
epoll transport: three service orders
1.1.12 serves each loop turn's readable sockets grouped by the CPU their
peer sends from. That order wins wherever the engine answers the request
itself and wherever a peer drives a few connections per thread, and loses
to plain arrival order, by about a quarter at 256 connections, when every
request enters JavaScript under a generator that oversubscribes its cores.
No fixed middle ground exists: shorter runs per group were slower under
both kinds of peer.
MORO_ENGINE_SERVE_ORDER now selects the order for the process:
grouped(the default, unchanged): by peer CPU, socket number within a
group, leading group rotating per turn.arrival: as the kernel reported them.auto: the loop measures both and keeps whichever the current peers
answer faster. A probe is four alternating windows of 200 ms (the first
50 ms of each, while the peers settle into the new order, not counted; a
probe whose two windows of one order disagree by more than 30% saw the
load change and is repeated; leaving the grouped order takes two
consecutive probes that agree, returning to it takes one). The winner by
more than 8% then serves for a stay that grows with the margin, from 1 s
for a near tie to 16 s at a 20% margin, doubling with repeated wins up to
64 s, on boundaries of the monotonic clock so the loops of one host probe
in step. A stay ends early when the peers change: the live rate moves a
quarter away from what the probe measured, or more new connections arrive
in a second than a quarter of the sockets served per turn.
auto is not the default because its benefit is bounded to the one shape
above and, in runs of fifteen seconds, depends on where its first probes
fall; on steady load it settles on the right order within a few seconds and
then costs under one percent. MORO_ENGINE_SERVE_DEBUG=1 logs every probe
and decision to stderr for anyone tuning it.