Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if clients are starved in an apache server?

How would you monitor a server performance in sense of :

  1. Count requests that has been timedout without processing at all (client was starved)

  2. Count requests that has been timedout while in process

  3. Count requests that failed because of error at least in the apache lvl

Thanks

like image 708
Ofek Ron Avatar asked Apr 26 '17 09:04

Ofek Ron


People also ask

Why Apache server doesn't performs well for high traffic?

Because Apache doesn't perform as well in some benchmarks, especially for static websites or websites with high traffic, Kinsta uses the NGINX web server instead of Apache. Though NGINX hasn't been around for as long as Apache, it's quickly grown in popularity and market share since its launch in 2004.


3 Answers

Count requests that has been timedout without processing at all (client was starved)

It depends on what platform you are operating and what the apache server is used for. In case the apache server is used as a back-end for some website you could add timestamps to each request made by the client (website user), or let the client keep track of the requests it performed with their associated timestamps. Send this data to the server and let the server compare this data to it's own logs.

Thus I would advise to keep track both client-sided and server-sided of all requests received and sent with their additional status (success or failure, timestamp).

For more specific info I think more context on the actual implementation is a must.

like image 98
jervtub Avatar answered Nov 15 '22 02:11

jervtub


As per my knowledge, Apache do not support this kind of feature other than server status. But that doesn't include enough metrics to match your requirement.

But nginx provides more metrics which almost include what you need.

Nginx open source version support following metrics,

  • accepts / accepted
  • handled
  • dropped
  • active
  • requests / total

Please refer this article. If you are trying to host a php web app, you can move to nginx in that case.

like image 20
Imesha Sudasingha Avatar answered Nov 15 '22 03:11

Imesha Sudasingha


I am not an expert in that case but here is my take on this,

Request time out generate 408 error in logs which is countable and apache provide a variable %D to measure the process time.

Count requests that has been timedout without processing at all (client was starved)

If there is no process time or minimal then you can assume request is not processed at all.

Count requests that has been timedout while in process

Opposite goes for previous theory you will get some time logged for processing.

Count requests that failed because of error at least in the apache lvl

You will surely get the error log for any reason apache have encountered.

And what will be the role of keep alive in this case is another thing.

Logging methods are different in apache 2 & 2.4 keep that in mind but common logging format will lead you to result.

Edit:

If you are looking for tools to give you some insights try with below, and apache httpd server does provide all the necessary insights which nginx and other server out there can provide.

https://logz.io/

http://goaccess.prosoftcorp.com/

http://awstats.sourceforge.net/

Refrences:

http://httpd.apache.org/docs/current/mod/mod_log_config.html https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html https://httpd.apache.org/docs/2.4/logs.html

like image 21
Abhishek Gurjar Avatar answered Nov 15 '22 02:11

Abhishek Gurjar