SRCDS multi-core / thread support

Hey,

I just have been googling a bit and I’m still wondering if it’s possible to boost your Garry’s Mod server’s performance in any way.
I used to own quite a lot of servers, running 1 server per core on a 8-core CPU, though, some servers need more power than others.

Currently I’m helping someone out to try to get his server to run more stable, the problem is that once the server reaches a certain amount of props, it simply doesn’t run smoothly anymore.
After looking for a bit, I found a few clientsided commands that worked on TF2 and EP2 (as said in the thread I read), enabling multi-core / multi-threading for their game. Though, I can’t find anything specific for srcds.exe in particular.
I can remember someone giving me the advice to run SRCDS on two cores, because the calculations done are split up in two parts. Another website I just read said that there is a single thread handling the incoming connections while another thread calculates the “snapshot”, aka, every frame.

So, what I’m trying to figure out, is there any way to boost your SRCDS performance by i.e. console commands that could tweak your server’s behavior in a way to make it run smoother?

Ruben

SRCDS is a single threaded process, there isn’t anything you can do to make it utilize more than one thread. Those cl_threaded cvars are purely for client side rendering and have nothing to do with game logic and won’t work on a server.

The only way to really increase performance is to lower the tickrate (which the last time I checked had been locked by Valve) or the server frame rate (which has also been locked.) there are ways to unlock these using a debugger, but it’s not really worth the trouble. You could also get a faster CPU for the server, but that can be cost prohibitive.

Then there’s the problem that (as far as I know) not many single game server providers show what CPU your server is running on. Currently this server I’m trying to help is hosted at PlugPayPlay, according to their website the game server is running on a machine with the minimum specs as following:

I’m not familiar with them as a host but they do offer a 24-slot gameserver for just over 4 GBP. That makes me wonder if it’s either a bad host or got some heavy discount on their serverspace / builds.
Just taking the first host that I can find through Google using the exact string “Garry’s mod server host”, Xenon Servers, has a price of $23.50 for the same amount of slots, which is ± 14 pounds. 3.5x more than what PlugPayPlay asks for.

What shall I recommend the owner of this server? Find himself a better host? Or do you think the specs provided by PlugPayPlay should be decent enough for a 24-slot DarkRP server with a 70-ish proplimit? I understand DarkRP is a complete shit gamemode but I’m just trying to help the guy as much as I can.

If you think we need to move to another host, which host would be recommended? I’d say it’s a requirement to have a host located in London, at least the UK.

The problem there is the CPU has Hyperthreading. Each SRCDS instance on a virtual HT core will at most only be able to utilize 50% of the real cores’ resources. You need to find a server that has the fastest single threaded performance CPU (Xeon) with HT disabled.

Any hosts you recommend that have this, guaranteed?

The problem is only partially hardware. SRCDS itself has issues when running somewhat more intensive tasks (see: Physics) and will physically cause a slowdown. No hardware is guaranteed to even remotely improve performance (that is, once you’ve hit a certain baseline, that’s it).

It’s relatively easy to support high work loads, actually.

Tickrate is not locked down. You lower tickrate, you lower calculation. You sacrifice accuracy, but really only shooter games need that, and those usually don’t run much physics simulation.

The CPU does make a huge difference as well. Take the newest Xeon E3 and the newest Xeon E5 for instance. They’re both high-performance chips. However, they’re useful for completely different reasons. People normally go for the E5 since they boast more CPU cores. However, the E3 series is the best out at the moment for hosting SrcDS servers. Regardless of hyperthreading, The E3 cores are focused on a lower amount of cores that run at a much higher speed. Since SrcDS runs logic in one thread, this is exactly what you need. The E3-1290v2 is the best processor you can use for SrcDS at this point in time. I’ll put money on it.

To put it into perspective, the E5 that D3 owned a couple years ago would chug on 50 players, but the E3-1290 we upgraded to tackled 100 players with about 50% core usage.

The only other determining factor to lower computation is just to have neat code that doesn’t do dumb things.

As you mentioned in your post, it does change the rate at which Lua / e2s / physics runs, so if your DarkRP server has wiremod enabled that’s something to consider.

Changing the tick rate on a sandbox server is a very bad idea, for example, since it would change how everything “works”. Changing the tick rate on a normal-ish DarkRP server shouldn’t matter much, as long as you set it to something reasonable like 33, and not 16.

So yeah, you can ease the amount of stress on your server by lowering the tick rate to 33 (default is 66). Would not recommend setting it below that.

Startup parameters: -tickrate 33. If you’re using a GSP, you can either change it in their startup parameters in TCAdmin (or similar) or contact their support.

We run our servers at tickrate 16 :v:

Bitch, I run this shit at 12

Does running at a tickrate of 16 make a largely visible impact?

It really depends on what you’re doing.

100 player RP server, you won’t notice a difference if your scripts aren’t tick-sensitive.

I can’t speak for any other application. I would recommend deathmatch-y gamemodes 33/66 ticks. Heavy physics gamemodes, 33. Above 66, though, I never see a good use for.

We run our servers on 16 tick. This was the message I received from our Host at NFO, directly from the owner John (this was back in 2012):

He’s right; technically, it’s not single-threaded. Networking gets its own thread, for example, as well as the internal rendering (on clients) using multiple threads in the case that multi-core rendering is enabled, which last I checked is being worked on right now. The catch though, is that all of the physics/Lua/game logic is handled in a single thread. That’s why it’s trivial to have more cores but more important to have stronger cores. Hyperthreading is not a huge issue as the logical cores do an extremely well job at performing at the speed an actual core would in Intel’s newer architectures.

Anyways, thanks for the somewhat detailed and informative posts.

Although I noticed if you’re on Windows 2003 it kinda sucks at handling the threads and if the server is heavy on CPU you’ll notice the thread swapping around cores a lot. Specially on slower CPU’s, nice little micro stutters that get annoying.

Its 2003…Thats older than Half-Life 2 itself lol

Easy solution to that is only give SrcDS one set affinity to play with. Newer releases of Windows Server kinda flip out as well when SrcDS starts chugging, not nearly as bad though.

Indeed what we used to do.

Bumpy!

Well, someone sent me a PM asking how I was auto setting affinity to SRCDS in Windows 2003.

My advice is DO NOT RUN IN W2003! … However, I’ll throw the quick c# app a friend made me for the task years ago as every other method of making each srcds use 1 seperate core on windows 2003 was pissing me off: http://share.bybservers.co.uk/Paul_affinity2.exe (Paid a friend called Paul £20 for it … hence name)
Oh yea, might need some .net run times can’t remember which :slight_smile:

You just run the application and it scans for srcds.exe and sets each a unique affinity, you just leave it running etc. Z end.

Soo, sorry for the bump & the exe file with no open source option but I lost the source for it eons ago.