LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   PHP (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=19)
-   -   Realtime "Req in Processing" (http://www.litespeedtech.com/support/forum/showthread.php?t=5905)

nullx8 05-03-2012 11:04 PM

Realtime "Req in Processing"
 
is it possible with lsphp5 to get somehow access to the realtime stats ?
specially the value of "Requests in Processing"

the idea is simply to do some recovery if the server has too much backlog.

sometimes we have a bout 1000 Requests in processing resulting of poor database connections. (not a laws fault)

so the idea is to read this queue value somehow and adjust the scripts running if the backlog is getting too high.

webizen 05-04-2012 11:15 AM

EAProc In use/WaitQ in real-time stats is the one you look for. They reside in /tmp/lshttpd/.rtreport*

nullx8 05-04-2012 11:44 PM

Quote:

Originally Posted by webizen (Post 33261)
EAProc In use/WaitQ in real-time stats is the one you look for. They reside in /tmp/lshttpd/.rtreport*

awesome ... thats even better than API ... (not requires additional reccources)

can you shortly explain why there are multiple files are beeing created ?

i had 1 yesterday now there are 2
with same date ...

is /tmp/lshttpd/.rtreport always the current one ?

webizen 05-07-2012 11:51 AM

rtreport* get generated by each CPU/core. you have 2-CPU license, so you see .rtreport and .rtreport.2. you should total the numbers from each rtreport for your report.

nullx8 05-07-2012 07:47 PM

Quote:

Originally Posted by webizen (Post 33311)
rtreport* get generated by each CPU/core. you have 2-CPU license, so you see .rtreport and .rtreport.2. you should total the numbers from each rtreport for your report.

ah great.. thanks that makes more sense .

here what i have done to put some "use" in this numbers

Code:

PHP
if (is_file("/tmp/lshttpd/.rtreport")) {
        $lsload = file('/tmp/lshttpd/.rtreport');
        $lsload = explode(",",$lsload[4]);
        $Site['health']['http_queue'] = intval(preg_replace("/[^\d]/", "", $lsload[0]));
        $Site['health']['http_requests'] = intval(preg_replace("/[^\d]/", "", $lsload[1]));
        if (is_file("/tmp/lshttpd/.rtreport.2")) { // core 2
                $lsload = file('/tmp/lshttpd/.rtreport');
                $lsload = explode(",",$lsload[4]);
                $Site['health']['http_queue'] = ($Site['health']['http_queue'] + intval(preg_replace("/[^\d]/", "", $lsload[0])));
                $Site['health']['http_requests'] = ($Site['health']['http_queue'] + intval(preg_replace("/[^\d]/", "", $lsload[1])));
        }
}

// redirect to TMP page on other machine if load is too high
if (($Site['health']['http_queue'] > 400 )) {
        header ("Location: ".$Site['paths']['staticserver2']."/pages/v3p/?for=".$_SERVER['REQUEST_URI']);       
}


webizen 05-08-2012 11:46 AM

Thanks for sharing that, nullx8.


All times are GMT -7. The time now is 03:32 AM.