mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-19 16:15:07 +00:00
storage_proxy uses std::vector<inet_address> for small lists of nodes - for replication (often 2-3 replicas per operation) and for pending operations (usually 0-1). These vectors require an allocation, sometimes more than one if reserve() is not used correctly. This series switches storage_proxy to use utils::small_vector instead, removing the allocations in the common case. Test results (perf_simple_query --smp 1 --task-quota-ms 10): ``` before: median 184810.98 tps ( 91.1 allocs/op, 20.1 tasks/op, 54564 insns/op) after: median 192125.99 tps ( 87.1 allocs/op, 20.1 tasks/op, 53673 insns/op) ``` 4 allocations and ~900 instructions are removed (the tps figure is also improved, but it is less reliable due to cpu frequency changes). The type change is unfortunately not contained in storage_proxy - the abstraction leaks to providers of replica sets and topology change vectors. This is sad but IMO the benefits make it worthwhile. I expect more such changes can be applied in storage_proxy, specifically std::unordered_set<gms::inet_address> and vectors of response handles. Closes #8592 * github.com:scylladb/scylla: storage_proxy, treewide: use utils::small_vector inet_address_vector:s storage_proxy, treewide: introduce names for vectors of inet_address utils: small_vector: add print operator for std::ostream hints: messages.hh: add missing #include