List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:July 17 2003 3:10am
Subject:Re: MySQL, FreeBSD, LinuxThreads, and > 950 connections?
View as plain text  
In the last episode (Jul 16), Jeremy Zawodny said:
> On Wed, Jul 16, 2003 at 03:16:26PM -0500, Dan Nelson wrote:
> > In the last episode (Jul 16), Jeremy Zawodny said:
> > > Does anyone have MySQL built with LinuxThreads running on FreeBSD
> > > 4.x and handling more than 950 connections?
> > > 
> > > If so, did you need to do anything special to make it work?  I'm
> > > seeing this:
> > > 
> > > Can't create a new thread (errno 35). If you are not out of
> > > available memory, you can consult the manual for a possible
> > > OS-dependent bug
> > 
> > I don't suppose you're hitting a maxproc resource limit?  Check
> > "limits" and "sysctl -a | grep maxproc".
> 
> Does't seem that way, no.
> 
> bash-2.05b# limits -a
> Resource limits (current):
>   datasize          1048576 kb
>   stacksize           65536 kb
>   maxprocesses         3686
> 
> bash-2.05b# sysctl -a | grep maxproc   
> kern.maxproc: 4096
> kern.maxprocperuid: 3686

I don't know exactly how LT allocates its threads, but a 65536KB
stacksize rlimit divided by the default MySQL thread stack size of 64K
gives you 1024.  Doubling this rlimit might help.  You mentioned
reducing the thread stack size already, though, so it may not be an
issue.  If you can trigger this on demand, try enabling ktrace on the
process just before you hit the limit (remember to disable tracing with
ktrace -C afterward), then use kdump to see whether any syscalls are
actually returning EINTR (aka errno 35).  It might narrow down exactly
which resource is being exhausted.

A possibly more interesting question is:  What is the default thread
stack size, and where does it get set?  The docs claim the default is
64k (although all the example output says 128k).  The source says the
default is 192k (huge!), but "show variables like 'thread_stack'" on a
running server prints 64k.

-- 
	Dan Nelson
	dnelson@stripped
Thread
MySQL, FreeBSD, LinuxThreads, and > 950 connections?Jeremy Zawodny16 Jul
  • Re: MySQL, FreeBSD, LinuxThreads, and > 950 connections?Dan Nelson16 Jul
    • Re: MySQL, FreeBSD, LinuxThreads, and > 950 connections?Jeremy Zawodny16 Jul
      • Re: MySQL, FreeBSD, LinuxThreads, and > 950 connections?Dan Nelson17 Jul
        • Re: MySQL, FreeBSD, LinuxThreads, and > 950 connections?Jeremy Zawodny17 Jul