From df8b6f15d9f153bc1cd03a4fc80b5bab3dc79614 Mon Sep 17 00:00:00 2001 From: CJ Cobb Date: Fri, 26 Mar 2021 08:42:23 -0400 Subject: [PATCH] make cassandra driver thread count configurable --- reporting/CassandraBackend.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reporting/CassandraBackend.cpp b/reporting/CassandraBackend.cpp index 68d64e62..e313f160 100644 --- a/reporting/CassandraBackend.cpp +++ b/reporting/CassandraBackend.cpp @@ -1192,13 +1192,15 @@ CassandraBackend::open() cass_cluster_set_credentials( cluster, username.c_str(), getString("password").c_str()); } + int threads = config_.contains("threads") + ? config_["threads"].as_int64() + : std::thread::hardware_concurrency(); - unsigned int const workers = std::thread::hardware_concurrency(); - rc = cass_cluster_set_num_threads_io(cluster, workers); + rc = cass_cluster_set_num_threads_io(cluster, threads); if (rc != CASS_OK) { std::stringstream ss; - ss << "nodestore: Error setting Cassandra io threads to " << workers + ss << "nodestore: Error setting Cassandra io threads to " << threads << ", result: " << rc << ", " << cass_error_desc(rc); throw std::runtime_error(ss.str()); }