Assistance with understanding a server profiler capture

I am a scripter working on a fairly bulky game (180k+ parts for just the map). The game has quite a few scripts, and with a full server of 70 players it can get very slow. When looking under the ServerJobs tab in the developer console, each job is around 20 steps/second when the server is at peak capacity. The server has also crashed on occasion when trying to run one of the larger functions in a script. Obviously this is not desirable, and I am trying to reduce the strain on the server as much as possible.

I have generated a few server profiler captures, but I’m not entirely sure what each process listed on there does, and what I would need to do to make it run faster. I’ve looked at a few threads on the forum, and I’ve browsed the developer wiki but I can’t find a detailed description of what exactly each process entails. From all of my captures I can see that physics is by far the longest, and doWorldStep, newStepContacts, stepContacts takes up the majority of the time. Would this just be collisions between physics parts, or something else?

I also noticed that WaitingScriptJob, MainControl, GCincremental is taking a large chunk of time as well. There are multiple scripts called MainControl in the game, which are likely not written that efficiently. I’m not quite sure what GCincremental is, so I don’t know what I should be looking to change in those scripts.

Any help with understanding my server profiler capture better would be greatly appreciated.

One of my captures: log_51D34_microprofile_20190407-121352.html (4.8 MB)

1 Like

Just show a pic man, I don’t want to have to download any risky files

It would probably be easier to be able to view the frames yourself but alright.

This is one frame:

Edit: Most of the frames look like this one so it should give you a good overview.

@Vanimion Microprofile captures are not “risky”. Even if the file came across as risky, it’d be more appropriate to flag it than to include a reply that doesn’t contribute anything to the OP.

Personally, I don’t understand much about the MicroProfiler or what each specific bar does, though what I have come to understand is that larger bars means more undesirable bars. In the case that you have large bars spanning across multiple columns in a server profile, that means that you’re relying a bit too much on your server or running too many computationally expensive functions there.

Any of the physics tabs have to do with, as the name states, physics. This does include collisions, touch events and all such operations that involve the physics engine. That’s about what I believe.

The rest, I haven’t a clue what they do. It’d probably be a good idea to review your codebase, while you wait for any responses. Improving your codebase is part of optimising your game better, as the MicroProfiler just helps you determine where performance problems exist and where to tackle them.

There’s probably a lot of code on the server that you can pass off to the client. The part count shouldn’t have a major effect (or one at all) on performance unless you’re working with detailed maps or ones that interact with the engine in one way or another. The same goes for player count - there are games out there running >80 player servers with little to no latency.

1 Like

Thanks for your response!

Most of the physics heavy stuff I can think of involves NPC’s moving and colliding, which needs to be done on the server. All of those said NPC’s constantly have a function connected to .Touched though, and the older poorly made ones are constantly moving. That is likely causing unneeded stress on the server. I will try to only connect the function to .Touched when appropriate, and prevent them from constantly moving when not needed.

P.S. thank you for posting that topic in documentation requests. It would be very helpful to have a detailed description of each bar and how to minimize it.