Realtime "Req in Processing"

nullx8

Active Member
#1
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.
 

nullx8

Active Member
#3
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

Well-Known Member
#4
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

Active Member
#5
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']);	
}
 
Top