List:MySQL and PHP« Previous MessageNext Message »
From:Andrey Hristov Date:May 6 2008 11:09am
Subject:Re: mysqli_connect fails under load(mysqlnd)
View as plain text  
Hi,
Amir Hardon wrote:
> Hi, thanks for helping,
> first of all, it indeed looks like a streams problem, here are some lines
> from apache error log:
> 
> May  4 18:25:16 88304-web10 httpd[22881]: [error] [client 172.16.176.51] PHP
> Warning:  Error while sending PING <filename>.php on line 330
> May  4 18:25:16 88304-web10 httpd[22881]: [error] [client 172.16.176.51] PHP
> Warning:  Error while sending QUIT packet in <filename>.php on line 330
> May  4 18:25:22 88304-web10 httpd[16754]: [error] [client 172.16.176.53] PHP
> Warning:  Error while reading header from socket in <filename>.php on line
> 330
> May  4 18:25:22 88304-web10 httpd[16754]: [error] [client 172.16.176.53] PHP
> Warning:  mysqli_connect() [<a
> href='function.mysqli-connect'>function.mysqli-connect</a>]:
> (00000/0):  in <filename>.php on line 330
> 
> Andrey - about your fix, did you correct the fault with the error reporting,
> or the streams problem?

It was a problem in the streams layer. An error wasn't populated up the 
stack and thus mysqli_connect_error gives 0 although there is an error. 
I fixed in 5_3, not quite sure if I did in 5_2.
For compiling with 5.2 you have to do the following:
- Get latest 5_2 - 5.2.6 currently
- Get 5.3-dev from snaps.php.net
- tar jxvf 5.3-dev
- tar jxvf 5.2.6
- cd 5.2.6/ext
- rm -rf mysql*
- cp -a ../../5.3-dev/ext/mysql* .
- cd ..
- rm configure
- ./buildconf --force
- cd Zend
- cp ../../5.3-dev/Zend/zend_ptr_stack.c .
- cp ../../5.3-dev/Zend/zend_ptr_stack.h .
- cd ..
- ./configure --with-mysqli=mysqlnd
- make

There are changes to Zend which mysqlnd needs, but are not backported to 
5.2, thus one needs the new zend_ptr_stack code from 5_3.

> About using 5.3-dev, we are actually considering using mysqlnd on our
> production servers (or at least considered).
> You named 5.0.1 beta "stable", so we thought testing it on a single server
> and see if the current version can give us a benefit, although it's beta.
> Do you think 5.3-dev can be used on production environment?

In my opinion the latest code is more robust and faster.

> Thanks again, both of you,
> 
> 
> On Mon, May 5, 2008 at 12:29 PM, Andrey Hristov <andrey@stripped> wrote:
> 
>>  Hi Amir,
>> Amir Hardon wrote:
>>
>>> Hi, we decided to test mysqlnd and installed 5.0.1-beta, on one of our
>>> production servers (LAMP environment).
>>>
>> 5.0.1-beta is pretty old version. mysqlnd is already in php-5.3-dev. You
>> can get a snapshot from http://snaps.php.net for testing purposes. If you
>> are limited to 5.2, then it's possible to extract mysqlnd from a 5.3
>> version, together with ext/mysqli, and build it in a 5.2 tree.
>>
>>  On our development environment it looked like it's working good, and
>>> passed
>>> all QA tests (which were also done on the staging environment).
>>> But when we directed real traffic to that server mysqli_connect started
>>> acting weirdly:
>>> On some of the requests, it failed (returned false), while
>>> mysqli_connect_error() returned an empty string,
>>> and mysli_connect_errno() returned 0(zero).
>>>
>> I think I corrected such a weirdness of mysqli_connect_error being zero. I
>> think it was an streams problem, from outside mysqlnd's world, in the PHP
>> code. In this case recent 5.3 snapshot should work.
>>
>>
>>> I tried testing it under load with ab(apache benchmark), but couldn't
>>> reproduce the error.
>>> Tried directing real traffic to this server again, and got the same
>>> errors.
>>>
>>> If you think I might be doing something wrong, please elaborate,
>>> if it's a bug and I can give you some more data I'll be happy, just keep
>>> in
>>> mind that I can keep this server out of the load balancer only for 12
>>> more
>>> hours, so after that if it won't work, I'll have to roll back to the
>>> previous state without mysqlnd.
>>>
>>> Thanks!
>>>
>>>
>> Thank you for testing mysqlnd!
>>


Regards,
Andrey
-- 
Andrey Hristov, Connectors Software Developer, Database Group
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering
Thread
mysqli_connect fails under load(mysqlnd)Amir Hardon4 May 2008
  • Re: mysqli_connect fails under load(mysqlnd)Ulf Wendel5 May 2008
  • Re: mysqli_connect fails under load(mysqlnd)Andrey Hristov5 May 2008
    • Re: mysqli_connect fails under load(mysqlnd)Amir Hardon5 May 2008
      • Re: mysqli_connect fails under load(mysqlnd)Andrey Hristov6 May 2008
        • Re: mysqli_connect fails under load(mysqlnd)Ulf Wendel6 May 2008
Re: mysqli_connect fails under load(mysqlnd)Andrey Hristov6 May 2008
Re: mysqli_connect fails under load(mysqlnd)Amir Hardon6 May 2008