From 50fc281edd559c36d608f3b03afbe9a228b46d56 Mon Sep 17 00:00:00 2001 From: Vadim Sadokhov Date: Wed, 23 Aug 2023 12:32:03 +0300 Subject: [PATCH] add threads ration to kphp config --- compiler/pipes/register-kphp-configuration.cpp | 2 +- compiler/pipes/register-kphp-configuration.h | 1 + tests/phpt/kphp_configuration/10_thread_pool_size.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/pipes/register-kphp-configuration.cpp b/compiler/pipes/register-kphp-configuration.cpp index d91d4b1dd2..5183f67627 100644 --- a/compiler/pipes/register-kphp-configuration.cpp +++ b/compiler/pipes/register-kphp-configuration.cpp @@ -140,7 +140,7 @@ void RegisterKphpConfiguration::handle_constant_runtime_options(const ClassMembe } else if (vk::any_of_equal(*opt_key, warmup_workers_part_key_, warmup_instance_cache_elements_part_key_, warmup_timeout_sec_key_, oom_handling_memory_ratio_key_, mysql_db_name_key_, job_workers_shared_memory_distribution_weights_, - thread_pool_size_key_)) { + thread_pool_ratio_key_, thread_pool_size_key_)) { generic_register_simple_option(opt_pair->value(), *opt_key); } else { kphp_error(0, fmt_format("Got unexpected option {}::{}['{}']", diff --git a/compiler/pipes/register-kphp-configuration.h b/compiler/pipes/register-kphp-configuration.h index 9be46a43c3..e8602d790c 100644 --- a/compiler/pipes/register-kphp-configuration.h +++ b/compiler/pipes/register-kphp-configuration.h @@ -44,6 +44,7 @@ class RegisterKphpConfiguration final : public SyncPipeF { const vk::string_view job_workers_shared_memory_distribution_weights_{"--job-workers-shared-memory-distribution-weights"}; + const vk::string_view thread_pool_ratio_key_{"--thread-pool-ratio"}; const vk::string_view thread_pool_size_key_{"--thread-pool-size"}; public: void execute(FunctionPtr function, DataStream &unused_os) final; diff --git a/tests/phpt/kphp_configuration/10_thread_pool_size.php b/tests/phpt/kphp_configuration/10_thread_pool_size.php index 507a9a4cf2..aa53f7a1a4 100644 --- a/tests/phpt/kphp_configuration/10_thread_pool_size.php +++ b/tests/phpt/kphp_configuration/10_thread_pool_size.php @@ -4,6 +4,7 @@ class KphpConfiguration { const DEFAULT_RUNTIME_OPTIONS = [ "--thread-pool-size" => "10", + "--thread-pool-ratio" => "0.42", ]; }