Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion httpd processes use a HUGE amount of swap, even with ulimit -s set to 2MB
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Hongli Lai  
View profile  
 More options Apr 14 2008, 4:58 am
From: Hongli Lai <hon...@phusion.nl>
Date: Mon, 14 Apr 2008 10:58:59 +0200
Local: Mon, Apr 14 2008 4:58 am
Subject: Re: httpd processes use a HUGE amount of swap, even with ulimit -s set to 2MB

Clarke wrote:
> No matter how I try to change the ulimit as suggested in the docs to
> fix this problem httpd's process end up using ~150MB of swap each over
> time:

> (this is swap)
> 161m
> httpd
> 161m
> httpd
> 158m
> httpd
> 150m
> httpd
> 141m
> httpd
> 100m httpd

> Obviously, this is a problem.  Perhaps I'm not setting ulimit -s
> correctly.
> ulimit -s 2048
>  seems pretty simple, run as root .... and I'm also trying to run as
> apache's user (daemon)

> sudo su -c 'ulimit -s 2048' -s /bin/sh daemon

> no love.

> How can we fix this?

Hi.

Are you sure this is *actual memory usage* and not just VM size?

Passenger creates multiple threads. Because of the nature of threads,
memory usage for multi-threaded applications are usually misreported.
For example, a demo application that creates 100 threads (each thread
doing nothing) appears to be using 800 MB memory, according to ps's
"VSZ" column. But actual memory usage is only 532 KB - a significant
difference!

People usually read the "VM size" or "VSZ" column from process reporting
tools such as "ps" or "top", and it's likely that you've read that as
well. However, this column does not report memory usage accurately.
Unfortunately, "ps" and "top" do not provide facilities to report the
actual memory usage. GNOME System Monitor provides the most accurate
memory usage report, through the "Writable memory" column.

You probably don't have GNOME System Monitor installed. But you can also
find out the actual memory usage of a single process by measuring its
"private dirty RSS" with the following command (this only works on Linux):

grep Private_Dirty /proc/XXXX/smaps | awk '{ print $2 }' | xargs ruby -e
'puts ARGV.inject { |i, j| i.to_i + j.to_i }'

where 'XXXX' is the PID of a process. This reports memory usage in KB.

The best way for you to find out how much memory Apache (i.e. all Apache
processes combined) _really_ uses, is through 'free -m'. I suspect that
if you:
1. start Apache
2. measure the memory usage with 'free -m'
3. stop Apache
4. measure with 'free -m' again, and calculate the difference,
that you will find that the actual memory usage is significantly lower
than what is reported by 'ps'.

Many people have been fooled by this phenomenon, and indeed, I don't
understand why the authors of 'ps' and 'top' haven't updated their tools
to correctly report actual memory usage.

Wikipedia also elaborates this phenomena at
http://en.wikipedia.org/wiki/Virtual_memory.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: i...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.