diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-11-23 19:57:31 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-11-23 19:57:31 +0300 |
commit | bae0e813106d5cd6505b07bd1b682c5eef2ee9d8 (patch) | |
tree | 7a70289a8ca5b5d7d7f3e9081bdb69a4ed488e81 /storage/innobase | |
parent | 9f49582531b7a3a9b74973f0534f9430f7fee75c (diff) | |
download | mariadb-git-bae0e813106d5cd6505b07bd1b682c5eef2ee9d8.tar.gz |
Backport of:
-------------------------------------------------------------
revno: 2877
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: 35164-6.0
timestamp: Wed 2008-10-15 19:53:18 -0300
message:
Bug#35164: Large number of invalid pthread_attr_setschedparam calls
Bug#37536: Thread scheduling causes performance degradation at low thread count
Bug#12702: Long queries take 100% of CPU and freeze other applications under Windows
The problem is that although having threads with different priorities
yields marginal improvements [1] in some platforms [2], relying on some
statically defined priorities (QUERY_PRIOR and WAIT_PRIOR) to play well
(or to work at all) with different scheduling practices and disciplines
is, at best, a shot in the dark as the meaning of priority values may
change depending on the scheduling policy set for the process.
Another problem is that increasing priorities can hurt other concurrent
(running on the same hardware) applications (such as AMP) by causing
starvation problems as MySQL threads will successively preempt lower
priority processes. This can be evidenced by Bug#12702.
The solution is to not change the threads priorities and rely on the
system scheduler to perform its job. This also enables a system admin
to increase or decrease the scheduling priority of the MySQL process,
if intended.
Furthermore, the internal wrappers and code for changing the priority
of threads is being removed as they are now unused and ancient.
1. Due to unintentional side effects. On Solaris this could artificially
help benchmarks as calling the priority changing syscall millions of
times is more beneficial than the actual setting of the priority.
2. Where it actually works. It has never worked on Linux as the default
scheduling policy SCHED_OTHER only accepts the static priority 0.
configure.in:
Remove checks for functions that are not used anymore.
include/config-netware.h:
Remove unused define.
include/my_pthread.h:
Remove thread priority changing wrappers.
mysys/my_pthread.c:
Remove thread priority changing wrappers. They do not work properly
and their implementations were incorrectly protected by a check for
HAVE_PTHREAD_SETSCHEDPARAM.
mysys/thr_alarm.c:
Remove meaningless (100) increase of a thread priority.
sql/mysql_priv.h:
Remove meaningless thread priority values.
sql/mysqld.cc:
Don't change thread priorities.
sql/slave.cc:
Don't change thread priorities.
sql/slave.h:
Update function prototype.
sql/sql_parse.cc:
Don't change thread priorities.
sql/sql_prepare.cc:
Don't change thread priorities.
sql/unireg.h:
Mark flag as obsolete.
storage/innobase/handler/ha_innodb.cc:
Remove use of obsolete flag and associated behavior.
storage/innobase/include/srv0srv.h:
Remove use of obsolete flag and associated variables.
storage/innobase/os/os0thread.c:
Remove use of obsolete flag and associated behavior.
storage/innobase/srv/srv0srv.c:
Remove use of obsolete flag and associated variables.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 7 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 3 | ||||
-rw-r--r-- | storage/innobase/os/os0thread.c | 14 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.c | 3 |
4 files changed, 0 insertions, 27 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 851957e53a5..da41f3c7bbc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2046,13 +2046,6 @@ innobase_init( ut_a(default_path); - if (specialflag & SPECIAL_NO_PRIOR) { - srv_set_thread_priorities = FALSE; - } else { - srv_set_thread_priorities = TRUE; - srv_query_thread_priority = QUERY_PRIOR; - } - /* Set InnoDB initialization parameters according to the values read from MySQL .cnf file */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 23472bd100e..9804a3e7a85 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -207,9 +207,6 @@ extern unsigned long long srv_stats_sample_pages; extern ibool srv_use_doublewrite_buf; extern ibool srv_use_checksums; -extern ibool srv_set_thread_priorities; -extern int srv_query_thread_priority; - extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c index 9a2d95cb166..2cac26fa128 100644 --- a/storage/innobase/os/os0thread.c +++ b/storage/innobase/os/os0thread.c @@ -133,15 +133,6 @@ os_thread_create( 0, /* thread runs immediately */ &win_thread_id); - if (srv_set_thread_priorities) { - - /* Set created thread priority the same as a normal query - in MYSQL: we try to prevent starvation of threads by - assigning same priority QUERY_PRIOR to all */ - - ut_a(SetThreadPriority(thread, srv_query_thread_priority)); - } - if (thread_id) { *thread_id = win_thread_id; } @@ -200,11 +191,6 @@ os_thread_create( #ifndef UNIV_HPUX10 pthread_attr_destroy(&attr); #endif - if (srv_set_thread_priorities) { - - my_pthread_setprio(pthread, srv_query_thread_priority); - } - if (thread_id) { *thread_id = pthread; } diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index d638b23692e..4722640af3f 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -369,9 +369,6 @@ UNIV_INTERN unsigned long long srv_stats_sample_pages = 8; UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE; UNIV_INTERN ibool srv_use_checksums = TRUE; -UNIV_INTERN ibool srv_set_thread_priorities = TRUE; -UNIV_INTERN int srv_query_thread_priority = 0; - UNIV_INTERN ulong srv_replication_delay = 0; /*-------------------------------------------*/ |