Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm deploying an application that uses ImageMagick into VPS server. I tested in on two different OS: Centos6 and Ubuntu Server 12.04.

On Centos6, the application is working properly and when accessing ImageMagick script, memory usage can goes above 90% (FYI, both OS and VPS instance are using 512MB memory package). However, when I tried the same script, it never goes above 5-6.2%.

top result on ubuntu server:

1816 userx     20   0  341m  24m 5260 D 40.8  5.0   0:13.85 apache2

top result on centos server:

15798 ariefbay  20   0  183m 155m 5684 R 99.8 31.2   0:05.96 httpd

This memory limitation resulted in very long process. I need it to be fast and since this will be a limited usage server, I don't mind if it consume the whole memory.

I've tried the following step:

  • adding RLimitMEM to /etc/apache2/apache2.conf

    RLimitMEM max max
  • setting ulimit -l unlimited
  • adding config into /etc/security/limits.conf:

    userx - rtprio 99
    userx - memlock unlimited
    userx - nice -10
    • note: apache2 process are running as userx.
    • this is working ok as proved by ulimit -a:

      userx@do:/etc/apache2$ ulimit -a
      core file size          (blocks, -c) 0
      data seg size           (kbytes, -d) unlimited
      scheduling priority             (-e) 30
      file size               (blocks, -f) unlimited
      pending signals                 (-i) 3861
      max locked memory       (kbytes, -l) unlimited
      max memory size         (kbytes, -m) unlimited
      open files                      (-n) 1024
      pipe size            (512 bytes, -p) 8
      POSIX message queues     (bytes, -q) 819200
      real-time priority              (-r) 99
      stack size              (kbytes, -s) 8192
      cpu time               (seconds, -t) unlimited
      max user processes              (-u) 3861
      virtual memory          (kbytes, -v) unlimited
      file locks                      (-x) unlimited
  • I can also see that the memory settings are working fine by looking at /proc/pic/limits:

    userx@do:/etc/apache2$ cat /proc/1811/limits
    Limit                     Soft Limit           Hard Limit           Units
    Max cpu time              unlimited            unlimited            seconds
    Max file size             unlimited            unlimited            bytes
    Max data size             unlimited            unlimited            bytes
    Max stack size            8388608              unlimited            bytes
    Max core file size        0                    unlimited            bytes
    Max resident set          unlimited            unlimited            bytes
    Max processes             3861                 3861                 processes
    Max open files            8192                 8192                 files
    Max locked memory         unlimited            unlimited            bytes
    Max address space         unlimited            unlimited            bytes
    Max file locks            unlimited            unlimited            locks
    Max pending signals       3861                 3861                 signals
    Max msgqueue size         819200               819200               bytes
    Max nice priority         30                   30
    Max realtime priority     99                   99
    Max realtime timeout      unlimited            unlimited            us

Did I do something wrong? what should I do to remedy this problem on ubuntu?

share|improve this question
It is not at all clear what the actual problem is. What makes you think your performance issues have anything to do with memory? – David Schwartz Jun 21 '13 at 8:59
Are you sure your apache configuration, patches, plugins etc. are the same on both machines? – scai Jun 21 '13 at 9:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.