I have read several posts and questions about KeepAlive but have not found any suitable for me.
I have a server with just one client (Trivago) doing hundreds of (hotel availability) requests per second. For each request, I have to request the price to a third party server. So the flow would be like this:
Trivago ask for availabilities and prices, I ask for them to a third party supplier, I receive them, do the PHP logic, and return a json response to Trivago.
Server details:
CentOS Linux 7
Plesk Onyx (uses nginx & apache)
4 cores
8GB
PleskPHP config php-fpm directives:
pm.max_children 250
pm.max_requests 1000
pm ondemand
httpd.conf:
ServerLimit 16
MaxClients 400
StartServers 3
ThreadsPerChild 25
ThreadLimit 64
Using this, I'm getting 12.5MB or RAM per process which, theoretically, allow me o have up to 500 processes running at once using 6GB of RAM:
ps -ylC httpd --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}'
Question:
- Should I use KeepAlive? Since Trivago is doing hundreds of request, how do I determine if same 'open/stablished connection' is being used?
While other resources utilization looks consistent:
apache memory usage looks like this:
Am I wrong or is it caused by KeepAlive?
Those are graphs of low traffic hours, by the way. On high traffic hours Apache memory usage goes near 8GB limit.
Thanks.
Edit:
This is marked as duplicate and yes, It may be duplicate but I'm a step ahead that question. I've already monitored the system, added traffic via JMeter, evaluated the results and remediated some things. Therefore, I will ask a simplier question:
- Does the apache graph looks like I should set KeepAlive to off?
I understand the aproach here is to set it off and test it but since the server is in production now (I did not experienced this graph while using JMeter), I can't.