how to change the client's Source Port? MS Azure LB q

Options
mindlube
edited October 2013 in Photon Server
I cant see a way to change the Source port in the API. In the C# client, I would like to add some entropy to the connection requests.

Background on this is I noticed the MS Azure load balancing was not round-robining the requests from my development & test environment. I opened a ticket on Azure, and the explanation is as follows. I would feel better if I could set the Source Port, and ensure that their load balancer is doing what it's advertised to do.
The following is from a microsoft support tech:
Just to clarify, how the LB on Azure VM works:

The LB happens based on the tuplets, so if one client is using the same source port then their traffic will not be round robined.

Typically when we see the report of this issue it is in the context of HTTP traffic and the majority of the customer see uneven load because.

It can be explained due to they are using a stress test client on-premise and the stress-test client is not closing and reopening the TCP connection, so all HTTP traffic will continue to be sent over the same TCP connection to the same instance.

Once if it will be possible to change the test to close the connection for each HTTP request (either on client side or server side) then will be possible to see even load.

UDP is a little different, but the same concept will apply – if your test client is using the same source port for UDP traffic then you will not be load balanced.

You can check this discussion over here: http://stackoverflow.com/questions/1954 ... 6#19549726.

The method that the load balancer on Azure works uses is formed by the tuplets.
Each tuplet is formed by Source IP, Source Port, Destination Port and Protocol.

To be load balanced a new tuple have to be formed and like was explained before will be necessary to test the ports using a client side method that will be closing the connection and reopen, this way the tuple will be respect and the load balancing will be happening.

If you will be interesting in continuing to dig this, the only way to check if it is executing or not will be collecting the network traces for both sides and try to find the pattern described above on the connections. (Source IP, Source Port, Destination Port and Protocol).

Comments

  • Hi mindlube,

    thanks for the interesting information. The source port (in client as well in Photon's server-to-server connection) is random (a dynamic port), so it's currently not possible to set it manually. Sorry.
  • Hey Nicole! No worries & you are correct. I just confirmed it, not sure why I didnt try this before. [1] Photon is already randomizing the source port. So I guess the Azure load balancing doesn't work exactly as described, or my office router is messing with the port numbers. Azure LB does round-robin when I connect from different public IPs. So that's fine enough for my needs.

    [1] this shows photon's connection after I start/stop the game client each time. The source port appears to be random and in the 50-60k range.
    [code2=bash]$ netstat | grep 138.91.72.154
    udp4 0 0 10.0.1.106.50390 138.91.72.154.unot
    $ netstat | grep 138.91.72.154
    udp4 0 0 10.0.1.106.53905 138.91.72.154.unot
    $ netstat | grep 138.91.72.154
    udp4 0 0 10.0.1.106.62637 138.91.72.154.unot
    $ netstat | grep 138.91.72.154
    udp4 0 0 10.0.1.106.50019 138.91.72.154.unot[/code2]