Serve a tcp channel's outbound queue with the fair queue's round robin (#5289) * Benchmark the queue a tcp channel holds its outbound messages in Measures queuing, the sender's batch pops and the limit check under the channel's mutex, for a channel that only relays votes and for one carrying a spread of traffic types, plus the allocations a channel keeps once it has carried every type. * Extract the fair queue's round robin into fair_ring and fair_lane The ring of non-empty queues, the cursor, the share count and the serve-then-decide pop move out of fair_queue into a class template of their own. A fair_lane is one origin's requests with its cap and share, stored by the owner where it never moves; the fair_ring links the lanes holding requests and keeps the total. fair_queue keeps its origins, its hash map of lanes and its maintenance, and serves exactly as before. A lane now carries a copy of its origin instead of a pointer to the map's key, and refuses to be destroyed while its ring still serves it. The ring gets a suite of its own, including a seeded model check that bounds how many requests another lane may give while a lane waits. * Let a fair queue's owner set the inline capacity of its batches fair_queue takes the number of requests a batch holds inline as a template parameter, defaulting to the 256 every owner uses now, so an owner that keeps its batches somewhere long-lived, such as a coroutine frame, can ask for fewer. * Add enum_fair_queue, a fair queue over the values of an enum Every value of the enum has its lane from the start, with the cap and the share per turn asked once at construction from the queries the owner passes in, so a push is an array index and there is nothing to look up, create or clean up later. The lanes are served by a fair_ring, in the order they filled. Batches hold 256 requests inline by default, as fair_queue's do, and an owner popping small batches can ask for fewer. * Queue a tcp channel's outbound messages in an enum_fair_queue tcp_channel_queue was an older copy of fair_queue's round robin that had drifted from it: it walked every traffic type to find the next queue and returned its batches in a std::deque. The channel now holds a nano::transport::traffic_queue, an enum_fair_queue over traffic types whose shares come from traffic_priority, and pops up to eight messages at a time without allocating. The caps stay at 32 for max () and 128 for dropping, now named on tcp_channel. Within a round the traffic types are served in the order their queues filled rather than in the enum's order, and a type's turn is decided after it is served, as in fair_queue.
__________
Type: commit
Hash: 5165c262f203580b4c90d3270760d2017b42b9db
Created: 2 day(s) ago
__________
gr0v1ty/nano-node:5165c262f203580b4c90d3270760d2017b42b9db
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| 5n4pr_conf_10k_bintree | PASS | 99 s | -9.0 s | GitHub job logs | Show |
| 5n4pr_conf_10k_change | PASS | 119 s | -7.0 s | GitHub job logs | Show |
| 5n4pr_conf_change_dependant | PASS | 103 s | -8.0 s | GitHub job logs | - |
| 5n4pr_conf_change_independant | PASS | 105 s | -4.0 s | GitHub job logs | - |
| 5n4pr_conf_send_dependant | PASS | 121 s | 12.0 s | GitHub job logs | - |
| 5n4pr_conf_send_independant | PASS | 103 s | -9.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_bintree | PASS | 105 s | -4.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_change | PASS | 152 s | -4.0 s | GitHub job logs | - |