Assistance with Apache Tuning on LAMP Stack

Closed Posted 7 years ago Paid on delivery
Closed Paid on delivery

I'm looking for a little guidance and specific directives for tuning apache2 on a web server instance. Background:

I'm running a PHP/MYSQL-based web app on a Digital Ocean droplet with the following specs: 48 GB / 16 CPU Ubutnu LAMP stack. (160 GB SSD for the app files and OS, in case it matters/helps.)

Right now, the [url removed, login to view] directive is NOT well configured at all, and Apache2 is often very slow, sometimes returning timeout errors, during periods of heavy load. This is the current configuration that was on the app server when I took it over:

ServerLimit 5000

<IfModule mpm_prefork_module>

StartServers 5

MinSpareServers 5

MaxSpareServers 10

MaxClients 5000

MaxRequestsPerChild 0

</IfModule>

<IfModule mpm_worker_module>

StartServers 5

MinSpareServers 5

MaxSpareServers 10

MaxClients 5000

MaxRequestsPerChild 0

</IfModule>

The max CPU utilisation only ever seems to get to around 65% before apache2 crashes, though all available connections seem to be used up before that.

Here's a quick TOP dump (first N lines), so you can see the relative size of each apache2 process:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

1089 mysql 20 0 8727952 119624 7876 S 145.7 0.2 2:21.73 mysqld

85 root 20 0 0 0 0 S 12.4 0.0 0:08.10 ksoftirqd+

7 root 20 0 0 0 0 S 7.2 0.0 0:08.51 rcu_sched

10 root 20 0 0 0 0 S 6.5 0.0 0:03.21 rcuos/2

267 root 20 0 0 0 0 S 4.9 0.0 0:06.04 jbd2/vda1+

6492 www-data 20 0 325144 14660 6620 S 4.2 0.0 0:01.58 apache2

8 root 20 0 0 0 0 S 3.9 0.0 0:03.45 rcuos/0

20 root 20 0 0 0 0 S 3.9 0.0 0:03.10 rcuos/12

23 root 20 0 0 0 0 S 3.9 0.0 0:03.20 rcuos/15

18 root 20 0 0 0 0 S 3.6 0.0 0:03.08 rcuos/10

6214 www-data 20 0 325040 14504 6468 S 3.6 0.0 0:00.90 apache2

12 root 20 0 0 0 0 S 3.3 0.0 0:02.78 rcuos/4

7229 www-data 20 0 325144 14464 6432 S 3.3 0.0 0:00.86 apache2

7513 www-data 20 0 325144 14636 6596 S 3.3 0.0 0:01.16 apache2

7698 www-data 20 0 325156 14672 6628 S 3.3 0.0 0:01.17 apache2

13 root 20 0 0 0 0 S 2.9 0.0 0:02.73 rcuos/5

What I'd like to get from you is directive on how to tune/modify apache to maximise performance on the hardware available and, in the event that resources are fully constrained, simply reject connections -- versus allowing the server to become overwhelmed so quickly, along with a little documentation/detail as to how you arrived at the suggestions. Nothing more than a quick email and copy/pasteable [url removed, login to view] directives are needed.

Also, one more note: The connections can be closed as soon as apache is done with them -- there's no need to keep connections alive for any period of time.

Apache Linux PHP Ubuntu

Project ID: #11529274

About the project

14 proposals Remote project Active 7 years ago

14 freelancers are bidding on average $70 for this job

dkokmadis

Hello from Greece, How many sites you run on vps? Why you use Apache and not nginx? Do you use any cache module? Regards, Dimitris

$61 USD in 5 days
(333 Reviews)
6.7
vili1977

Hello. I would like to help you with apache issue. I have experience. Please read my feedbacks. Thank you.

$35 USD in 1 day
(490 Reviews)
6.8
codetrance

It's not just Apache tuning and you're done. You'll have to look at complete server optimization and caching system implementation as well. Anyway I'm looking forwards to your response. Thank you.

$100 USD in 1 day
(172 Reviews)
6.5
tangramua

A proposal has not yet been provided

$115 USD in 1 day
(9 Reviews)
5.5
ProfSoftStudio

++ This is my job. I'm ready to begin now. Pm for me. Thanks Looking forward to hear from you, Feel free to talk about this interesting stuff, give us any questions you have to know more about us ;-) Thanks Oleg!

$111 USD in 1 day
(34 Reviews)
4.8
redssr

Dear Employer, As you are using LAMP stack, you must also observe MySQL configurations as well. Below are my points 1) Are using using MySQL with default settings or its tuning to handle heavy load 2) Do you hav More

$25 USD in 2 days
(37 Reviews)
4.3
euredan

Hello. I work in 24/7 linux servers support. I can help you with this task, but there should be a small investigation to determine all reasons low performance of your server. Best regards, Eugene D.

$20 USD in 1 day
(11 Reviews)
3.3
itskannanraj

we can increase the no of process, please let me know the hardware details and db details then we can work together and make it solve.

$25 USD in 1 day
(0 Reviews)
0.0