Hi,

We found a severe performance degradation when Hyperthreading is on
and thread_concurrency=20.

We are using OSDL DBT-1 as the benchmark and got about 200 to 250
BT (bogotransactions per second) HT is OFF normal case but 30 to 
50 BT on HT is ON.

innodb_thread_concurrency=20

So we did profile (using oprofile tool) and got the following profiling
data. My impression is that mutex_spin_wait (and ut_delay) is
something wrong if HT is ON. (Spin-wait loop is too expensive if it is
hyperthreading.)

I added the following code but it does not help it.

$ diff -pu ut0ut.c.orig ut0ut.c
--- ut0ut.c.orig        2005-10-17 10:27:43.000000000 +0900
+++ ut0ut.c     2006-02-28 11:59:16.777840496 +0900
@@ -290,6 +290,13 @@ ut_delay(
        j = 0;

        for (i = 0; i < delay * 50; i++) {
+               /* When executing a spin-wait loop on the Hyper-Threading
+                  processor, the processor can suffer a severe performance
+                   penalty. The pause instruction provides a hint to the
+                   processor. Please refer IA-32 Intel Architecture
+                   Software Developers Manual, Vol 3.                   */
+               __asm__ __volatile__(
+               "pause; \n");
                j += i;
        }

What do you think? Is there any hints?

HT is OFF
CPU: P4 / Xeon, speed 2793.26 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) 
with a unit mask of 0x01 (mandatory)
count 100000
samples  %        image name               app name                 symbol name
13159082  8.8445  libc-2.3.4.so            libc-2.3.4.so            memcpy
12565549  8.4456  libpthread-2.3.4.so      libpthread-2.3.4.so      
pthread_mutex_trylock
11387363  7.6537  mysqld                   mysqld                   
rec_get_offsets_func
9631916   6.4738  libpthread-2.3.4.so      libpthread-2.3.4.so      
pthread_mutex_unlock
8794484   5.9110  mysqld                   mysqld                   
btr_search_guess_on_hash
4949248   3.3265  mysqld                   mysqld                   
row_search_for_mysql
4022481   2.7036  mysqld                   mysqld                   ut_delay
3754265   2.5233  mysqld                   mysqld                   
cmp_dtuple_rec_with_match
2535190   1.7040  mysqld                   mysqld                   
row_sel_store_mysql_rec
2520957   1.6944  mysqld                   mysqld                   
btr_cur_search_to_nth_level

HT is ON
CPU: P4 / Xeon with 2 hyper-threads, speed 2793.26 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) 
with a unit mask of 0x01 (mandatory)
count 100000
samples  %        image name               app name                 symbol name
53221317 21.4225  libpthread-2.3.4.so      libpthread-2.3.4.so      
pthread_mutex_lock
25743323 10.3621  mysqld                   mysqld                   ut_delay
12345146  4.9691  vmlinux                  vmlinux                  do_futex
12066038  4.8568  mysqld                   mysqld                   
mutex_spin_wait
10395391  4.1843  vmlinux                  vmlinux                  
LKST_ETYPE_PROCESS_SCHED_ENTER_HEADER_hook
9247281   3.7222  libpthread-2.3.4.so      libpthread-2.3.4.so      
pthread_mutex_unlock
7407229   2.9815  vmlinux                  vmlinux                  
futex_requeue
5921454   2.3835  libpthread-2.3.4.so      libpthread-2.3.4.so      
pthread_mutex_trylock
5484279   2.2075  vmlinux                  vmlinux                  
LKST_ETYPE_PROCESS_WAKEUP_HEADER_hook
4846067   1.9506  vmlinux                  vmlinux                  __switch_to

Regards,
  Hiro

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to