• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1765
  • Last Modified:

Magento & Apache optimization

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
VMWARE
Asked:
VMWARE
  • 2
1 Solution
 
Gabriel OrozcoSolution ArchitectCommented:
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
 
Gabriel OrozcoSolution ArchitectCommented:
0
 
VMWAREit security administratorAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now