LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-15-2011, 08:21 PM   #1
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Rep: Reputation: Disabled
Linux RAM to behave more like Windows RAM


Hello,

Currently I am hosting a game that requires a lot of RAM (hosted on CentOS 5.x x = latest), I am currently hosting on Xeons X3*** w/ 32GB of ECC DDR3 RAM, 1GBit uplink port. Placing around 30-60 servers on once box and still giving it 7-10GB's of room to breathe using around 50% avenged CPU usage. I am having little reports of lag with one player connected to their server, I was wondering how I would go about to optimize the kernal, if possible to enable the servers to run at a high priory, due to that is the only thing the server is actually hosting.

The gamservers are coded in Java. When running a server using the Xmx and Xms values, If a 1024MB server is created, it will use to 1024MB and allow no room for the players, or only allow around 4-5 connections before lag, yet with another host they allow 512MB's of RAM and it lets them connect with up to 10 players, thus I am using/have better server specifications. Rather than using the minimum.
 
Old 10-15-2011, 11:11 PM   #2
gary185
Member
 
Registered: Jul 2011
Posts: 113

Rep: Reputation: Disabled
this is a hard one for people to get their head around who are used to windows.
in Linux all memory is virtual so you can generally ignore memory stats and assume memory is not the problem.

it's most likely a scheduling problem like you said.

there are different scheduling algorithms to choose from when you config the kernel.
also you can choose higher clock ticks. and different timers.
there is even a RT patch for a super low latency (or close to real time functionality)
but software has to use this properly or it doesn't help.

I find alot of time video drivers are a problem.

you can use "nice" commands to set process priorities

there are also bus issues
lets see for network cards the setting are
/sbin/ifconfig eth2 txqueuelen 2000
this is the transmit cue can go from 1000 to say 10000
on the receiver side
/sbin/sysctl –w sys.net.core.netdev_max_backlog=2000

the idea is to keep packets from building up unprocessed or wost is packet loss
what packets get lost the kernel goes into damage control mode and slows down allot

there are other bus commands for latency and throughput but since i'm not at the recording studio machine i can't remember.
the pro audio forums are great for this stuff

I'm just thinking so the info might not work for newer kernels not sure lets see
/sbin/sysctl -w net.ipv4.tcp_sack=0
to turn off acknowlwdgements
/sbin/sysctl -w net.core.rmem_max= VALUE
to get larger socket buffers
other mem perameters
/sbin/sysctl -w net.core.wmem_max= VALUE

/sbin/sysctl -w net.ipv4.tcp_mem= MIN DEFAULT MAX

hope that gets you started
 
1 members found this post helpful.
Old 10-15-2011, 11:15 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I don't understand your summary of hardware in relation to RAM and "servers".

You have one Xeon box hosting 30-60 virtual machines, each running one huge Java process?
One server, one OS instance, 30-60 Java processes?


If you have one machine running 30-60 java processes of 1GB RAM each, how
are you giving the box as a hole 7-10GB room to breathe?


Cheers,
Tink
 
Old 10-16-2011, 02:20 AM   #4
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gary185 View Post
this is a hard one for people to get their head around who are used to windows.
in Linux all memory is virtual so you can generally ignore memory stats and assume memory is not the problem.

it's most likely a scheduling problem like you said.

there are different scheduling algorithms to choose from when you config the kernel.
also you can choose higher clock ticks. and different timers.
there is even a RT patch for a super low latency (or close to real time functionality)
but software has to use this properly or it doesn't help.

I find alot of time video drivers are a problem.

you can use "nice" commands to set process priorities

there are also bus issues
lets see for network cards the setting are
/sbin/ifconfig eth2 txqueuelen 2000
this is the transmit cue can go from 1000 to say 10000
on the receiver side
/sbin/sysctl –w sys.net.core.netdev_max_backlog=2000

the idea is to keep packets from building up unprocessed or wost is packet loss
what packets get lost the kernel goes into damage control mode and slows down allot

there are other bus commands for latency and throughput but since i'm not at the recording studio machine i can't remember.
the pro audio forums are great for this stuff

I'm just thinking so the info might not work for newer kernels not sure lets see
/sbin/sysctl -w net.ipv4.tcp_sack=0
to turn off acknowlwdgements
/sbin/sysctl -w net.core.rmem_max= VALUE
to get larger socket buffers
other mem perameters
/sbin/sysctl -w net.core.wmem_max= VALUE

