Using pprof to profile

Hi there,
Currently I am testing the performances of the server. And I see abnormal values using docker container -stats (or even top from the VM) concerning both the CPU, and the memory (I think I’m leaking in a match node). So I wanted to know if there’s is a workaround to use pprof with a go module (it’s my first time using pprof) or if there is another way to profile a go module.
Thanks in advance
Remi

So I wanted to know if there’s is a workaround to use pprof with a go module (it’s my first time using pprof) or if there is another way to profile a go module.

@androuin.remi That’s a great reminder we should make available pprof builds on Docker as part of our release process. Please can you open an issue on the repo for it as a feature request.

In the meantime I recommend you add prometheus to your Docker compose setup because it will enable you to see exported metrics about match handlers and a lot of other features of the game server. This will help you see if some logic in your code does not terminate match handlers and they’re left around. There’s an example here we’ve put together for how to include prometheus for metrics:

In the 2.10.0 release of the server we also added a new startup option called --match.max_empty_sec <value>. This server option will set a time in seconds for a match handler that has received no inputs to be shutdown by the game server. This is really a band aid though for scenarios where studios need time to find the root cause of their logic which needs to be updated to stop match handlers.

Don’t forget you can also look. at the Developer Console (accessible locally at http://127.0.0.1:7351) which shows counts of the number of active match handlers. This can be a good sanity check to know whether the matches are left running when they should be stopped in your match loop code.

Hope this helps.