correct placement of Threads entities in the server config?

Options
mindlube
edited December 2012 in Photon Server
I am having trouble figuring out if my load is actually running on very many server cores. Is this the correct layout for the server config for the threads?

<Configuration>
<Default ...>
<ThreadPool
InitialThreads="4"
MinThreads="4"
MaxThreads="4">
</ThreadPool>

<ENetThreadPool
InitialThreads="4"
MinThreads="4"
MaxThreads="4">
</ENetThreadPool>

<IOPool NumThreads="4">
</IOPool>


<UDPListeners>
<UDPListener
...
</UDPListener>

... etc.

</UDPListeners>
... etc.
</Default>
</Configuration>

edit: I am asking about the XML. I understand the the number "4" would depend on how many actual cores I have. Like for 8 cores, maybe I would put 16 threads.

Comments

  • Philip
    Options
    In our experience there is little gain in changing our defaults:
    - iopool 2
    - businesspool 4
    - enet 2

    which are the best values we've found for 4 and 8 core machines.

    In general Workload tends to spread quite evenly on all cores.

    Assuming your application behaves in a way where workload doesn't spread evenly you can have a look at the photon performance counters "Photon Socket Server: Threads and Queues". And check if you have avg processing threads = active threads - if you do increasing the number of threads in that group (business, io, enet) might help.

    Note: when you do load testing
    - don't create load on the same machine you are stressing and
    - try to use more / bigger machines for the client-side (load-creating side).
    - monitor your client machines and try not to hit max cpu (keep lower than 80%)
    - monitor your network load
    - assuming you are using Udp, check the performance counter Enet/reliable commands resent per second, if you see that it is high, you might be overloading your clients and/or your network. To give you a hint on "normal" numbers of a gameserver - in the cloud a gameserver at 40000 commands/sec (10000 reliable) we see around 500 resends per second.
  • Philip
    Options
    To your original question ... they are defined per Instance:

    <Default
    EnablePerformanceCounters = "true"
    ...
    MaximumTimeout="30000">

    <ThreadPool
    InitialThreads="4"
    MinThreads="4"
    MaxThreads="4">
    </ThreadPool>

    <ENetThreadPool
    InitialThreads="2"
    MinThreads="2"
    MaxThreads="2">
    </ENetThreadPool>

    </Default>
  • Thanks Philip for the suggestions. I should add something I discovered which is really obvious in retrospect:

    close baretail and dont have a lot of messages being written by photon to DEBUG or INFO loglevel! that will slow down the server quite a lot, and prevent cpu cores from being fully utilized.
  • Tobias
    Options
    Oh, yes, that's really taking away a lot of performance!

    We made sure the log levels are used efficiently. When you change it via log4net.config (even at runtime), you can reduce overhead from "writing a lot of logs" to "just a few byte-value comparisons".