From 9ba60915c40c99578c72cec8e268079461fdf2b0 Mon Sep 17 00:00:00 2001 From: Teresaliu Date: Thu, 24 Aug 2023 01:04:01 -0700 Subject: [PATCH] add pading to solve false sharing problem MySQL could has some scalability issues as the the number of threads increase in select random ranges/points senarios; more details is there: https://bugs.mysql.com/bug.php?id=111594 After investigation, this problem is located as a false sharing problem, and this kind cacheline contention problem could be reduced by adding code pading to separate variables in the one cacheline. This patch is add pading in class buf_page_t to separate two variables m_version and access_time. Signed-off-by: Teresaliu Signed-off-by: Lin Yang --- storage/innobase/include/buf0buf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 6251597b210..9374803ed7e 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1614,6 +1614,9 @@ class buf_page_t { the truncation number. */ uint32_t m_version{}; + /** Pading to solve false sharing problem */ + char pading[ut::INNODB_CACHE_LINE_SIZE]; + /** Time of first access, or 0 if the block was never accessed in the buffer pool. Protected by block mutex */ std::chrono::steady_clock::time_point access_time; -- 2.34.1