diff options
author | Michael Widenius <monty@askmonty.org> | 2013-03-20 01:46:35 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2013-03-20 01:46:35 +0200 |
commit | 615d51b6502e815746664808ef9f396cde16aad1 (patch) | |
tree | 81e18c6892db406c4649c9c36e9b794d7c8d445a /vio | |
parent | 8b047ac5c4b7d326742fd8b7a165a17089a9d83b (diff) | |
download | mariadb-git-615d51b6502e815746664808ef9f396cde16aad1.tar.gz |
Speed up connection time:
-Change my_rnd() slightly to make it safer if two threads use it at the same time.
-Avoid some sprintf and strmov in vio.
-Changed thread_count to be automically incremented (instead of under LOCK_thread_count).
-Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count.
-Moved delete thd out from LOCK_thread_count.
-Save some mysql_cond_broadcast(&COND_thread_count) calls.
-Removed call to getsockname() during connect.
-Initialize random generator without locks.
Other things:
-Added thread_safe_decrement32() and thread_safe_increment32()
-Removed sql_rnd_with_mutex() and get_thread_running()
Thanks to Yoshinori Matsunobu for the benchmark of connection speed and to
Domas Mituzas for the inspiration for many of the fixes.
include/violite.h:
Change desc to a string pointer
mysql-test/suite/perfschema/r/all_instances.result:
Added new mutex
mysys/my_rnd.c:
Change my_rnd() slightly to make it safer if two threads use it at the same time.
sql/event_scheduler.cc:
Changed thread_count to be automically incremented
Moved some safe things out from LOCK_thread_count.
Simplify deleting of THD for running thread.
sql/mysqld.cc:
Changed thread_count to be automically incremented
Thread cache now uses LOCK_thread_cache instead of LOCK_thread_count
Added delete_running_thd()
Moved delete thd out from LOCK_thread_count
More DBUG_ENTER
Only call mysql_cond_broadcast(&COND_thread_count) if thread_count is 0
Removed call to getsockname() (old not anymore needed check)
sql/mysqld.h:
Removed sql_rnd_with_mutex() (not needed anymore)
Removed not used function get_thread_running()
Added thread_safe_decrement32() and thread_safe_increment32()
Simplified dec_thread_running() and inc_thread_running()
sql/sql_class.cc:
Removed thd_lock_thread_count() and thd_unlock_thread_count()
Initialize random generator without locks
sql/sql_insert.cc:
Changed thread_count to be automically incremented
sql/sql_parse.cc:
Changed thread_count to be automically incremented
vio/vio.c:
Don't generate 'desc' with sprintf/strmov. Assign a pointer instead.
(Good enough as this is just for debugging)
Diffstat (limited to 'vio')
-rw-r--r-- | vio/vio.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/vio/vio.c b/vio/vio.c index aed99e72d54..6e2ec3f674b 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -213,9 +213,7 @@ Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags) if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME)))) { vio_init(vio, type, sd, 0, flags); - sprintf(vio->desc, - (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"), - vio->sd); + vio->desc= (vio->type == VIO_TYPE_SOCKET ? "socket" : "TCP/IP"); #if !defined(__WIN__) #if !defined(NO_FCNTL_NONBLOCK) /* @@ -257,7 +255,7 @@ Vio *vio_new_win32pipe(HANDLE hPipe) if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME)))) { vio_init(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, VIO_LOCALHOST); - strmov(vio->desc, "named pipe"); + vio->desc= "named pipe"; } DBUG_RETURN(vio); } @@ -282,7 +280,7 @@ Vio *vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map, vio->event_conn_closed= event_conn_closed; vio->shared_memory_remain= 0; vio->shared_memory_pos= handle_map; - strmov(vio->desc, "shared memory"); + vio->desc= "shared memory"; } DBUG_RETURN(vio); } |