# game server and polling



## DigiSoft (Jan 17, 2010)

Ok So I have very intensive gaming server and it is full 24/7.

I need some options to optimise the server.

I run FreeBSD 8.0 fresh install and I am using 

kern.hz=2000

Can you help me with more options like kern.polling.enable so I can loose the lag little.

Thank you

BTW if I enter sysctl 'kern.polling.enable'

I get

sysctl: unknown oid 'kern.polling.enable'


----------



## DutchDaemon (Jan 17, 2010)

Are you looking for device polling on network interfaces? -> polling(4)


----------



## DigiSoft (Jan 17, 2010)

Yes that is what I am looking but it seems my FreeBSD doesn't have polling. why?

When I write sysctl -a | grep polling

I get nothing.


----------



## DutchDaemon (Jan 17, 2010)

As the manual says, you'll need a custom kernel with options DEVICE_POLLING compiled in. Once you have that you can use ifconfig to switch polling on or off on interfaces that support it (which are also listed in that manual).

It will also add certain kern.polling sysctl entries.

In other words: device polling is *not* in the GENERIC kernel.


----------



## DigiSoft (Jan 17, 2010)

DutchDaemon said:
			
		

> As the manual says, you'll need a custom kernel with DEVICE_POLLING. Once you have that you can use ifconfig to switch polling on or off on interfaces that support it (which are also listed in that manual).
> 
> It will also add certain kern.polling sysctl entries.



Hmm do You think it worth for gaming server?
I must run the server at ker.hz=2000 so I can get 600 frames for the server.

Do you think there would be any advantage with the polling?

Thank you.


----------



## DutchDaemon (Jan 17, 2010)

Do you see a lot of _network_ interrupt activity? Do you see a high percentage of interrupt activity in [cmd=]top[/cmd]? That's the only type of polling currently available.


----------



## Alt (Jan 17, 2010)

You can `systat -vms 1` to see which device generate interrupts
Advantages depends on interrupt load. If it is not so many interrupts, better leave without polling - cpu can answer more quickly to incoming packets (reducing server ping in games). But when there many PPS - if you set polling it will save cpu time and reduce apps context switches/other cpu work, so it must work faster on big PPS


----------



## DigiSoft (Jan 17, 2010)

I've checked and here is results


```
2000 cpu0: time
1606 alc0 256
2000 cpu1: time
```

alc0 is my network.

Is this lot interrupts?


----------



## DigiSoft (Jan 17, 2010)

*Noob asks how to rebuild freebsd*

Ok so I am little noob at this.

I have installed FreeBSD 8 but it seems that DEVICE POLLING is not included.

Now I want simple to recompile the kernel with this options 

options DEVICE_POLLING
options HZ=2000

please help me and thank you.


----------



## DutchDaemon (Jan 17, 2010)

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-building.html


----------



## DigiSoft (Jan 17, 2010)

ok my kernel is recompiling but is it possible to crash something like pico, linux comp, wine?

This is remote server and it is very important not to crash...


----------



## DutchDaemon (Jan 17, 2010)

