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 wikki'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
A single opteron or xeon, Or a dual core opteron xeon.
(Althon 64's and P4's may do for smaller servers)
1GB of DDR
At least an 80GB 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 tommorow.
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 explanitory, 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
This will identify what kernel you are using, usually specifically tells you what os it is running.Code:uname -r
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
DoCode:tar xfz linux-2.6.20.1.tar.gz
Once inside that directory.. Halt.Code:cd linux-2.6.20.1
Remember one of the first steps to find that config.
Do a
Change it to whatever your distro has on the boot partition interms of config for the kernel.Code:cp -R /boot/config-2.6.9-42.0.8.ELsmp .config
Note thats the config file for SMP(Dual Cores or Dual Processors)
*********1000FPS Tutorial Begins!**********
Now we're going to apply a kernel patch.
Do This
*This has to be done in the kernel source main directory.
Ok Ok, Exciting isn't it.
do this
It should throw back an unexpected end of patch, doesn't matter the dev forgot to do that. That and it shows some offset lines. Who cares. It works.Code:bzcat patches-2.6.20-hrt-dynticks1.tar.bz2 | patch -p1
If this is a recompile,
Do a
If not skip that step.Code:make clean
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
Be aware if it gives you a hard time.Code:make oldconfig or menuconfigFor Menuconfig, a gui comes up, you need ncurses-devel and ncurses installed to do so.
***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>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..
Inorder to get 500 fps you have to change a nice little param.h in
include/asm-DISTRO/param.h
When I mean distro, what version, 32bit 64bit etc..
i386 is 32bit and X86_64 for 64bit.
So in the Param.h you will see
ONLY CHANGE THAT!Code:USER_HZ = 100Change that to 1000.
Now your ready to compile.. Wahoo!
****1000 FPS****
Edit CONFIG_HZ with 1500.
Edit User_hz with 1500
Now edit include/linux/jiffies.h
Find #defin shift_hz 10 or something similar
Make it look like this
Here is the commands to do so..Code:# define SHIFT_HZ 10 #elif HZ >= 1536 && HZ < 3072 # define SHIFT_HZ 11 #else # error You lose. #endifThats it, save it and you should be good to go. ****END*****
(You can try make all or initrd for debian)You can thank Eth1 for those installation tips for Debian.Code:make bzImage make modules make modules_install make install
***********************************************
Do those after its done,
Do NOT change the grub.conf in /etc yet to default 0.
Inorder for you to test it..
Do
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.Code:grub savedefault --default=0 --once quit
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..
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.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
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:suCode: apt-get install libc6-dev gcc binutils modutils kernel-package libncurses5-dev debianutils make cd /.. cd /usr/src/ wget http://www.kernel.org/pub/linux/kern...2.6.18.tar.bz2 tar xfvj linux-2.6.18.tar.bz2 wget http://www.kernel.org/pub/linux/kern....6.18-cks1.bz2 mv linux-2.6.18 linux-2.6.18-cks1 cd linux-2.6.18-cks1 bzcat /usr/src/patch-2.6.18-cks1.bz2 | patch -p1 cd /.. cd /usr/src/ ln -s linux-2.6.18-cks1 linux make-kpkg cleanDo.Code:make-kpkg --revision=kernelname kernel_imageInstall with this Do.Code:dpkg -i kernel-image-kernelname.deb (it will be in /usr/src)Then do AnCode:mkinitrd -o /boot/initrd.img-2.6.18 2.6.18Edit your GRUB config, and add a initrd line to your new kernel...********END OF DEBIAN INSTALLATION NOTES*********Code:nitrd /initrd.img-2.6.18 2.6.18
There are currently 5 users browsing this thread. (0 members and 5 guests)
Bookmarks