FAQ
Hi,

I've this very very special problems and would ask for some hints, any
helpful response is very appreciated :)

The usual story: old system, big, clunky, legacy, PHP4, can't upgrade.

We're having serious problems with MySQL and too many connections and so
on, but we can't find out where the problematic cases are. We've gone
already through lengthy auditing and logging sessions without real success.

So my next idea: I go into the PHP source, in my case specifically into
ext/mysql/php_mysql.c, reactive my old C skills and inject the logging
of connects and queries directly into the source. Because, as ironic as
it sounds, with the HUGE amount of code we have we still were not able
to identify all places where mysql_(p)connect/mysql_query is used,
because of using variable variables and other nice [tm] tricks.

I understand my attempt is brute force and I'm pretty alone out there.

So, actually I would start hacking away this very moment. But, if anyone
has other suggestion how to go for this, it would be very very much
appreciated.

thanks for reading,
- - Markus

Search Discussions

  • Alexey Zakhlestin at Jun 13, 2007 at 8:04 am
    http://xdebug.org/
    On 6/13/07, Markus Fischer wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi,

    I've this very very special problems and would ask for some hints, any
    helpful response is very appreciated :)

    The usual story: old system, big, clunky, legacy, PHP4, can't upgrade.

    We're having serious problems with MySQL and too many connections and so
    on, but we can't find out where the problematic cases are. We've gone
    already through lengthy auditing and logging sessions without real success.

    So my next idea: I go into the PHP source, in my case specifically into
    ext/mysql/php_mysql.c, reactive my old C skills and inject the logging
    of connects and queries directly into the source. Because, as ironic as
    it sounds, with the HUGE amount of code we have we still were not able
    to identify all places where mysql_(p)connect/mysql_query is used,
    because of using variable variables and other nice [tm] tricks.

    I understand my attempt is brute force and I'm pretty alone out there.

    So, actually I would start hacking away this very moment. But, if anyone
    has other suggestion how to go for this, it would be very very much
    appreciated.

    thanks for reading,
    - - Markus


    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php

    --
    Alexey Zakhlestin
    http://blog.milkfarmsoft.com/
  • Markus Fischer at Jun 13, 2007 at 10:31 am
    Hello Alexey, Stefan,

    first thanks for the replies!

    Actually I'm in general aware of xdebug, however I didn't know it met my
    criteria.

    The thing is: I need to know specific information of the mysql operations:

    1) host,user,pass of connects/pconnects (and which type of connect),
    count of connects this very request already had
    2) sql statement on query, execution time, count of how many statements
    this very request already had

    Additional to that I need information like:
    * server ip (multiple servers)
    * remote ip
    * http host (zillions of vhosts)
    * uri
    * user agent string


    This is what we currently log for debugging, but we're unable to fully
    coverage all sources.

    As can be seen, my idea was to have a single place where to log things
    from all servers/vhosts/applications, because they also make use of the
    single mysql.so driver.

    Is this possible with xdebug in this manner? With my current information
    I really need this information and to my knowledge (falsely?) I can't
    this out of xdebug. Probably important to note, I've been using xdebug
    in the past, profiling things, but I don't see this possible in
    production environment running and getting out the the information I need.

    thank you,
    - - Markus

    Alexey Zakhlestin wrote:
    http://xdebug.org/

    On 6/13/07, Markus Fischer wrote:
    Hi,

    I've this very very special problems and would ask for some hints, any
    helpful response is very appreciated :)

    The usual story: old system, big, clunky, legacy, PHP4, can't upgrade.

    We're having serious problems with MySQL and too many connections and so
    on, but we can't find out where the problematic cases are. We've gone
    already through lengthy auditing and logging sessions without real
    success.

    So my next idea: I go into the PHP source, in my case specifically into
    ext/mysql/php_mysql.c, reactive my old C skills and inject the logging
    of connects and queries directly into the source. Because, as ironic as
    it sounds, with the HUGE amount of code we have we still were not able
    to identify all places where mysql_(p)connect/mysql_query is used,
    because of using variable variables and other nice [tm] tricks.

    I understand my attempt is brute force and I'm pretty alone out there.

    So, actually I would start hacking away this very moment. But, if anyone
    has other suggestion how to go for this, it would be very very much
    appreciated.

    thanks for reading,
    - Markus
    - --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
  • Stefan Priebsch at Jun 13, 2007 at 11:17 am
    Hi Markus,
    The thing is: I need to know specific information of the mysql operations:

    1) host,user,pass of connects/pconnects (and which type of connect),
    count of connects this very request already had
    2) sql statement on query, execution time, count of how many statements
    this very request already had
    You can configure xdebug to create a trace log showing the parameters
    passed to the called functions. This could be a basis for what you need.
    Additional to that I need information like:
    * server ip (multiple servers)
    * remote ip
    * http host (zillions of vhosts)
    * uri
    * user agent string
    A quick and maybe dirty idea that comes to my mind is to add a function
    call in your application that has these parameter (easy to gather from
    $_SERVER etc.) so they show up in the trace logs. Then it's a matter of
    processing a gazillion lines of trace log to get out the information you
    need, but at least it should be there.
    in the past, profiling things, but I don't see this possible in
    production environment running and getting out the the information I need.
    Trace logging in a production environment *absolutely* kills your
    performance, so if you have to dedicated test environment, hmmm.

    But would you actually create a patched PHP and deploy this in your
    production environment. Then I personally would rather opt for running
    an xdebug-based trace Sunday morning at 4 am.

    Kind regards,

    Stefan


    --
    e-novative> - We make IT work for you.
    e-novative GmbH - HR: Amtsgericht München HRB 139407
    Sitz: Wolfratshausen - GF: Dipl. Inform. Stefan Priebsch

    http://www.e-novative.de

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedJun 13, '07 at 7:01a
activeJun 13, '07 at 11:17a
posts4
users3
websitephp.net

People

Translate

site design / logo © 2022 Grokbase