View Single Post
Old 09-14-2006, 02:45 PM   #1
NitOxYs
 
Join Date: Oct 2004
Reputation: 0
Posts: 535
Server Performance and Configuration Guide

Hello,
Alot of people have been PMing me about how and why their server is running so high in cpu especially with dual cpu servers.
This guide practically breaks it down..
With very little help from whisper wiki's tutorial, I decided to do it myself. In the beginning there was a stock kernel, I read a simple guide on how to compile a kernel, and I modified heavily after I did it.
EDIT: Debian Install Notes are at the Bottom.
1st step.
Identify your hardware.
A source server will take up as much cpu usage as it can take.
SRCDS is known to take up as much as it can.

Minimum requirements for a decent server would be
Dual Core Core 2 duo or Equivalent AMD Part.
(Althon 64's and P4's may do for really really smaller servers)
2GB of DDR
At least an 160GB SATA Drive

As we go from here lets take a look at what we need to change to optimize the actual server.

1. Make sure you have plenty of disk space for srcds, if it tries to load off the disk the servers will lag like no tomorrow.

2. Change the kernel to 1000hz, get rid of the bloat of the kernel

3. Having the right config and command line options

4. Having enough bandwidth to provide for the clients

Step One is pretty self explanatory, and I won't go into much detail about that.

Step Two:
Once thing is to identify what Operating system you are running.
do a
Code:
uname -r
This will identify what kernel you are using, usually specifically tells you what os it is running.

This tutorial will be for CentOS Operating systems however you can use this for other linux distros.

First thing you do find your .config file for your kernel.
it under your /boot folder in the main drive.
For ex. /boot/config-2.6.9-42.0.8.ELsmp
REMEMBER SMP is for Multiple Processors/CORES

So what we do now is go into /usr/src and download the kernel package from kernel.org

Do Do
Code:
tar xfz linux-2.6.31.1.tar.gz
Do
Code:
cd linux-linux-2.6.31.1
Once inside that directory.. Halt.
Remember one of the first steps to find that config.
Do a
Code:
cp -R /boot/config-2.6.9-42.0.8.ELsmp .config
Change it to whatever your distro has on the boot partition in terms of config for the kernel.
Note that's the config file for SMP(Dual Cores or Dual Processors)

*This has to be done in the kernel source main directory.

Ok Ok, Exciting isn't it.

If this is a recompile,
Do a
Code:
 make clean
If not skip that step.

You are ready to venture into the config for the kernel.
****WARNING****
Whatever you configure here, is what your kernel will do, so be careful to not take something out you don't know.

Do start the configuration utility,
Do a
Code:
make oldconfig or menuconfig
For Menuconfig, a gui comes up, you need ncurses-devel and ncurses installed to do so.
Be aware if it gives you a hard time.

***1000 FPS Configing***
In the menuconfig, under processor types and features
Enable High Resolution Timer, No Dynamic ticks, Low Latency Desktop.
In the menuconfig, under Power management enable APIC only thats it.

I suggest finding the specific drivers for the motherboard, chipset, video, sound, anything you need to run the server. There is <font color=orange>a lot</font> of bloat in there for Wireless cards, extra bs about sound cards, telephony devies, 56k crap.. If you are running 56k on a server just stop reading right now and close up shop.. No I'm just kidding.

When configuring the I/O Schedulers under block options,
Make sure you choose anticipitory, set it as default.

Also, Find the part under the processor and performance part,
you will see kernel_hz=250.. Change the value to 1000hz ..

Get rid of the bloat, exit out and save the config file.

Now before you get all happy and randy, that you just configured your kernel..

In order to get 1000 fps you have to change a nice little param.h in
arch/x86/include/asm/param.h


So in the Param.h you will see
Code:
USER_HZ  =  100
Change that to 1000.
ONLY CHANGE THAT!
Now your ready to compile.. Wahoo!
Thats it, save it and you should be good to go.
****END*****

Here is the commands to do so..
Code:
make bzImage
make modules
make modules_install
make install
(You can try make all or initrd for debian)
You can thank Eth1 for those installation tips for Debian.
***********************************************
Do those after its done,
Do NOT change the grub.conf in /etc yet to default 0.
Inorder for you to test it..
Do
Code:
grub
savedefault --default=0 --once
quit
This will set your newly compiled kernel as the boot one, if it fails just to a restart, and it should go back to the original one.

Woo.. If it works congrats... If it doesn't check your drivers and anything else you changed int he menu or oldconfig.

Now were onto the configuration..

Step 3:
I want to make something really clear for the command lines for source.
There is NO -pingboost for SRCDS.. This was done away with when source was made.

Srcds uses now, the +fps_max and -tickrate commands to power the performace.
IF you want the max fps the server can dish out, set the fps_max to 0, if you want to limit it, set it to a higher value.
Example startup..
Code:
./scrds_run -command update -game "cstrike" +ip xx.xx.xx.xx +port 27015 +map de_dust2 +maxplayers 20 -autoupdate -tickrate 100 +fps_max 0
Alot of people will argue with me or disagree with the whole "-command update" dealy, however it will automatically update your server if you have steam near the server binary, aka in the directory your starting it from.

If you are running your server from a home connection,
an "sv_maxrate 9999 or lower will be fine for 10 users or less"
If you have your own server with a dedicated connection, say at a datacenter, or rent one, then I recommend 25000.

You always want your maxupdaterates and minupdaterates along with .
Always set them to
sv_maxupdaterate 120
sv_minupdaterate 20
sv_maxrate 25000
sv_minrate 2000

This shoots out the .01% crowd of 56kers Most users use at least 25k for their rate, so minrate will not matter so much.

If your server is lagging, a because your running out of processor usage, or b your rates aren't configure, or c. network, and hardware related issues are occuring, check all of it.

I'm about done, if I think of anything else, or anyone else needs things posted here, feel free to do so, I will update it if I think of anything more.
******DEBIAN***********
For Compiling a Debian Kernel:

Code:
su
Code:
apt-get install libc6-dev gcc binutils modutils kernel-package libncurses5-dev debianutils make
Code:
cd /..
Code:
cd /usr/src/
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2
Code:
tar xfvj linux-2.6.18.tar.bz2
Code:
wget http://www.kernel.org/pub/linux/kernel/people/ck/patches/cks/patch-2.6.18-cks1.bz2
Code:
mv linux-2.6.18 linux-2.6.18-cks1
Code:
cd linux-2.6.18-cks1
Code:
bzcat /usr/src/patch-2.6.18-cks1.bz2 | patch -p1
Code:
cd /..
Code:
cd /usr/src/
Code:
ln -s linux-2.6.18-cks1 linux
Code:
make-kpkg clean
Do.
Code:
make-kpkg --revision=kernelname kernel_image
Install with this
Do.
Code:
dpkg -i kernel-image-kernelname.deb (it will be in /usr/src)
Then do An
Code:
mkinitrd -o /boot/initrd.img-2.6.18 2.6.18
Edit your GRUB config, and add a initrd line to your new kernel...
Code:
nitrd /initrd.img-2.6.18 2.6.18
********END OF DEBIAN INSTALLATION NOTES*********

Last edited by NitOxYs: 10-03-2009 at 12:40 PM. Reason: New 1000fps server
NitOxYs is offline  
Reply With Quote