Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How to avoid TCP bursting data over WebSocket ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 maunovaha   Members   -  Reputation: 279

Like
0Likes
Like

Posted 16 March 2014 - 03:42 PM

Hi,
 
I am currently trying to simulate varying network connection conditions locally so that I could see how does interpolation works when developed, which sort of led me to this question.
 
As a background, I tried to use dummynet first but I got frustrated with installation process and got it working only partially (on windows 7). It froze my machine once and my normal internet connection stopped working after a while tongue.png  .. So I ended up using tool called "clumsy" (http://jagt.github.io/clumsy/) which seems to be ok-ish. I tested how does setting latency to 2000ms works and pinging google.. works as expected.
 
However, the actual problem I am facing is when using node.js servel locally and trying to use that same 2000ms for testing.
 
My current server sends every 100ms packet to client which is marked with Date.now() (as current ms). At client I print results to console, which seems to be as following (clumsy is not activated, normal conditions):
from server to client (ms): 113 last packet processed (ms ago): 113 
from server to client (ms): 128 last packet processed (ms ago): 110
from server to client (ms): 144 last packet processed (ms ago): 108
from server to client (ms): 157 last packet processed (ms ago): 107 

Printing it with this: (where result.net.now is the Date.now() at server packet)

 

console.log("from server to client (ms): " + (Date.now() - result.net.now) +
          " last packet processed (ms ago): " + (Date.now() - this.prevTime));

this.prevTime = Date.now();

 

This looks OK, from server to client e.g. 113 ms and last packet processed 133ms ago
 
However, when I activate the tool to use 2000ms lag with this configuration: (using Outbound only which results that sending to server and sending to client, both sides is having this 2000ms lag) 
 
tcp and outbound and ip.DstAddr >= 127.0.0.1 and ip.DstAddr <= 127.255.255.255

..and then starts to happen some interesting issues, it logs this at client side (same for server tbh):

 

from server to client (ms): 2068 last packet processed (ms ago): 119
from server to client (ms): 2053 last packet processed (ms ago): 80
from server to client (ms): 2081 last packet processed (ms ago): 120
from server to client (ms): 2109 last packet processed (ms ago): 122

It seems that e.g. 2068 seems to be OK but ms ago is not? My character can move every 100ms (btw).

 

If I watch how it behaves it seems for me that its bursting packets at once at both sides of the connection.

 

To my eyes it looks like that client/server sides first waits 2000ms and then every 100ms it shows what has happened because then it actually received the packet.

 

I dont know if this is because of TCP or because the tool is not working? Or my codes is not working, bad configs for node.js? Does anyone have any opinions on this, am I missing something relevant or doing something completely wrong with the tool.

 

I though that following would have happened: If 4 packets are sent, every 2000ms one packet is received?

 


Edited by maunovaha, 16 March 2014 - 03:47 PM.


Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5692

Like
0Likes
Like

Posted 16 March 2014 - 03:52 PM

Have you turned off Nagle (TCP_NODELAY)?

Also, it's very hard to understand what piece in your network stack may be changing the behavior. To make sure you're not seeing locally induced problems (scheduling, etc) it's always best to put the client on a separate physical machine from the server. And, ideally a machine that has highly configurable networking built-in, such as Linux or BSD, so that applying network filters etc is well documented, not using "third party" tools of undetermined mechanism.
enum Bool { True, False, FileNotFound };

#3 maunovaha   Members   -  Reputation: 279

Like
0Likes
Like

Posted 16 March 2014 - 04:17 PM

Have you turned off Nagle (TCP_NODELAY)?

Also, it's very hard to understand what piece in your network stack may be changing the behavior. To make sure you're not seeing locally induced problems (scheduling, etc) it's always best to put the client on a separate physical machine from the server. And, ideally a machine that has highly configurable networking built-in, such as Linux or BSD, so that applying network filters etc is well documented, not using "third party" tools of undetermined mechanism.

 

Thnx for the reply, I have plans to push it to places such as amazon or heroku but configs not quite there yet, could also introduce too much new problems at this stage. Trying to do this locally thats why.. at least for now :) . TCP_NODELAY, should be turned off by default with node, according to docs:

 

http://nodejs.org/api/net.html#net_socket_setnodelay_nodelay

 

The thing is, that it wont burst if tool is not activated, or maybe everything is too fast to notice it.. I doubt it actually.



#4 hplus0603   Moderators   -  Reputation: 5692

Like
0Likes
Like

Posted 17 March 2014 - 09:45 AM

So it sounds like the tool is introducing the burstiness.

Do you have a second machine to use as the server while developing? An old laptop or desktop can typically easily run Linux or BSD and would in my experience give you better networking tools.
enum Bool { True, False, FileNotFound };

#5 maunovaha   Members   -  Reputation: 279

Like
0Likes
Like

Posted 17 March 2014 - 11:20 AM

So it sounds like the tool is introducing the burstiness.

Do you have a second machine to use as the server while developing? An old laptop or desktop can typically easily run Linux or BSD and would in my experience give you better networking tools.

 

Not right now sad.png I guess I need to find some alternative tool for win 7 in order to validate that its not a tool specific issue.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS