How to profile the server?

edited June 2012 in Photon Server
Hi there,

As our project is near the beta release, we'd like to be able to do some profiling on our server. I just tried the trial of the ANTS performance profiler 7.2, but it gives me no real results.

Have you ever tried how to profile an application in the PhotonSocketServer? Which application did you use? Is there a way to get it working correctly?

Kind Regards


  • You would use the performance counters normally.

    I've tried to profile things beyond that but not as indepth as it would likely be required to give indepth analysis on the problems but I back then had little success due to the .net code being only a 'script layer' running on top of a unmanaged core that handles it. Unsure if its possible to even profile that reasonably without sources to all sides of the equation, even more so cause the server runs in multiple threads spawned from outside your reach etc but there might be profiler that perhaps can handle that without resulting in garbage data
  • I believe coeing specifically means Code & Memory Performance profilers.. (not networking / bandwidth / photon performance). I would also like to know if anyone has had luck using any .Net code profilers on a Photon Server.

    Ive tried Redgate ANTS, dotTrace, and Telerik's profiler (on the PhotonSocketServer.exe process), but none of them seem to be able to get sample/method data for our server code.
  • The problem is that there is no pure .net application, as such any direct profiling will fail out of the box as there is no .net process you can hook into, only the native code one which manages the .net 'scripting layer'

    You would need one which you can remote connect to (similar to the way the VS debugger works) with the profiler running within your photon application in some way, as part of it.
  • Sounds like a real problem to me, as easy performance and memory profiling is an important issue in development. I hope some of the developers read this thread, so we can get an official answer if this problem is known and if there is or will be a workaround.

    Like helius I tried two profilers already (ANTS and dotTrace) and could connect to the PhotonSocketServer.exe process, which was listed as a .NET 2,4 process. Furthermore I got some samples out of the code, but only a few, which looks really odd.
  • I fully understand the reasoning behind it so no problem on that end.
    Though the code performance side will likely be a pain in all cases as this is no single thread or even simple threaded environment with its retlang core but an environment basing on quite a lot of parallel stuff and even concurrent application domains so how usefull a code performance profiler is and ever will be is a thing thats beyond my current expertise as I've not worked with profilers for quite some time so I'm out of touch with them (Unity does not work with them to my knowledge and experience and WP lacks most of the things required to hook in profilers and unit tests at all)

    That you get some is a good sign that its possible to get stuff out there, the question is what kind of informations do you get?
    Whats missing?

    The question targets at the question: How well do those profilers work with many distinct application domains and threads (potentially even sub processes) within a single process, do they allow you to select the desired domain etc so you can even profile what you want? (each photon application results in an own application domain when running)

    Did you setup your own configuration here to ensure that only your application is present in the configuration at all to lower the app domain problem potentially? (If its not a flash - silverlight - unity webplayer project you can even kick out the policy server bringing you down to a single app domain)

    This is one of the cases where it would have been great if ExitGames at least finished and released their pure .NET attempt even if its useless for production.
  • Thanks for your answer, dreamora.

    The profilers I named are very professional tools and can handle multiple threads without any problems. So I don't think on profiler side there will be any problems.

    You're right, Unity doesn't work with these profilers as well. But they knew about the urgence to have a possibility for profiling, so there's an integrated profiler in the Pro version of Unity. It's not as perfect as the third party tools, but it helps.

    The profiling results I got where very confusing. I got some samples from our application which runs inside Photon, but I got only one frame or so. So it's not really useful. I'll try it some more time today and will post the results if I got any.

    We only run one application inside Photon which has multiple DLLs. I'll check our configuration, maybe there's some setting which makes a difference.
  • We've had marginal success with dotTrace and profiling photon as a service. Using the photon control, we install our instance as a service.. then use the profiler to launch that service.. The sampling seems to have more data than just attaching to the process. You can also use tracing & line-by-line profiling with this method.

    Though, we still see 80-90% of the samples in 'unknown' call stacks and methods.
  • Bump,
    have there been any updates on the best ways to do profiling?
  • hi, @tab_key


Sign In or Register to comment.