From 8a571d88d8d7a3280cc0f85c20d0ba8fe7919128 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Fri, 8 Sep 2023 09:17:33 -0400 Subject: [PATCH 1/2] Increase maximum allowed number of read-only threads to 128 --- plugins/producer_plugin/producer_plugin.cpp | 4 +--- tests/CMakeLists.txt | 4 ++-- tests/read_only_trx_test.py | 12 +++++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index c8db42b9fe..dbebf6dff6 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -617,9 +617,7 @@ class producer_plugin_impl : public std::enable_shared_from_this _ro_thread_pool; fc::microseconds _ro_write_window_time_us{200000}; fc::microseconds _ro_read_window_time_us{60000}; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 71147aaa34..233824062b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -133,9 +133,9 @@ add_test(NAME compute_transaction_test COMMAND tests/compute_transaction_test.py set_property(TEST compute_transaction_test PROPERTY LABELS nonparallelizable_tests) add_test(NAME read-only-trx-basic-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --read-only-threads 0 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_property(TEST read-only-trx-basic-test PROPERTY LABELS nonparallelizable_tests) -add_test(NAME read-only-trx-parallel-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --read-only-threads 6 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME read-only-trx-parallel-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --read-only-threads 128 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_property(TEST read-only-trx-parallel-test PROPERTY LABELS nonparallelizable_tests) -add_test(NAME read-only-trx-parallel-eos-vm-oc-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --eos-vm-oc-enable all --read-only-threads 6 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) +add_test(NAME read-only-trx-parallel-eos-vm-oc-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --eos-vm-oc-enable all --read-only-threads 128 --num-test-runs 3 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_property(TEST read-only-trx-parallel-eos-vm-oc-test PROPERTY LABELS nonparallelizable_tests) add_test(NAME read-only-trx-parallel-no-oc-test COMMAND tests/read_only_trx_test.py -v -p 2 -n 3 --eos-vm-oc-enable none --read-only-threads 6 --num-test-runs 2 ${UNSHARE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) set_property(TEST read-only-trx-parallel-no-oc-test PROPERTY LABELS nonparallelizable_tests) diff --git a/tests/read_only_trx_test.py b/tests/read_only_trx_test.py index 661c3fded8..91f92a8a0b 100755 --- a/tests/read_only_trx_test.py +++ b/tests/read_only_trx_test.py @@ -148,12 +148,14 @@ def verifyOcVirtualMemory(): pageSize = os.sysconf("SC_PAGESIZE") actualVmSize = vmPages * pageSize - # When OC tierup is enabled, virtual memory used by IC is around + # In OC tierup a memory slice is 8GB; + # The main thread uses 529 slices; each read-only thread uses 11 slices. + # Total virtual memory is around: # 529 slices * 8GB (for main thread) + numReadOnlyThreads * 11 slices * 8GB - # This test verifies virtual memory taken by one read-only thread - # is not in the order of 1TB. - otherGB = 1000 # add 1TB for virtual memory used by others - expectedVmSize = ((529 * 8) + (args.read_only_threads * 88) + otherGB) * 1024 * 1024 * 1024 + # This test verifies virtual memory does not grow by the number + # of read-only thread in the order of TB. + memoryByOthersGB = 1000 # add 1TB for virtual memory used by others + expectedVmSize = ((529 * 8) + (args.read_only_threads * 88) + memoryByOthersGB) * 1024 * 1024 * 1024 Utils.Print(f"pid: {apiNode.pid}, actualVmSize: {actualVmSize}, expectedVmSize: {expectedVmSize}") assert(actualVmSize < expectedVmSize) except FileNotFoundError: From 920f325d039c053bddd7ddbac3ed55f151b6d2a1 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Fri, 8 Sep 2023 11:02:30 -0400 Subject: [PATCH 2/2] Add comments explaining why max supported number of read-only threads can be increased --- plugins/producer_plugin/producer_plugin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index dbebf6dff6..bffdf69e4d 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -617,6 +617,12 @@ class producer_plugin_impl : public std::enable_shared_from_this _ro_thread_pool; fc::microseconds _ro_write_window_time_us{200000};