Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: bakedjake
I am on a dedicated server that hosts 1website.
Sometimes server return me the errror cannote allocate memory, I don't know what should I do...
-Mysql close itself and write into log the too many open file in system
-Apache run normally
-I can't restart mysql because I can't connect to ssh:
Server return me: [SSH] ssh_exchange_identification: Connection closed by remote host
And if I succeed to login to ssh, every command I launch server return me: bash-fork failed:cannote allocate memory
I need help.... I have already write in limits.conf
* soft nofile 4096
but I don't know how to "restart" this file
Very very thanks
How much memory do you have?
How big a swap do you have? (Ideally, I like to run without swap ever being touched, but you still need it for exceptional conditions.)
Learn to use "top", learn what the memory statistics mean, and report back what you find.
RAM is cheap. Buy some more. Of course, you will in most cases have to go with a 64-bit OS to go over 4GB.
I have launch the top command, here the result (after that I reebot the httpd apache):
top - 20:54:44 up 21 days, 8:13, 1 user, load average: 0.38, 0.59, 0.50
Tasks: 43 total, 1 running, 42 sleeping, 0 stopped, 0 zombie
Cpu(s): 4.7% us, 1.2% sy, 0.0% ni, 93.8% id, 0.3% wa, 0.0% hi, 0.0% si
Mem: 6093116k total, 5959908k used, 133208k free, 44948k buffers
Swap: 12586916k total, 4209632k used, 8377284k free, 735896k cached
I don't know what exactly represent this result..
If you start top again, it will show you the list of running processes. Which one has the largest value in the VIRT and RES columns? That one is probably the source of your memory problems.
If we know which process is taking your memory, we may be able to give some tuning advice to reduce the memory needs for it.
load average: 0.38, 0.59, 0.50
Cpu(s): 93.8% id
Eventhough your CPU is idle almost 94% if the time, you have an load average of 0.50. This is an indication that tasks are waiting for external events; probably disk I/O caused by swapping in and out large blocks of data.
Almost all modern systems will show almost all of memory as "used". You have to subtract-out buffers.
Mem: 2062816k total, 1636544k used, 426272k free, 282656k buffers
This is from my desktop system. I have 2GB installed.
I have 426MB free, but.... 282MB in buffers. The system can "steal" from the buffers (to a point), so I have 426+ (something) free.
But from your listing, yes, it is clear that something is eating up a whole lot of memory, as buffers is a small value. The system has already stolen all it can from buffers.
You've got something eating 10GB of ram. Look at the rest of the output from top (the process list) to see what it is.
Run top again. Hit the "F" (capital F) key while it is running, it will pop-up a list of fields. Hit "N" (capital N) and return. You will now see a list of processes sorted by % memory use.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26593 jon 20 0 543m 131m 24m S 0 6.5 0:17.14 eclipse
21470 root 20 0 256m 109m 7568 S 1 5.5 43:40.20 X
21768 jon 20 0 441m 65m 14m S 7 3.3 335:14.40 superkaramba
21817 jon 20 0 418m 36m 16m S 0 1.8 0:06.38 /usr/bin/sealer
21765 jon 20 0 241m 32m 10m S 0 1.6 21:50.00 compiz
2330 mysql 20 0 246m 32m 4288 S 0 1.6 6:08.03 mysqld
Every Linux system has a "man" command. Use it. top is your friend.
now I have take a screen with the %MEM, VIRT and RES.
Which one has the largest value in the VIRT and RES columns? That one is probably the source of your memory problems.
Hit "N" (capital N) and return. You will now see a list of processes sorted by % memory use.
I had you sort by resident memory %. Whatever it is that's taking up the memory apparently is mainly swapped-out.
You should wind-up with SOMETHING showing an awfully big VIRT number at the top of the list.
It looks to me that you are not the only one using this machine and that top only shows the processes that belong to you. In that case someone else could be the troublemaker.
The machine appears to be nearly dead-idle, and running with a very nicely slimmed-down set of processes (25 processes?! What Linux machine runs with 25 processes? Mine has 150, but it's a desktop.)
So something "ain't right".
I'm afraid I'm unfamiliar with the details of the virtualization schemes that simply hide other user's resources - maybe somebody else can elucidate more on those. I know these were pretty popular a while back, but I think now are taking a back-seat to true virtualization.
Is this a server you own, or is a monthly lease from a hosting company? How much memory do you get on your plan? The 8GB RAM and 16GB swap does seem awfully high.
If this really is a dedicated server, I don't have any further ideas on what could be wrong, other than to suggest some kind of virus or such (that is eating memory and then hiding itself) or serious mis-configuration of the kernel. If you haven't actually launched your site yet, and/or have good backups and can afford some downtime, I would suggest requesting a full re-load of your system.