LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > Realtime "Req in Processing"

Reply
 
Thread Tools Display Modes
  #1  
Old 05-03-2012, 11:04 PM
nullx8 nullx8 is offline
Member
 
Join Date: Nov 2011
Location: Bangkok, Thailand
Posts: 11
Default 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.
Reply With Quote
  #2  
Old 05-04-2012, 11:15 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,390
EAProc In use/WaitQ in real-time stats is the one you look for. They reside in /tmp/lshttpd/.rtreport*
Reply With Quote
  #3  
Old 05-04-2012, 11:44 PM
nullx8 nullx8 is offline
Member
 
Join Date: Nov 2011
Location: Bangkok, Thailand
Posts: 11
Quote:
Originally Posted by webizen View Post
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 ?
Reply With Quote
  #4  
Old 05-07-2012, 11:51 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,390
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.
Reply With Quote
  #5  
Old 05-07-2012, 07:47 PM
nullx8 nullx8 is offline
Member
 
Join Date: Nov 2011
Location: Bangkok, Thailand
Posts: 11
Quote:
Originally Posted by webizen View Post
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']);	
}
Reply With Quote
  #6  
Old 05-08-2012, 11:46 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,390
Thanks for sharing that, nullx8.
Reply With Quote
Reply

Tags
realtime stats with php, req in processing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:05 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.