mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-30 11:36:54 +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
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2021 ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* This file is part of Scylla.
|
|
*
|
|
* Scylla is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Scylla is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
#include <seastar/core/lowres_clock.hh>
|
|
#include "gms/inet_address.hh"
|
|
|
|
#include "utils/UUID.hh"
|
|
#include "gms/inet_address.hh"
|
|
|
|
namespace db {
|
|
|
|
namespace hints {
|
|
|
|
struct sync_point_create_request {
|
|
// The ID of the sync point to create.
|
|
utils::UUID sync_point_id;
|
|
// Towards which nodes hints should be replayed for this sync point?
|
|
std::vector<gms::inet_address> target_endpoints;
|
|
// The sync point will be deleted at this point of time if hints won't be
|
|
// sent by that time.
|
|
lowres_clock::time_point mark_deadline;
|
|
};
|
|
|
|
struct sync_point_create_response {};
|
|
|
|
struct sync_point_check_request {
|
|
// The ID of the sync point whose status we want to check
|
|
utils::UUID sync_point_id;
|
|
};
|
|
|
|
struct sync_point_check_response {
|
|
// Returns true if the sync point has expired: either hints were replayed,
|
|
// or the deadline was reached.
|
|
bool expired;
|
|
};
|
|
|
|
}
|
|
|
|
}
|