A
A
AusTiN2011-02-16 16:12:35
linux
AusTiN, 2011-02-16 16:12:35

Memory leak in Linux?

Hey Habr.
Such a problem, memory is leaking somewhere on the server.

top — 14:58:30 up 21 days, 16:05, 2 users, load average: 0.66, 0.50, 0.49
Tasks: 145 total, 2 running, 141 sleeping, 2 stopped, 0 zombie
Cpu(s): 15.9%us , 0.0%sy, 0.0%ni, 84.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8194056k
total, 8109096k used, 84960k free, 921072k buffers
free, 6353068k cached

Installed on the server:
- nginx/0.8.43 ( /etc/nginx/nginx.conf , /etc/nginx/sites-enabled/www.hostname.ru
- mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu ( x86_64) using readline 5.2 (default config)
- php5-fpm ( php.ini , php5-fpm.conf
PHP 5.3.5-0.dotdeb.0 (fpm-fcgi) (built: Jan 7 2011 00:07:27)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright © 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright © 2007-2010, by SektionEins GmbH

- Sphinx 0.9.9-release (r2117) (indexer --all runs every 5 minutes by cron)
- Site on CodeIgniter-e, about 5000 HTTP requests per minute
If the server is restarted, everything is fine, but in about a week all the memory is consumed no one knows where. How to see where she went and how to free her?

Answer the question

In order to leave comments, you need to log in

9 answer(s)
P
Puma Thailand, 2011-02-16
@AusTiN

In my opinion, you didn’t understand the materiel and started hysterical.
You do not eat swap means the system has enough memory. Linux actively uses memory for the cache, and your memory is consumed, if the program needs memory, then Linux will free up memory for the program.
You should be afraid when swap used grows
Swap: 7815580k total, 764k used,
7814816k free,
6353068k
cached cached
And similar on servers with 24 gigs of RAM.

B
Bobylov, 2011-02-16
@Bobylov

This is a regular cache of files in RAM. If necessary, it is cleared instantly.

C
Constantin, 2011-02-16
@Constantin

And where are the leaks?
Linux has been using all available memory for cache for a couple of years now (921072k buffers)
Why are we panicking?

M
michs, 2011-02-16
@michs

Linux is caching files. Everything is fine.

B
Bobylov, 2011-02-16
@Bobylov

The htop utility will show the actual amount of memory used and the amount of this very cache.

H
homm, 2011-02-16
@homm

Your memory is leaking here: 921072k buffers 6353068k cached
It's amazing how servers end up in the hands of such advanced specialists.

D
DorBer, 2011-02-16
@DorBer

Most likely php5-fpm is eating away. It does not release the occupied memory. And with the growth of requests, she also produces daughters who do the same. Here is from your config:
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

V
Vlad Zhivotnev, 2011-02-16
@inkvizitor68sl

In htop, it's better to see how much memory is occupied.

A
admin4eg, 2011-02-17
@admin4eg

I use eAccelerator
Collect by hand, yes, there is such a thing, just like nginx, this is probably everything that is assembled by hand from fresh.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question