List:Internals« Previous MessageNext Message »
From:Chad MILLER Date:April 2 2007 12:22pm
Subject:Re: mysqlclient performance with syscalls
View as plain text  
Hi Joseph.

On 1 Apr 2007, at 14:03, Joseph Benden wrote:
> I'm trying to squeeze all the performance possible from every piece  
> of my Solaris systems.  The last piece that is bugging me is the  
> high number of system calls experienced on the machines.  In  
> analyzing the web server, I found the problem was the read() system  
> call.  Next, I wanted to know what sizes were being read and where  
> from.  It turns out the read()s are from the mysqlclient library  
> and are 4 byte reads.
>
>           value  ------------- Distribution ------------- count
>               0 |                                         0
>               1 |@@@@@                                    3447
>               2 |@                                        616
>               4 |@@@@@@@@@@@@@@@@@@@                      12531
>               8 |@                                        626
>              16 |@@@@@@@@                                 4966
>              32 |@@                                       1158
>              64 |                                         153
>             128 |                                         29
>             256 |                                         15
>             512 |                                         5
>            1024 |                                         17
>            2048 |                                         0
>            4096 |                                         0
>            8192 |@@@@                                     2667
>           16384 |                                         0
>
>
> Upon further research with dtrace, I've found these read()s to  
> correspond with the MySQL protocol packet header being read().
>
> I was wondering why a buffered approach wasn't taken.  ie: A  
> general buffered read() of everything possible from the wire and  
> the protocol code asking for the number of bytes from that buffered  
> area. I feel that in doing this many system calls could be reduced,  
> which would increase the speed of using the library.


While we are more sensitive to excessive syscalls since Bug#22943, we  
still have room for improvement.  The "vio" interface that we use for  
(nearly) all I/O is nicely modular, but does need some attention, and  
a buffer sounds like an excellent project that shouldn't take very  
long and is rather cool.  This would have wide-reaching effects, all  
the way into the server; this is not a client-only problem.

Joseph, with your research so far, you are probably in a great  
position to create heuristically good read() buffer sizes.  Do you  
feel comfortable taking on such a project?

If not, I'm sure someone else on this list would gladly take it.

In any case, this should be entered into our bug-tracking system.  Do  
you mind adding it, Joseph, along with any more detailed output from  
your tracing tool?

- chad

--
Chad Miller, Software Developer                         chad@stripped
MySQL Inc., www.mysql.com
Orlando, Florida, USA                                13-20z,  UTC-0400
Office: +1 408 213 6740                         sip:6740@stripped



Attachment: [application/pgp-signature] This is a digitally signed message part PGP.sig
Thread
mysqlclient performance with syscallsJoseph Benden1 Apr
  • Re: mysqlclient performance with syscallsMark Callaghan2 Apr
  • Re: mysqlclient performance with syscallsChad MILLER2 Apr