LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-04-2005, 02:39 AM   #1
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Rep: Reputation: 0
Memory Management... ugh


I'm kinda irked by Linux's memory management. It's great for most stuff, but kinda bites for others.

I run a dedicated Counter-Strike:Source box that uses the Debian command line distro. with the latest kernel. (2.6?) My server was having some troubles due to only having 1GB of RAM, so I figured, what the heck... let's put another stick in there. There wasn't a lot being cached this time around, there was some lost memory and a lot being used. I did have a 32 player server and a 12 man private running, so that was my decision on another stick of RAM. Currently only have a 32 man server running.

I went ahead and bought two 1GB sticks of PQI PC3200 DDR because it was cheaper than PC2700, then sold the other RAM that was in there. Also the PC3200 allows for expansion in the CPU later down the road.

Well, got the RAM in, the server ran EXCELLENT for a week, no hiccups, no nothing... until Linux cached ~1.5GB+ of memory. Ugh... This is leaving very little free. I know I've read a ton of articles saying this is okay, but in terms of a game server, it doesn't seem wise to have only 60MB out of 2GB free. Yes, all the articles I've read say it'll free up memory if it needs it. Well, it doesn't. It frees memory once per day, and at 6:30am only.

I do not directly access the box as I am not fully up-to-par with Linux yet, so instead my friend who hosts the box and has used Linux for years does all of the work. I can SSH into the box if I wish, and may to get some information per request.

So, my box likes to lag a lot because there doesn't seem to be enough free memory to run stuff that's needed.

Stuff that I know that is on the box

- Counter-Strike:Source (32 Player Server)
- Apache
- Psychostats
- some other little things

I honestly don't know everything that's run on the box, but it has CS:S and my buddies website. That's about it.

Box Specs:

- ABit AN7 Motherboard
- AMD Athlon XP 2800+ 333MHz FSB 512KB Cache
- 2x 1GB PQI PC3200 DDR (Dual Channel Enabled)
- 8GB, 20GB, and 40GB 10,000RPM SCSI HDD's not in RAID configuration
- Dedicated 10mbps connection (Switch limited, physical line is 1,000MB up/down)

I see Cacti shows ~140 processes on average done by the processor. That isn't a lot. I've had the box attacked before and it jumped up to 350 before they got null routed.

What I'm Asking:
I would like to know how I can have Linux keep like 500MB+ free RAM at all times for just that, random access memory. I can't seem to find anything on the net that tells me how to lower the amount of buffer cache, or let alone free some stuff up. I, again, understand that Linux caches all memory possible for a reason, but I don't feel it's good for a game server due to the fact that there are multiple things need to be used, like Psychostats is constantly recording, the administration plugin I have for my CS:S server is constantly writing, and CS:S itself is constantly doing stuff.


Any help is greatly appreciated!!

I'm sorry if this topic has come up in the past. I did search the forums and my search phrase mustnít have been proper as I didn't find exactly what I was looking for.


Here is a screenshot of Cacti showing the free memory:

gameagon.com/images/linked_pics/cacti_bandwidth_memory.JPG

Last edited by NAiLs00; 04-04-2005 at 02:43 AM.
 
Old 04-04-2005, 03:04 AM   #2
t3gah
Member
 
Registered: Dec 2004
Distribution: SuSE, RedHat, ubuntu, Debian
Posts: 734

Rep: Reputation: 30
Question ( i need a speel chekker )

With no one logged into the system how much memory is being used?

From the console type: top

Copy what's there and post it here with [/code] at the end and [code] at the beginning of the output.

You brought up an important issue because there is no memory tutorial or wiki that I could find here at LQ.org and this is very important for those who are trhashing their systems because the default is not tailored to their situation.

EDIT: I almost forgot.... Did you run Memtest86+ on that box?

uhm... that snapshot is bandwidth and physical system memory. And if you notice the peak came when there was little or no traffic on your system.

Have you run chkrootkit, rkhunter and nmap on that system yet?

