diff --git a/main.cpp b/main.cpp index 93fca21..8e969b9 100644 --- a/main.cpp +++ b/main.cpp @@ -75,6 +75,7 @@ main(int ac, const char* av[]) auto enable_json_api_opt = opts.get_option("enable-json-api"); auto enable_as_hex_opt = opts.get_option("enable-as-hex"); auto enable_tx_cache_opt = opts.get_option("enable-tx-cache"); + auto concurrency_opt = opts.get_option("concurrency"); auto enable_block_cache_opt = opts.get_option("enable-block-cache"); auto show_cache_times_opt = opts.get_option("show-cache-times"); auto enable_emission_monitor_opt = opts.get_option("enable-emission-monitor"); @@ -865,10 +866,17 @@ main(int ac, const char* av[]) else { cout << "Staring in non-ssl mode" << endl; - app.bindaddr(bindaddr).port(app_port).multithreaded().run(); + if (*concurrency_opt == 0) + { + app.bindaddr(bindaddr).port(app_port).multithreaded().run(); + } + else + { + app.bindaddr(bindaddr).port(app_port) + .concurrency(*concurrency_opt).run(); + } } - if (enable_emission_monitor == true) { // finish Emission monitoring thread in a cotrolled manner. diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index 3ff85c4..7dc7d72 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -67,6 +67,8 @@ namespace xmreg "maximum time, in milliseconds, to wait for mempool data for the front page") ("mempool-refresh-time", value()->default_value("5"), "time, in seconds, for each refresh of mempool state") + ("concurrency,c", value()->default_value(0), + "number of threads handling http queries. Default is 0 which means it is based you on the cpu") ("bc-path,b", value(), "path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb") ("ssl-crt-file", value(),