Optimization question

Options
rejwan
edited March 2012 in Photon Server
Hey few questions:
1. If I set a long\int ResponseParameter's IsOptional to true, will it still send it even if I hadn't set in a value? (I'm assuming it does send it, since it always have a value) - is it possible to somehow not send this parameter if it's value is 0?
2. Regarding peer to server pings, why is this necessary? If we have a non-real time application and we have no need to know the RTT/latency, is it possible to turn pinging off, or at the very least set PingIntervalMilliseconds to a very high value? (And if so, what is the maximum value I can give it?)
3. How are Hashtables sent out? If I set a hashtable to a null, will it send out anything?
4. Is there an easier way to find out how much data each operation/event sends out?

Thanks!
Ron

Comments

  • rejwan
    Options
    Forgot to ask another question:

    While using a packet sniffer, I've seen that even with 0 activity and PingIntervalMilliseconds set to 10,000, I see about 2-3 packets of data being sent back and forth from any connected peers.

    Why is this happening and how can I fix this?
  • Tobias
    Options
    1. IsOptional affects reference types only. Anything that's null will not be send. But in many cases you could completely skip the response, if it's not needed.

    2. Pings are used as keep-alive signal if nothing else is sent. You can increase their interval in the client by setting PhotonPeer.TimePingInterval (in ms). The server will send a ping as well in PhotonServer.config. Set the attribute "PingIntervalMilliseconds" in the "Instance1" node. Default is 1000 and the server will skip pings if other reliable communication is going on.
    You can't turn off pings, cause there would be no timeout anymore. I don't think there is a max value for ping intervals but the longer it is, the more it affects your timeouts.
    If you are not sending anything for several seconds, you could probably disconnect the client to save the bandwidth. You could implement an operation "hibernate" or so, to make the player be "online" for the next few seconds.

    3. Null can't be serialized with our protocol. The client, e.g. will use an empty Hashtable with 0 key/values instead in events. Server-side they can be attributed as IsOptional and left out this way.

    4. Not really. The client counts the incoming and outgoing bytes but there is no per-operation metric. The protocol doesn't work that way: Operations are wrapped in commands and those can be aggregated into a single package. Package overhead is reduced this way and can't be counted on a per Operation basis.

    5. The server has it's own, independent setting for ping interval. Maybe this was not changed.
  • Boris
    Options
    Tobias wrote:
    1. IsOptional affects reference types only. Anything that's null will not be send.
    You can also use nullable value types.
  • rejwan
    Options
    Hey Boris thanks for the response, I've set PingIntervalMilliseconds to 10,000 and apparently it's over the limit, since we're still seeing pings sent out every 1,000ms.

    I looked at the PDF explaining the various settings for the server, but I couldn't find the max value.
  • rejwan
    Options
    Still waiting for an answer on this - What's the max value I can set PingIntervalMilliseconds to?
  • Tobias
    Options
    As answered in the other thread: we still have to figure out if that's reproducible.
    Are you using UDP? TCP?
  • Old thread but completely on topic..

    In a request if I have an integral type (such as int, byte, etc) marked as 'IsOptional = true' and a request is sent without that value:

    1. Will the operation validate?

    2. If I try to access that member what will the value be?
  • To answer my own question:

    1. The operation will validate

    2. 0
  • Tobias
    Options
    Hehe. Sorry. I was off for GDC. Glad you found the answers anyways! :)