/sbin/sysctl -w net.ipv4.tcp_mem= MIN DEFAULT MAX

hope that gets you started
Hello Gary,


All servers have different RAM limitations. I just woke up and read that and do not fully understand it 100% but I'll take another look at it in about 10 minutes or so, but the would the solution above fix the issues that I'm having, because I do not want to have to migrate to Windows on all 3 servers.

Quote:
Originally Posted by Tinkster View Post
I don't understand your summary of hardware in relation to RAM and "servers".

You have one Xeon box hosting 30-60 virtual machines, each running one huge Java process?
One server, one OS instance, 30-60 Java processes?


If you have one machine running 30-60 java processes of 1GB RAM each, how
are you giving the box as a hole 7-10GB room to breathe?


Cheers,
Tink
The 1024MB was an example.

Last edited by snooze1; 10-16-2011 at 02:24 AM.
 
Old 10-16-2011, 09:41 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
I'd look either at bandwidth, network latency, i/o and cpu scheduling (even if your cpu seems to be idle most of the time) and such kind of stuff. Overall if you are not experiencing any overly-significant amount of disk paging (swap usage).

Besides that, you can look into cgroups and the bfs scheduler, and you might also want to read around about how people use linux for real time applications. There are probably many solutions for your problem, but the first thing is to find out what the actual problem is.

I don't think that the way linux manages memory is your true problem. Linux is usually very good at that, but not so good at other things I named above.
 
Old 10-16-2011, 09:45 AM   #6
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by i92guboj View Post
I'd look either at bandwidth, network latency, i/o and cpu scheduling (even if your cpu seems to be idle most of the time) and such kind of stuff. Overall if you are not experiencing any overly-significant amount of disk paging (swap usage).

Besides that, you can look into cgroups and the bfs scheduler, and you might also want to read around about how people use linux for real time applications. There are probably many solutions for your problem, but the first thing is to find out what the actual problem is.

I don't think that the way linux manages memory is your true problem. Linux is usually very good at that, but not so good at other things I named above.
It manages memory perfectly fine IMO, it's the fact that I don't think that it was designed in an aspect to sell off the memory.

# free -m
total used free shared buffers cached
Mem: 32178 26878 5300 0 342 4287
-/+ buffers/cache: 22248 9930
Swap: 34185 0 34185

It's the fact that allowing a server to use 512MB and it's using all of the 512MB, rather than running it on windows and using 58MB and only using say 100-300 when people are connected.

Do you see where I am coming from? I am not sure what this actually is either..
 
Old 10-16-2011, 12:40 PM   #7
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
I think you do not have a good concept of what linux is doing. When running windows with minimal stuff going on the vast majority of your memory is just sitting there, unused. When running Linux with minimal stuff going on the "unused" memory is put to system use in the form of buffers and cache. As soon as the system (Linux) needs more memory, it is reclaimed.

Looking at your free output, you have 5Gb free(roughly). So there is no shortage of available memory. Even if your free was down to 10Mb when the system needs more it would reclaim some of the 4Gb that is cached. The number I would be watching (if memory was the issue) would the the without buffers/cache, 9930. Which indicates that you have almost 10GB available.

In short, I do not beleive memory is your issue.
 
Old 10-16-2011, 01:42 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
Quote:
Originally Posted by snooze1 View Post
It manages memory perfectly fine IMO, it's the fact that I don't think that it was designed in an aspect to sell off the memory.
Code:
# free -m
             total       used       free     shared    buffers     cached
Mem:         32178      26878       5300          0        342       4287
-/+ buffers/cache:      22248       9930
Swap:        34185          0      34185
It's the fact that allowing a server to use 512MB and it's using all of the 512MB, rather than running it on windows and using 58MB and only using say 100-300 when people are connected.

Do you see where I am coming from? I am not sure what this actually is either..
You are not understanding how memory is managed in Linux at all, even if you think you do.

Unused memory is not a good thing to have, it can be used for lots of things, not only to load programs and host heaps, stacks and data structures. If you don't want your OS to use it then just save the money and don't buy it in first place.

