1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-5044 This patch replaces PriorityThreadPool with FairThreadPool that uses a simple

operations + morsel size weight model to equally allocate CPU b/w parallel query morsels.
This patch delivers better parallel query timings distribution(timings graph resembles normal
distribution with a bigger left side thus more queries runs faster comparing with PrioThreadPool-based
single-node installation).
See changes in batchprimitiveprocessor-jl.h and comments in fair_threadpool.h for
important implementation details
This commit is contained in:
Roman Nozdrin
2022-05-24 17:57:40 +00:00
committed by Roman Nozdrin
parent 0f0b3a2bed
commit fd8ba33f21
12 changed files with 173 additions and 254 deletions

View File

@ -51,11 +51,10 @@ if (WITH_UNITTESTS)
target_link_libraries(simd_processors ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES} processor dbbc)
gtest_discover_tests(simd_processors TEST_PREFIX columnstore:)
# Comment this out b/c FairThreadPoolRemove segfaults in containers. Moreover this code isn't
# in production yet.
# add_executable(fair_threadpool_test fair_threadpool.cpp)
# target_link_libraries(fair_threadpool_test ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES} processor dbbc)
# gtest_discover_tests(fair_threadpool_test TEST_PREFIX columnstore:)
add_executable(fair_threadpool_test fair_threadpool.cpp)
add_dependencies(fair_threadpool_test googletest)
target_link_libraries(fair_threadpool_test ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES} processor dbbc)
gtest_discover_tests(fair_threadpool_test TEST_PREFIX columnstore:)
# CPPUNIT TESTS
add_executable(we_shared_components_tests shared_components_tests.cpp)

View File

@ -111,12 +111,11 @@ TEST_F(FairThreadPoolTest, FairThreadPoolAdd)
while (threadPool->queueSize())
{
usleep(2500000);
usleep(250000);
}
usleep(2500000);
EXPECT_EQ(threadPool->queueSize(), 0);
EXPECT_EQ(results.size(), 3);
EXPECT_EQ(threadPool->queueSize(), 0ULL);
EXPECT_EQ(results.size(), 3ULL);
EXPECT_EQ(results[0], 1);
EXPECT_EQ(results[1], 3);
EXPECT_EQ(results[2], 2);
@ -139,11 +138,11 @@ TEST_F(FairThreadPoolTest, FairThreadPoolRemove)
while (threadPool->queueSize())
{
usleep(1500000);
usleep(250000);
}
EXPECT_EQ(threadPool->queueSize(), 0);
EXPECT_EQ(results.size(), 2);
EXPECT_EQ(threadPool->queueSize(), 0ULL);
EXPECT_EQ(results.size(), 2ULL);
EXPECT_EQ(results[0], 1);
EXPECT_EQ(results[1], 3);
}
@ -164,11 +163,11 @@ TEST_F(FairThreadPoolTest, FairThreadPoolReschedule)
while (threadPool->queueSize())
{
usleep(1500000);
usleep(250000);
}
EXPECT_EQ(threadPool->queueSize(), 0);
EXPECT_EQ(results.size(), 3);
EXPECT_EQ(threadPool->queueSize(), 0ULL);
EXPECT_EQ(results.size(), 3ULL);
EXPECT_EQ(results[0], 1);
EXPECT_TRUE(isThisOrThat(results, 1, 2, 2, 3));
}