If your kernel recompiles fine (and you didn't make a huge amount of alterations), chances are it will install and run fine. Look into nextboot(8) -k if you're unsure.


----------



## DigiSoft (Jan 17, 2010)

I've only added options DEVICE_POLLING

One more question.
When I was installing the system I didn't included the src directory so now I downloaded it from FTP with sysinstall

Is that OK?


----------



## DutchDaemon (Jan 18, 2010)

Assuming you installed the correct source tree for your current installation (e.g. 8.0-RELEASE) it should be ok.


----------



## DigiSoft (Jan 18, 2010)

well
it only asked me where do I want to install it from and because it is remote server I had no CD/DVD so I choose FTP and it downloaded automatically.

Is it possible that I got wrong version?


----------



## DutchDaemon (Jan 18, 2010)

Compare [cmd=]grep -E '^(TYPE|REVISION|BRANCH)' /usr/src/sys/conf/newvers.sh[/cmd] with [cmd=]uname -sr[/cmd].


----------



## DigiSoft (Jan 18, 2010)

It is too late, I am compiling 


Wish me luck


----------



## DigiSoft (Jan 18, 2010)

I am very anxious while waiting to finish 

How much time it needs? It is very new server.
Core 2 duo E8500 I think with 8 GB ram.


----------



## DutchDaemon (Jan 18, 2010)

Compiling (make buildkernel) doesn't do anything final, it just prepares the new kernel and modules for installation. So if your source tree doesn't match your installation, don't run 'make installkernel' and try again with correct source code. Compiling kernel and modules on relatively new hardware should certainly be done well within an hour.


----------



## DigiSoft (Jan 18, 2010)

Ok compiled installed AND WORKKKSSSSSSS
Ahhh I am so releaved 

Now please help me how to set this options.


```
kern.dcons.poll_hz: 25
kern.polling.idlepoll_sleeping: 1
kern.polling.stalled: 0
kern.polling.suspect: 0
kern.polling.phase: 0
kern.polling.handlers: 0
kern.polling.residual_burst: 0
kern.polling.pending_polls: 0
kern.polling.lost_polls: 0
kern.polling.short_ticks: 0
kern.polling.reg_frac: 20
kern.polling.user_frac: 50
kern.polling.idle_poll: 0
kern.polling.each_burst: 5
kern.polling.burst_max: 150
kern.polling.burst: 5
debug.acpi.ec.polled: 0
```


thanks


----------



## DutchDaemon (Jan 18, 2010)

Hey, wait a minute ... You posted something in the other thread about interrupts. Is your network interface 'alc0'? That interface doesn't support polling. It isn't listed in polling(4), and polling isn't mentioned in alc(4).

So you might as well not take the risk with the new kernel. It won't benefit you unless you have one of the interfaces listed in polling(4).


----------



## DigiSoft (Jan 18, 2010)

really :S :S


----------



## DigiSoft (Jan 18, 2010)

Ohhh f***. But that documentation is for 7.2. Maby there is in 8.0?


----------



## DutchDaemon (Jan 18, 2010)

No, alc has no polling support yet (alc appeared in 8.0, btw). Maybe the driver author will include it, but it's not in there now.


----------



## DigiSoft (Jan 18, 2010)

LOL I am destroyed from this 
Now what.......

Is it ok to live the kernel like this?


----------



## DigiSoft (Jan 18, 2010)

Sorry for dubleposting, I hate there is no edit button

The network is

<Atheros AR8131 PCIe Gigabit Ethernet>


----------



## DutchDaemon (Jan 18, 2010)

> Is it ok to live the kernel like this?


Sure, no problem. If you're paranoid, just `# rm -rf /boot/kernel` (your new kernel/module collection) rename /boot/kernel.old (your previous kernel/module collection) back to /boot/kernel, and reboot. You'll have your old GENERIC kernel back. Sorry about not catching that alc0 interface before, but I guess I got sidetracked because you started a new topic about this.


----------



## DigiSoft (Jan 18, 2010)

oh at least that is ok 
I badly needed polling because I was talking with other administrators and they say there is great improvement when using polling.


----------



## volatilevoid (Jan 18, 2010)

You'll get the edit button if you have at least ten posts and are registered for ten days.

The Atheros controller is the one which uses the alc(4) driver. Keeping the kernel wouldn't hurt I think. But polling isn't possible right now.


----------



## DutchDaemon (Jan 18, 2010)

Yep, get a different card then 


```
SUPPORTED DEVICES
     Device polling requires explicit modifications to the device drivers.  As
     of this writing, the bge(4), dc(4), em(4), fwe(4), fwip(4), fxp(4),
     ixgb(4), nfe(4), nge(4), re(4), rl(4), sf(4), sis(4), ste(4), stge(4),
     vge(4), vr(4), and xl(4) devices are supported, with others in the works.
```


----------



## DigiSoft (Jan 18, 2010)

ohh I hate no edit button :S

Anyway does that mean that EVERYTHING I compiled it goes in that kernel folder and no where else?

If you than that is great work.

one more questions. Do you know if other linux/unix distributions have polling for this device?

Thank you.


----------



## DigiSoft (Jan 18, 2010)

Ok sorry again for riposting I am feeling bad for that.

Can you suggest me some good PCI ethernet fast card that supports polling.


----------



## DutchDaemon (Jan 18, 2010)

Compiled kernel/modules end up in /boot/kernel, and nowhere else.


----------



## DutchDaemon (Jan 18, 2010)

DigiSoft said:
			
		

> Ok sorry again for riposting I am feeling bad for that.
> 
> Can you suggest me some good PCI ethernet fast card that supports polling.



Just look in the man pages of the drivers mentioned in polling(4) ... e.g. bge(4) = [cmd=]man 4 bge[/cmd]. Most of the man pages state explicit brands and models.

3Com (xl(4)), Intel (fxp(4) and em(4)), Broadcom (bge(4)) are among the most used. One is usually advised to stay away from Realtek (rl(4) and re(4)), though I haven't really had trouble with them.


----------



## DigiSoft (Jan 18, 2010)

Ohh ok I thin I'll buy intel.
Just one more question.

Does polling is just for FreeBSD or this is network card feature that works on other OS that supports polling.


----------



## DutchDaemon (Jan 18, 2010)

No idea. It's probably easier to switch the interface card than to switch to a different OS anyway ..


----------



## volatilevoid (Jan 18, 2010)

DigiSoft said:
			
		

> Can you suggest me some good PCI ethernet fast card that supports polling.


What about the Intel Gigabit CT Desktop Adapter? Should run with the em(4) driver and costs around 25 euros. em(4) supports polling.


----------



## DutchDaemon (Jan 18, 2010)

See also: http://www.cyberciti.biz/faq/freebsd-device-polling-network-polling-tutorial/


----------



## DigiSoft (Jan 18, 2010)

I don't know what to do now. If I buy new card I should travel 100miles to replace it lol 

Or maybe it will be released pulling driver?


----------



## volatilevoid (Jan 18, 2010)

Linux supports polling, too. There it is called New API. And the before mentioned Intel adapter would support it there. But personally, I'd stick with FreeBSD.


----------



## DigiSoft (Jan 18, 2010)

one more question sorry 

I compiled the kernel with "make depend all install"

is that ok?

So can I get back to the old kernel like you told me before?

Thank you.


----------



## DutchDaemon (Jan 18, 2010)

That's the old-fashioned way of doing a kernel build, one uses _make buildkernel_ and _make installkernel_ nowadays (this was literally in the link I gave you in post #2 in this thread). But you can just swap /boot/kernel and /boot/kernel.old like I said before to get your previous kernel back.


----------



## DutchDaemon (Jan 18, 2010)

You could drop the author af the alc(4) driver an email asking about polling. By the way: your current card may not have polling on other operating systems, so don't make any hasty decisions ..


----------



## DigiSoft (Jan 18, 2010)

Ok thank you SOOO much.

Anyway if I bought new network before the compile I will must to compile right?


----------



## DigiSoft (Jan 18, 2010)

Sorry for bad english 

Yes, Ill send him email right now but how can I contact him, can't find contact info on the page you sent to me.


----------



## DigiSoft (Jan 18, 2010)

forget my last post I saw the mail  Sorry

Over and out.


----------



## DutchDaemon (Jan 18, 2010)

DigiSoft said:
			
		

> Ok thank you SOOO much.
> 
> Anyway if I bought new network before the compile I will must to compile right?



Almost all network interface drivers are either in the GENERIC kernel or available as a kernel module, so you won't have to recompile anything. The card will just work, and if you leave the current kernel in place, the polling will be available as well. You'll just have to turn it on using ifconfig. See http://www.cyberciti.biz/faq/freebsd-device-polling-network-polling-tutorial/. In fact: read this entire thread again, with a little more attention this time ... there's a lot of information in there, which may have gone lost due to this thread turning into a chatbox.


----------



## DigiSoft (Jan 18, 2010)

Ok, I've send hime email asking for help. You think it is possible to implement this? Is it hard to do?


----------



## DutchDaemon (Jan 18, 2010)

Just wait for a reply and stop asking 'one more question' in this thread  It's gone way too far off-topic.


----------



## Alt (Jan 18, 2010)

Depends on how much %interrupt in `top` command =) Not so lots at can be, but seems net load is good, so you can try on and check which effect you will got


----------



## DutchDaemon (Jan 18, 2010)

[ separate threads merged ]


----------