Being that said, memory that's used for other purposes (mainly buffers and cache) is, essentially, free memory, and is inmediattly available to any program requesting it. How to assign the memory on any given moment is up to the kernel, and that's the way it should be (windows does the same). No program can request real ram, they just request a quantity of virtual memory, and the kernel does its thing to decide how the memory is better used at a given moment, what should be paged, what can be retained in physical ram, and what can be cached when there's physical ram that nothing is using.


Besides that, if your game server is a memory hungry beast or has a leak I don't think that linux can do anything about it.

If you want to continue your quest in that direction you will probably be wrong. I don't know what the concrete problem is, but it's more likely to be what I and others told you above than something related to the way how linux handles the virtual memory system.
 
1 members found this post helpful.
Old 10-16-2011, 10:10 PM   #9
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by i92guboj View Post
You are not understanding how memory is managed in Linux at all, even if you think you do.

Unused memory is not a good thing to have, it can be used for lots of things, not only to load programs and host heaps, stacks and data structures. If you don't want your OS to use it then just save the money and don't buy it in first place.

Being that said, memory that's used for other purposes (mainly buffers and cache) is, essentially, free memory, and is inmediattly available to any program requesting it. How to assign the memory on any given moment is up to the kernel, and that's the way it should be (windows does the same). No program can request real ram, they just request a quantity of virtual memory, and the kernel does its thing to decide how the memory is better used at a given moment, what should be paged, what can be retained in physical ram, and what can be cached when there's physical ram that nothing is using.


Besides that, if your game server is a memory hungry beast or has a leak I don't think that linux can do anything about it.

If you want to continue your quest in that direction you will probably be wrong. I don't know what the concrete problem is, but it's more likely to be what I and others told you above than something related to the way how linux handles the virtual memory system.
Hello,

Thankyou for your detailed response, I understand, or at least I think I do about Linux Memory. The vm.swappiness is set at 10. Running the Java application on Windows I am using 100MB/150MB rather than on Linux it using all the allocated memory and using 1024MB (about 1.3 due to burst). I may regret saying this but could this be the only thing that is better hosted on Windows rather than Linux, or can Linux be tweaked to an extent that this will not be an issue.
 
Old 10-17-2011, 12:19 AM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
For all we know you maybe comparing a Linux-64 bit java engine w/ a
32-windows one ... chances would be that the handling of the same size
chunk of memory would be quite different.

W/o knowing all the details of the environment, and how you invoke
the app server, there's no way of telling what's happening there.



Cheers,
Tink
 
Old 10-17-2011, 01:48 AM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,074

Rep: Reputation: 386Reputation: 386Reputation: 386Reputation: 386
A lot of things can influence the memory used by any given program, and much more if we are talking about a jvm.

The jvm you choose, the architecture (as Tinkster said), how your java machine handles things like threading... are just some things that might influence this.

Secondly, how exactly are you meassuring how much ram is java using? As I already said above, you can measure the amount of used memory, but that doesn't mean a thing on linux and memory shouldn't be a problem unless you are swapping heavily and that becomes a bottleneck.
 
Old 10-17-2011, 01:50 AM   #12
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by i92guboj View Post
A lot of things can influence the memory used by any given program, and much more if we are talking about a jvm.

The jvm you choose, the architecture (as Tinkster said), how your java machine handles things like threading... are just some things that might influence this.

Secondly, how exactly are you meassuring how much ram is java using? As I already said above, you can measure the amount of used memory, but that doesn't mean a thing on linux and memory shouldn't be a problem unless you are swapping heavily and that becomes a bottleneck.

The command "java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui" starts the server, etc, the Xmx and Xms values are the amounts of RAM (go figure).
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
All RAM not being recognized on Linux RHEL after adding RAM manouche Linux - Enterprise 4 04-18-2008 10:31 AM
FC 6 - missing RAM - Intel S5000PSL Board - 16GB RAM meofcourse Linux - Hardware 11 12-20-2007 03:21 AM
RAM: Does linux require as much ram as Windows XP? hanzj Linux - Newbie 48 04-18-2007 12:14 AM
Shared Ram from Linux to Windows m_simin Programming 5 06-13-2005 11:19 AM
Win98SE Pentium166MMX/64MB RAM vs Linux AthlonXP+ 3000/512MB RAM : Lucent LT WinModem t3gah Linux - Software 2 04-22-2005 01:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06: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