Solved

Magento & Apache optimization

Posted on 2010-11-19
3
1,710 Views
Last Modified: 2012-05-10
Hi all,

I've a a linux Centos box with 8G B RAM & 1CPU  X3220 2.40GHz. Of these 8GB, 7GB is for the system and applications, and 1GB for the TMPFS.

It can be seen that the system is swapping. What should I do to prevent this?. Furthermore, I see apache it's consuming lots of memory, What should I do to prevent this?.

Top:
top - 02:55:32 up 4 days, 12:12,  2 users,  load average: 0.13, 0.24, 0.36
Tasks: 118 total,   1 running, 117 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.9%us,  0.1%sy,  0.0%ni, 98.8%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8177616k total,  7063824k used,  1113792k free,   255480k buffers
Swap:  6289320k total,    44728k used,  6244592k free,  5614920k cached

httpd.conf:

Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 2

# prefork MPM
<IfModule prefork.c>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      20
    ServerLimit         450
    MaxClients          450
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
<IfModule worker.c>
    StartServers          2
    MaxClients           250
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    ServerLimit          25
    MaxRequestsPerChild  25
</IfModule>

 Apache/2.2.3
  Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

What directive has more weight in terms of memory?

Thanks in advance
0
Comment
Question by:VMWARE
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Redimido earned 500 total points
ID: 34182015
What I see is you have a lot of memory free:
Mem:   8177616k total,  7063824k used,  1113792k free,   255480k buffers
Swap:  6289320k total,    44728k used,  6244592k free,  5614920k cached

This is
1,113,792k free
   255,480k buffers
5,614,920k cached
----------------------------
6,984,192k free

Since you have 7,063,824k used this means you have lots of memory still there to be used.

You see apache using lots of memory? I would only believe that in the case you where using a java app or some other kind of server side app.

To see which processess are using swap, you can open the top program, the type the capital 'O' and after that the letter 'p'.

You will see now processes ordered by their swap usage. start minvestigating from there.
0
 
LVL 19

Expert Comment

by:Redimido
ID: 34182018
0
 

Author Comment

by:VMWARE
ID: 34186829
Hello Redimido,

I'm using PHP.

The output of top processes ordered by their swap usage

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
 2618 mysql     15   0 1074m 288m 6836 S 74.2  3.6   5140:27 786m mysqld
 6005 apache    15   0  373m 8816 1480 S  0.0  0.1   0:00.00 365m httpd
 5995 apache    15   0  373m 8820 1480 S  0.0  0.1   0:00.00 365m httpd
 5996 apache    15   0  373m 8820 1480 S  0.0  0.1   0:00.00 365m httpd
 5997 apache    15   0  373m 8820 1480 S  0.0  0.1   0:00.00 365m httpd
 5999 apache    15   0  373m 8820 1480 S  0.0  0.1   0:00.00 365m httpd
 6004 apache    15   0  373m 8828 1488 S  0.0  0.1   0:00.00 365m httpd
 6007 apache    15   0  373m 8832 1492 S  0.0  0.1   0:00.00 365m httpd
.
.
.
If I have so much free memory, why it's swapping?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now