Configure authorized_prepared_statment_cache memory limit during object creation
This commit is contained in:
@@ -110,8 +110,8 @@ private:
|
||||
|
||||
public:
|
||||
// Choose the memory budget such that would allow us ~4K entries when a shard gets 1GB of RAM
|
||||
authorized_prepared_statements_cache(std::chrono::milliseconds entry_expiration, std::chrono::milliseconds entry_refresh, logging::logger& logger)
|
||||
: _cache(memory::stats().total_memory() / 2560, entry_expiration, entry_refresh, logger, [this] (const key_type& k) {
|
||||
authorized_prepared_statements_cache(std::chrono::milliseconds entry_expiration, std::chrono::milliseconds entry_refresh, size_t cache_size, logging::logger& logger)
|
||||
: _cache(cache_size, entry_expiration, entry_refresh, logger, [this] (const key_type& k) {
|
||||
_cache.remove(k);
|
||||
return make_ready_future<value_type>();
|
||||
})
|
||||
@@ -184,4 +184,4 @@ struct hash<cql3::authorized_prepared_statements_cache_key> final {
|
||||
inline std::ostream& operator<<(std::ostream& out, const cql3::authorized_prepared_statements_cache_key& k) {
|
||||
return out << "{ " << k.key().first << ", " << k.key().second << " }";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ query_processor::query_processor(service::storage_proxy& proxy, distributed<data
|
||||
, _authorized_prepared_cache(std::min(std::chrono::milliseconds(_db.local().get_config().permissions_validity_in_ms()),
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(prepared_statements_cache::entry_expiry)),
|
||||
std::chrono::milliseconds(_db.local().get_config().permissions_update_interval_in_ms()),
|
||||
authorized_prepared_statements_cache_log) {
|
||||
mcfg.authorized_prepared_cache_size, authorized_prepared_statements_cache_log) {
|
||||
namespace sm = seastar::metrics;
|
||||
|
||||
_metrics.add_group(
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
class migration_subscriber;
|
||||
struct memory_config {
|
||||
size_t prepared_statment_cache_size = 0;
|
||||
size_t authorized_prepared_cache_size = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
2
main.cc
2
main.cc
@@ -603,7 +603,7 @@ int main(int ac, char** av) {
|
||||
// #293 - do not stop anything
|
||||
// engine().at_exit([&mm] { return mm.stop(); });
|
||||
supervisor::notify("starting query processor");
|
||||
cql3::query_processor::memory_config qp_mcfg = {memory::stats().total_memory() / 256};
|
||||
cql3::query_processor::memory_config qp_mcfg = {memory::stats().total_memory() / 256, memory::stats().total_memory() / 2560};
|
||||
qp.start(std::ref(proxy), std::ref(db), qp_mcfg).get();
|
||||
// #293 - do not stop anything
|
||||
// engine().at_exit([&qp] { return qp.stop(); });
|
||||
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
auto stop_mm = defer([&mm] { mm.stop().get(); });
|
||||
|
||||
auto& qp = cql3::get_query_processor();
|
||||
cql3::query_processor::memory_config qp_mcfg = {memory::stats().total_memory() / 256};
|
||||
cql3::query_processor::memory_config qp_mcfg = {memory::stats().total_memory() / 256, memory::stats().total_memory() / 2560};
|
||||
qp.start(std::ref(proxy), std::ref(*db), qp_mcfg).get();
|
||||
auto stop_qp = defer([&qp] { qp.stop().get(); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user