(there's a great security thread here in the wiki section)


Last edited by t3gah; 04-04-2005 at 03:09 AM.
 
Old 04-04-2005, 12:34 PM   #3
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Original Poster
Rep: Reputation: 0
The peak came because I think the server restarts, only recently, at 6:30am. Only CS:S restarts, not the physical box. It has been freeing memory at 6:30am since the box went live. (June 2004) My friend wrote a script to allow the CS server to restart automatically at 6:30 when traffic is usually down.

I'll have my friend do the chkrootkit, rkhunter and nmap, but I can do the top later on and post you the results.

There are currently 6 users logged in. I'm sure one of them is me for cacti and the rest are probably my friend with various things, or whatever else Linux does. There are 129-140 current processes.

I have no clue what Load Average means, but it is showing:

1 Minute Average - 0.58
5 Minute Average - 0.46
15 Minute Average - 0.45

TONS of free space on the drives, disk caching off. With disk caching on, the system bogged down big time!

Thanks for your time! I'll get you some results of the commands you requested later on this afternoon/evening.

Last edited by NAiLs00; 04-04-2005 at 12:35 PM.
 
Old 04-04-2005, 09:49 PM   #4
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Alright, this is what my friend said:

"using both rkhunter and chkrootkit both didnt find anything"
"nmap is fine"


Code:
cod@cs:~$ nice -19 top
top - 21:47:45 up 31 days,  5:05,  7 users,  load average: 0.47, 0.49, 0.45
Tasks: 126 total,   2 running, 122 sleeping,   2 stopped,   0 zombie
Cpu(s):  33.4% user,   3.6% system,   0.0% nice,  63.0% idle
Mem:   2070196k total,  1987740k used,    82456k free,   193112k buffers
Swap:        0k total,        0k used,        0k free,  1220480k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 5013 cod       14   0  130m 130m 8552 S 34.4  6.5 161:05.61 srcds_amd
17622 cod       19  19  1168 1168  852 S  1.3  0.1  85:10.42 top
 7452 cod       19  19  1104 1104  848 R  1.0  0.1   0:00.72 top
    1 root       8   0   512  512  456 S  0.0  0.0   0:04.20 init
    2 root       9   0     0    0    0 S  0.0  0.0   0:00.03 keventd
    3 root      19  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd_CPU0
    4 root       9   0     0    0    0 S  0.0  0.0   0:01.17 kswapd
    5 root       9   0     0    0    0 S  0.0  0.0   0:00.00 bdflush
    6 root       9   0     0    0    0 S  0.0  0.0   0:00.16 kupdated
    7 root       9   0     0    0    0 S  0.0  0.0   0:00.00 ahc_dv_0
    8 root       9   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
    9 root       9   0     0    0    0 S  0.0  0.0   1:26.26 kjournald
  139 root       9   0     0    0    0 S  0.0  0.0   0:01.15 kjournald
  140 root       9   0     0    0    0 S  0.0  0.0   0:21.99 kjournald
  316 root       9   0   628  628  516 S  0.0  0.0   0:33.99 syslogd
  319 root       9   0  1192 1192  448 S  0.0  0.1   0:00.05 klogd
  342 root       8   0   532  532  472 S  0.0  0.0   0:00.01 inetd
  525 root       9   0  3432 3428 1904 S  0.0  0.2   1:31.45 snmpd
  531 root       9   0  1540 1536 1396 S  0.0  0.1   0:01.81 sshd
  535 root       9   0  3236 3236 3136 S  0.0  0.2   0:00.38 ntpd
  543 root       9   0  3228 3228 3136 S  0.0  0.2   0:00.02 ntpd
  556 root       9   0   476  476  424 S  0.0  0.0   0:00.01 getty
  557 root       9   0   476  476  424 S  0.0  0.0   0:00.00 getty
  558 root       9   0   476  476  424 S  0.0  0.0   0:00.00 getty
  559 root       9   0   476  476  424 S  0.0  0.0   0:00.00 getty
  834 root       9   0   476  476  424 S  0.0  0.0   0:00.00 getty
  850 root       9   0   476  476  424 S  0.0  0.0   0:00.00 getty
11121 jerry      9   0  2512 2512  996 S  0.0  0.1   2:40.21 screen
11122 jerry      9   0  1644 1644 1312 S  0.0  0.1   0:00.00 zsh
11136 jerry      9   0  1640 1640 1308 S  0.0  0.1   0:00.01 zsh
11137 root       9   0  1420 1420 1160 S  0.0  0.1   0:00.00 bash
11138 cod        9   0  1504 1504 1192 S  0.0  0.1   0:00.02 bash
11256 root       9   0  1452 1452 1188 S  0.0  0.1   0:00.00 bash
15433 jerry      9   0  1652 1652 1316 S  0.0  0.1   0:00.01 zsh
16258 jerry      9   0  1652 1652 1316 S  0.0  0.1   0:00.01 zsh
17413 root       8   0  1784 1784 1208 S  0.0  0.1   0:00.34 bash
11809 root       9   0  1412 1412 1156 S  0.0  0.1   0:00.01 bash
11813 cod        8   0  1760 1760 1236 S  0.0  0.1   0:00.35 bash
10440 cod       19  19  2240 2228 1536 R  0.0  0.1   0:03.51 server_linux
 
Old 04-04-2005, 10:59 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,622

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
So some searching on swappiness. Yep, that's not a typo.
Plenty of discussions here in LQ - you'll even find a reference to the developers arguing amongst themselves

If you are using the 2 Gig, you already have highmem support enabled, so you could try fiddling with this as you are apparently at 2.6
 
Old 04-04-2005, 11:24 PM   #6
tormented_one
Member
 
Registered: Oct 2004
Location: Small Town USA
Distribution: slamd64 2.6.12 Slackware 2.4.32 Windows XP x64 pro
Posts: 383

Rep: Reputation: 30
What kernel is it running? I take it is a 2.4 series kernel, due to the keventd process running. Try 2.4.28 or .29 and maybe an experimental 2.6 series kernel too. Just to make sure the problem is not with an older kernel. "uname -r" will tell you the kernel number. Also as said above adding a swap partition to this would probably cure the cache memory problems.
 
Old 04-04-2005, 11:33 PM   #7
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Yea... I spoke with my friend after I posted my last message and he said he got the 2.6 compiled and working, just not installed on the box yet. He wants to be at the physical box incase something goes wrong that he can revert back to 2.4. When we did the RAM upgrade, he was going to install the latest kernel... he forgot to package in internet drivers or whatnot. I think he's going to update the kernel this weekend.

Regarding cache. It NEVER touched the disk cache. For some reason with it enabled, it would bog the server down some. Since it has been turned off, the server has run a little better. So my friend decided to just plain old turn it off.

Last edited by NAiLs00; 04-04-2005 at 11:35 PM.
 
Old 04-05-2005, 09:07 PM   #8
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Original Poster
Rep: Reputation: 0
*bump*
 
Old 04-06-2005, 06:05 AM   #9
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
have you tried playing around with the memory environmental variables to try to make the mem caching less aggressive?
 
Old 04-06-2005, 12:27 PM   #10
NAiLs00
LQ Newbie
 
Registered: Apr 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Care to share what they are? I'm not extremely familiar with Linux, but I know my way around. I've used it in the past. My friend who runs the box is more knowledgable with Linux, but I don't know if he knows what those variables are.
 
Old 04-07-2005, 05:05 AM   #11
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
before I start in, know that I don't have any long lived apps and have never had a reason to use these, so I'd recommend some research to find out any potential problems before you start using them.

http://www.linuxjournal.com/articles...90/6390t1.html
take a look at the second column ( there are more which you will find through more resources - if you do a google for MALLOC_TRIM_THRESHOLD it should get you started.).

I'd help out more, but like mentioned above I have not long lived processes to try them on.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
memory management navaladi Mandriva 2 02-18-2005 06:47 AM
Memory management Mojojo Linux - Hardware 11 08-31-2003 10:29 AM
memory management exigent Linux - General 1 08-17-2003 08:28 PM
memory management? snow Linux - Software 7 02-12-2003 01:57 PM
Memory Management hhegab Linux - General 3 08-07-2002 10:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration