Server reboot ON bottleneck memory usage

Hi folk,
I want to monitor the server.
when the memory usage is bottlenecked I want to reboot the server.

Do you have any Idea, how to do it automatically ??
OR
Do you have any other solution for this problem ???

Thanks
Shariq

shariqnitt wrote:
> when the memory usage is bottlenecked I want to reboot the server.

define “bottlenecked”…
what operating system are you running…
what is your server serving…


DenverD (Linux Counter 282315)
CAVEAT: http://is.gd/bpoMD
posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
2.6.22.19-0.4-default SMP i686
AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
CMedia 9761 AC’97 Audio

@DenverD
I am using fedora8( its EC2)
bottleneck is anything above 90%
there are different kind of servers
web-Server, db-server
apache server et. ol.

if Memory usage is above 90% I want to reboot the system

shariqnitt wrote:
> @DenverD
> I am using fedora8( its EC2)
> bottleneck is anything above 90%
> there are different kind of servers
> web-Server, db-server
> apache server et. ol.
>
> if Memory usage is above 90% I want to reboot the system

are you talking about processor cache or installed RAM?

why? it is apparent to me that you do not understand the Linux memory
model…this is not Windows and there is no need to panic if the
memory use climbs to 99% with no swapping to disk…

understand?


DenverD (Linux Counter 282315)
CAVEAT: http://is.gd/bpoMD
posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
2.6.22.19-0.4-default SMP i686
AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
CMedia 9761 AC’97 Audio

when I execute the “top” command , I found the below Output.

shariq@linux-5uxv:~> top

top - 23:14:46 up 1:24, 2 users, load average: 0.62, 1.29, 1.25
Tasks: 119 total, 1 running, 118 sleeping, 0 stopped, 0 zombie
Cpu(s): 10.6%us, 14.4%sy, 0.0%ni, 73.2%id, 1.6%wa, 0.2%hi, 0.0%si, 0.0%st
Mem: 1987236k total, 1967364k used, 19872k free, 12870k buffers
Swap: 1566328k total, 0k used, 1566328k free, 730200k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6036 shariq 20 0 56220 30m 12m S 20.2 1.6 2:54.09 vlc
2413 root 20 0 112m 22m 7916 S 2.6 1.2 4:04.36 X
6204 shariq 20 0 109m 16m 11m S 1.8 0.9 0:00.78 gnome-terminal
6137 shariq 20 0 240m 76m 22m S 0.7 3.9 0:14.29 firefox
4807 shariq 20 0 26876 6048 4352 S 0.4 0.3 0:06.64 gnome-screensav
5264 shariq 27 7 116m 60m 13m S 0.2 3.1 7:57.84 beagled
1 root 20 0 1008 384 332 S 0.0 0.0 0:01.28 init
2 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/0
4 root 15 -5 0 0 0 S 0.0 0.0 0:00.14 ksoftirqd/0
5 root 15 -5 0 0 0 S 0.0 0.0 0:00.36 events/0

here “mem” is showing

Mem: 1987236k total, 1967364k used, 19872k free, 12870k buffers

means that 99% is used and 1% is free.
In this situation reboot is needed and currently I am doing it manually.

I need solution to this problem.

@DenverD
After reading your CAVEAT, I cant’nt go along with U :):):slight_smile:

No, you really don’t understand how Linux memory management works. But this not helped by top arranging its fields a little badly. (Cached really has nothing to do with Swap, and belongs to the Mem line. The developer was trying to save one line on the screen.) Here’s the output of top on my system. just the two memory lines:

Mem:   4055480k total,  3250068k used,   805412k free,    68348k buffers
Swap: 16787840k total,   101568k used, 16686272k free,  2130944k cached

and here is the output of free:

             total       used       free     shared    buffers     cached
Mem:       4055480    3250472     805008          0      68300    2130920
-/+ buffers/cache:    1051252    3004228
Swap:     16787840     101568   16686272

Linux’s definition of used is “contains useful information” as opposed to “has random bits”. So as far as possible it tries to hang on to recent cache and buffer blocks until the memory is really wanted by a process. So the memory actually used by processes is used - buffers - cache. And this is what free shows in the second line. My actual usage is ~1GB. All the rest are either free, buffers or cache, which are potentially available for program use.

So do a “free” on your system and you’ll probably find you have lots of headroom. From your top figures, I predict about 1.3GB of actual use after buffers and cache are subtracted.

In any case rebooting the system is no way to handle genuine short of memory issues (which this is not). In the long run that kind of problem (which you don’t really have at the moment) requires more RAM.

Hi
Remove beagle…unless your wanting file indexing, in YaST remove
everything beagle related except libbeagle.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.12-0.7-default
up 1:27, 2 users, load average: 0.01, 0.01, 0.00
GPU GeForce 8600 GTS Silent - Driver Version: 256.35

shariqnitt wrote:
> @DenverD
> After reading your CAVEAT, I cant’nt go along with U :):):slight_smile:

heh…ok, here is the deal: you have a lot of Windows experience,
right? and you know in Windows that as soon as (say) ProgramA is
finished running that Windows dumps all of the executable code, .dlls
and data associated with that program out of RAM to make ready for the
next ProgramB you start up, right?

well, Linux has a *better/ idea: when you stop running ProgramA
everything STAYS in memory…just because you might open ProgramA
again and it can start faster if all the stuff is still in
memory…so, you might ask: But what happens if memory is full and i
wanna start ProgramB? NO problem, because it is THEN that Linux will
dump ProgramA out of RAM and load in ProgramB…

now, look again at your top and see that the there IS both free RAM
(19872k free) and free swap space (1566328k free) and nothing has
been swapped to disk (0k used)…and, the magic of it all is that all
you need to do is learn more about Linux, and NOT try to build a
script to force it to reboot for no reason…

ok, so you read my caveat and don’t believe, so see here:

http://www.linuxatemyram.com/

and, if that is not enough then read a few thousand here:
http://tinyurl.com/35sggqe

and, this probably help you also: Linux is not Windows
http://tinyurl.com/8b9s6


DenverD (Linux Counter 282315)
CAVEAT: http://is.gd/bpoMD
posted via NNTP w/TBird 2.0.0.23 | KDE 3.5.7 | openSUSE 10.3
2.6.22.19-0.4-default SMP i686
AMD Athlon 1 GB RAM | GeForce FX 5500 | ASRock K8Upgrade-760GX |
CMedia 9761 AC’97 Audio

shariqnitt wrote:

> here “mem” is showing
>> Mem: 1987236k total, 1967364k used, 19872k free, 12870k
>> buffers
>
> means that 99% is used and 1% is free.
> In this situation reboot is needed and currently I am doing it
> manually.

Why do you think a reboot is needed? I think you may want to study
the concept of “virtual memory” a little.


Per Jessen, Zürich (24.2°C)