Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2001 00:09:22 -0000
From:      "Andrew Tulloch" <andrewt@great4.co.uk>
To:        "Ken Menzel" <kenm@icarz.com>
Cc:        <stable@FreeBSD.ORG>
Subject:   Re: SMP and MySQL/threads
Message-ID:  <002401c1836a$6c452f50$0100a8c0@excalibur>
References:  <077a01c18332$3ffd4190$4c0116ac@ANDREWT> <025c01c18336$649e1980$0701a8c0@desktop> <021c01c18347$ac0af340$711663cf@icarz.com>

next in thread | previous in thread | raw e-mail | index | archive | help
My understanding is that the pthread is totally userland and implements the
threads all inside one process. The kernel has no idea about scheduling
threads and sees each pthread using process as a single process, which it
therefore can only schedule to be on one CPU at anyone time. linuxthreads
creates n threads by having n+1 processes where n>1, the extra process
handles communication between threads. This has the advantage that seperate
threads can be scheduled by the kernel on seperate CPUs at the same time
because they are seperate processes and thefore something it knows about.
The disadvantage being that you end up with a big pile of processes that end
up drowning other processes as they take up more CPU time that a single
threaded process would as the scheduler thinks each process deserves their
slice of CPU. This isn't really an issue for me as I have two machines that
are almost entirely dedicated to MySQL (they also run apache to provide a
web interface content management system, but the load from that is minimal).
I was mostly looking for confirmation that MySQL+linuxthreads was the way to
go as the warning message in the port put me off a bit, I've been running
MySQL with linuxthreads on Linux for some time, just never used linuxthreads
on FreeBSD.

Thanks
Andrew



----- Original Message -----
From: "Ken Menzel" <kenm@icarz.com>
To: "Chynnee" <chynnee@mindspring.com>; "Andrew Tulloch"
<andrewt@great4.co.uk>
Cc: <stable@FreeBSD.ORG>
Sent: Wednesday, December 12, 2001 8:00 PM
Subject: Re: SMP and MySQL/threads


> Hi Brad and Andrew,
>   Maybe pthread CAN run on different CPU's,  but I know that MySQL
> runs on only one CPU with native BSD threads and mutliple CPU's with
> Linux threads.  I have tested this and currently have problems with
> running out of CPU occasionally on 1 processor and response times
> dropping off (single process goes to 99% in top, overall cpu usage
> stays below 50%, dual CPU machine,  responses to other users slow or
> stopped (different databases in use),  could be a bug in MySQL or
> threads having to do with waiting threads).  (BTW to answer the
> original posters question,  I also have been running Linux threads for
> several months with no problems).  I want to run Linux threads on
> production machines but I am skittish about running anything where I
> don't fully understand how the module is built.  I can get the port to
> build just fine,  but I can't seem to build a working Linux Threaded
> MySQL outside of the port environment (I like to build from the tar
> file!).   I am not sure this is a topic for -stable,  maybe this would
> be more appropiate for ports.  Unless there is a way to make MySQL use
> native threads better.
>
> I understood that having a single process use more than one CPU in
> FreeBSD threads was a feature coming in 5.0?  Is this wrong?  See:
> http://www.bsdtoday.com/2001/June/News508.html
>
>
> If something in MySQL needs to change I am sure they will change it to
> make it work better.  We as the BSD community have to tell them what
> needs to be done.  MySQL is critcal to our business,  and it's
> important to us that it works as well as possible.  I am sure other
> FreeBSD users are in this position as well. Besides,  I don't like
> penguins.
>
> Ken
>
>
>
>
> ----- Original Message -----
> From: "Chynnee" <chynnee@mindspring.com>
> To: "Andrew Tulloch" <andrewt@great4.co.uk>
> Cc: <stable@FreeBSD.ORG>
> Sent: Wednesday, December 12, 2001 12:56 PM
> Subject: Re: SMP and MySQL/threads
>
>
> > Pthread's threads CAN run on different CPUs if they are giving the
> right
> > attributes:
> > pthread_attr_setscope(&thread_attributes, PTHREAD_SCOPE_SYSTEM);
> >
> > then the "thread_attribute" is used when creating the thread.
> >
> > mysql seems to use this attribute.
> > maybe if someone is running it on a SMP box, they could tell us
> more.
> >
> >
> > (i am all about these thread questions today, but if i am wrong
> someone
> > please correct me)
> >
> >
> > brad
>
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002401c1836a$6c452f50$0100a8c0>