question : slow response

Rick Stevens rstevens at vitalstream.com
Tue Jul 27 16:35:05 UTC 2004


GoijI P wrote:
>>> ran free:
>>> out of 1GB RAM on server only 23MB was free.
>>> after reboot almost all became free.
>>> memory leak?.  i never reboot my server.
>>> top does not show any abnormality.
>>
>>
>> Memory is often allocated at the beginning.  Memory won't be "free"
>> unless memory which was committed to a program is actually needed
>> (this prevents the machine from swapping too often).
>>
>> If you think you're swapping, look a the "used" and "free" bits for
>> the "swap" (fourth line) of the "free" output.  You can also "vmstat 5"
>> to watch the system activity.  Look at the "si" (swap in) and "so" (swap
>> out) columns to see if the system is really swapping.  If you see that
>> those numbers are greater than zero more often than not, then the system
>> is swapping and you have a bit more investigation to do.  Hit CTRL-C to
>> terminate the vmstat program.
>>
>> Make sure you look at the "top" report WHEN YOUR SYSTEM IS SLOW to see
>> what's going on.  Don't just look at the "% CPU" column, also look at
>> the "SIZE" and "RSS" columns.
>>
>> The biggest "SIZE" is the process that's using the most memory, the
>> biggest "RSS" is the process that has the largest program code size.  If
>> you see a process where the "SIZE" is growing but the "RSS" is more or
>> less the same, that's a potential memory leak.  Unless you've written
>> your own code and haven't taken care to free allocated memory or haven't
>> kept your machine current, the odds of a memory leak are pretty small.
> 
> 
> 
> right now 0 swap space is used (things are quiet). i have to look at it 
> when more clients run server
> based apps remotely.  But, one thing i have noiced is that server RAM MB 
> size is 4 times higher than swap partition size, 1GB<->256MB.

Well that's upside down.  The rule of thumb is to have swap 2x RAM size.
In your case, 2GB.  Be aware that if the system runs out of memory and
swap, the system will start killing random processes to free up memory.

Try adding more swap.  Find a filesystem with enough free space (let's
say it's /usr), create a contiguous 2GB file on that filesystem filled
with zeroes and turn it into a second swap area:

	# dd if=/dev/zero of=/usr/swapfile bs=1M count=2048
	# mkswap /usr/swapfile

To start using it:

	# swapon /usr/swapfile

and you suddenly will have an additional 2GB of swap.  Note that swap
files are not quite as fast as swap partitions, but the difference in
speed is pretty small.  Edit your /etc/fstab file and add a line like:

	/usr/swapfile    swap            swap    defaults        0 0

and it'll get used on the next reboot, too.

OS NOTE: No single swap partition or file may be larger than 2GB, but
you can have up to 8 swap files or partitions (maximum of 16GB total).
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
- Grabel's Law: 2 is not equal to 3--not even for large values of 2. -
----------------------------------------------------------------------





More information about the Redhat-install-list mailing list