View previous topic :: View next topic |
Author |
Message |
pahud Tux's lil' helper
Joined: 26 Nov 2002 Posts: 103
|
Posted: Thu Sep 25, 2003 3:24 am Post subject: How do you make mysqld to support 1000+ connections? |
|
|
Hello folks,
The default mysql4 ebuild in Gentoo can't support over 1000 threads.
According to the MySQL manual Linux notes
Quote: | If you plan to have 1000+ concurrent connections, you will need to make some changes to LinuxThreads, recompile it, and relink MySQL against the new `libpthread.a'. Increase PTHREAD_THREADS_MAX in `sysdeps/unix/sysv/linux/bits/local_lim.h' to 4096 and decrease STACK_SIZE in `linuxthreads/internals.h' to 256 KB. The paths are relative to the root of glibc Note that MySQL will not be stable with around 600-1000 connections if STACK_SIZE is the default of 2 MB.
|
I tried to emerge -f glibc and found linuxthreads and linuxthreads_db directories under /usr/portage/distfiles, but I have no idea how to tweak the STACK_SIZE value correctly so I can re-emerge glibc and mysql to make it support 1000+ concurrent connections.
Any idea highly welcome.
|
|
Back to top |
|
|
delta407 Bodhisattva
Joined: 23 Apr 2002 Posts: 2876 Location: Chicago, IL
|
Posted: Thu Sep 25, 2003 6:14 pm Post subject: Re: How do you make mysqld to support 1000+ connections? |
|
|
pahud wrote: | I tried to emerge -f glibc and found linuxthreads and linuxthreads_db directories under /usr/portage/distfiles, but I have no idea how to tweak the STACK_SIZE value correctly so I can re-emerge glibc and mysql to make it support 1000+ concurrent connections. | When changes are necessary to a package's source files, you usually end up having to do something like this:
Code: | # ebuild /usr/portage/path/to/ebuild fetch unpack
# cd /var/tmp/portage/package-version/work
# vim [files]
# ebuild /usr/portage/path/to/ebuild qmerge |
That's off the top of my head -- verify that qmerge does what I seem to remember it doing using `man ebuild`.
And, BTW, what kind of hardware do you have to support 1000 simultaneous connections? What kind of application? _________________ I don't believe in witty sigs. |
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Fri Sep 26, 2003 12:34 am Post subject: |
|
|
I wouldn't attempt this with anything less than 2GB RAM and dual CPUs. We've got a beefy box and we're still seeing the occasional problem. Plan on Mysql needing to be restarted monthly and some table corruption every other month.
In case you have a choice in this (I didn't), mysql is not built to setup and tear down tcp connections. It is built to be a db. Keeping total connections under 50 is highly recommended if you want the most speed you can get. Look into persistent connections and other ways to stream multiple queries over the same session.
Also I'd go with Mysql 4 with innodb turned on. Innodb gets rid of the massive table lock which might give you some relief from the corruption issues. I'm still on 3.x myself, haven't found time to properly test 4.x in our enviroment.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
|