4

I am sharing keyboard and mouse between my Linux desktop and MacBook Air using Synergy. There is a very noticeable lag every time I begin moving my mouse (or start typing), but everything becomes smooth as long as I don't stop moving the mouse (or typing).

After looking at the packet dump on both ends, it seems like the synergy server starts sending out TCP packets almost immediately, but the synergy client doesn't start receiving them until much later (e.g. 288ms in one case).

Could my wireless router be buffering the initial packets (somewhat similar to Nagle's algorithm in TCP)?

My setup

  • Wireless Router: NetGear WNDR3300
  • Linux desktop running synergy server to share its keyboard and mouse
    • Ethernet connection to the router (192.168.1.13)
  • MacBook Air laptop running synergy client
    • Wireless connection to the router (192.168.1.16)
  • Ping time: 1ms to 3ms
  • Synergy version 1.4.10

Details

Looking at the packet dumps below, we can see that the server starts reporting mouse movements at 09:58:02.782 (packets #69135-69144) but receives the first ack only 288ms later at 09:58:03.070 (packet #69146). In fact, the server even retransmits its updates in packet #69145 before getting the first ack.

On the other hand, the client only starts receiving updates at 09:58:03.069. This implies a 288ms latency, but the latency goes down significantly as more packets are exchanged.

Server Packet Dump

No.     Time            Source                Destination           Protocol Length Info
  69135 09:58:02.782930 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235851 Ack=159785 Win=114 Len=12 TSval=22033564 TSecr=1176772351
  69136 09:58:02.790841 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235863 Ack=159785 Win=114 Len=12 TSval=22033566 TSecr=1176772351
  69137 09:58:02.799139 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235875 Ack=159785 Win=114 Len=12 TSval=22033568 TSecr=1176772351
  69138 09:58:02.806898 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235887 Ack=159785 Win=114 Len=12 TSval=22033570 TSecr=1176772351
  69139 09:58:02.815360 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235899 Ack=159785 Win=114 Len=12 TSval=22033572 TSecr=1176772351
  69140 09:58:02.823324 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235911 Ack=159785 Win=114 Len=12 TSval=22033574 TSecr=1176772351
  69141 09:58:02.831131 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235923 Ack=159785 Win=114 Len=12 TSval=22033576 TSecr=1176772351
  69142 09:58:02.839354 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235935 Ack=159785 Win=114 Len=12 TSval=22033578 TSecr=1176772351
  69143 09:58:02.846889 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235947 Ack=159785 Win=114 Len=12 TSval=22033580 TSecr=1176772351
  69144 09:58:02.855029 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=235959 Ack=159785 Win=114 Len=12 TSval=22033582 TSecr=1176772351
  69145 09:58:03.025003 192.168.1.13          192.168.1.16          synergy  186    [TCP Retransmission] 24800 > 60966 [PSH, ACK] Seq=235851 Ack=159785 Win=114 Len=120 TSval=22033625 TSecr=1176772351
  69146 09:58:03.070263 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159785 Ack=235863 Win=8191 Len=0 TSval=1176774186 TSecr=22033564
  69147 09:58:03.070519 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159785 Ack=235875 Win=8190 Len=0 TSval=1176774186 TSecr=22033566
  69148 09:58:03.070530 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159785 Ack=235887 Win=8191 Len=0 TSval=1176774186 TSecr=22033568
  69149 09:58:03.071303 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159785 Ack=235887 Win=8192 Len=8 TSval=1176774186 TSecr=22033568
  69150 09:58:03.071322 192.168.1.13          192.168.1.16          TCP      66     24800 > 60966 [ACK] Seq=235971 Ack=159793 Win=114 Len=0 TSval=22033636 TSecr=1176774186
  69151 09:58:03.073834 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235899 Win=8191 Len=0 TSval=1176774187 TSecr=22033570
  69152 09:58:03.073854 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235911 Win=8190 Len=0 TSval=1176774187 TSecr=22033572
  69153 09:58:03.074433 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235923 Win=8189 Len=0 TSval=1176774187 TSecr=22033574
  69154 09:58:03.074452 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235935 Win=8189 Len=0 TSval=1176774187 TSecr=22033576
  69155 09:58:03.074459 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235947 Win=8188 Len=0 TSval=1176774187 TSecr=22033578
  69156 09:58:03.074464 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235959 Win=8187 Len=0 TSval=1176774187 TSecr=22033580
  69157 09:58:03.074468 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=159793 Ack=235971 Win=8186 Len=0 TSval=1176774187 TSecr=22033582
  69158 09:58:03.074483 192.168.1.13          192.168.1.16          synergy  150    24800 > 60966 [PSH, ACK] Seq=235971 Ack=159793 Win=114 Len=84 TSval=22033637 TSecr=1176774187
  69159 09:58:03.074490 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159793 Ack=235971 Win=8192 Len=8 TSval=1176774187 TSecr=22033582
  69160 09:58:03.074499 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159801 Ack=235971 Win=8192 Len=8 TSval=1176774187 TSecr=22033582
  69161 09:58:03.074550 192.168.1.13          192.168.1.16          TCP      66     24800 > 60966 [ACK] Seq=236055 Ack=159809 Win=114 Len=0 TSval=22033637 TSecr=1176774187
  69162 09:58:03.075162 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159809 Ack=235971 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
  69163 09:58:03.075177 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159817 Ack=235971 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
  69164 09:58:03.075188 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=159825 Ack=235971 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
  69165 09:58:03.075191 192.168.1.16          192.168.1.13          TCP      66     [TCP Dup ACK 69164#1] 60966 > 24800 [ACK] Seq=159833 Ack=235971 Win=8192 Len=0 TSval=1176774189 TSecr=22033625

Client Packet Dump

No.     Time               Source                Destination           Protocol Length Info
   5020 09:58:03.069606000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17603 Ack=11921 Win=114 Len=12 TSval=22033564 TSecr=1176772351
   5021 09:58:03.069662000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17615 Ack=11921 Win=114 Len=12 TSval=22033566 TSecr=1176772351
   5022 09:58:03.069753000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17627 Ack=11921 Win=114 Len=12 TSval=22033568 TSecr=1176772351
   5023 09:58:03.069791000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11921 Ack=17615 Win=8191 Len=0 TSval=1176774186 TSecr=22033564
   5024 09:58:03.069792000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11921 Ack=17627 Win=8190 Len=0 TSval=1176774186 TSecr=22033566
   5025 09:58:03.069849000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11921 Ack=17639 Win=8191 Len=0 TSval=1176774186 TSecr=22033568
   5026 09:58:03.070526000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11921 Ack=17639 Win=8192 Len=8 TSval=1176774186 TSecr=22033568
   5027 09:58:03.070674000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17639 Ack=11921 Win=114 Len=12 TSval=22033570 TSecr=1176772351
   5028 09:58:03.070678000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17651 Ack=11921 Win=114 Len=12 TSval=22033572 TSecr=1176772351
   5029 09:58:03.070679000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17663 Ack=11921 Win=114 Len=12 TSval=22033574 TSecr=1176772351
   5030 09:58:03.070680000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17675 Ack=11921 Win=114 Len=12 TSval=22033576 TSecr=1176772351
   5031 09:58:03.070681000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17687 Ack=11921 Win=114 Len=12 TSval=22033578 TSecr=1176772351
   5032 09:58:03.070682000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17699 Ack=11921 Win=114 Len=12 TSval=22033580 TSecr=1176772351
   5033 09:58:03.070682000 192.168.1.13          192.168.1.16          synergy  78     24800 > 60966 [PSH, ACK] Seq=17711 Ack=11921 Win=114 Len=12 TSval=22033582 TSecr=1176772351
   5034 09:58:03.070799000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17651 Win=8191 Len=0 TSval=1176774187 TSecr=22033570
   5035 09:58:03.070799000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17663 Win=8190 Len=0 TSval=1176774187 TSecr=22033572
   5036 09:58:03.070800000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17675 Win=8189 Len=0 TSval=1176774187 TSecr=22033574
   5037 09:58:03.070800000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17687 Win=8189 Len=0 TSval=1176774187 TSecr=22033576
   5038 09:58:03.070801000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17699 Win=8188 Len=0 TSval=1176774187 TSecr=22033578
   5039 09:58:03.070834000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17711 Win=8187 Len=0 TSval=1176774187 TSecr=22033580
   5040 09:58:03.070835000 192.168.1.16          192.168.1.13          TCP      66     60966 > 24800 [ACK] Seq=11929 Ack=17723 Win=8186 Len=0 TSval=1176774187 TSecr=22033582
   5041 09:58:03.070944000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11929 Ack=17723 Win=8192 Len=8 TSval=1176774187 TSecr=22033582
   5042 09:58:03.071374000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11937 Ack=17723 Win=8192 Len=8 TSval=1176774187 TSecr=22033582
   5043 09:58:03.072831000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11945 Ack=17723 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
   5044 09:58:03.073123000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11953 Ack=17723 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
   5045 09:58:03.073432000 192.168.1.16          192.168.1.13          synergy  74     60966 > 24800 [PSH, ACK] Seq=11961 Ack=17723 Win=8192 Len=8 TSval=1176774189 TSecr=22033582
   5046 09:58:03.073561000 192.168.1.13          192.168.1.16          synergy  186    [TCP Retransmission] 24800 > 60966 [PSH, ACK] Seq=17603 Ack=11921 Win=114 Len=120 TSval=22033625 TSecr=1176772351
   5047 09:58:03.073599000 192.168.1.16          192.168.1.13          TCP      66     [TCP Dup ACK 5045#1] 60966 > 24800 [ACK] Seq=11969 Ack=17723 Win=8192 Len=0 TSval=1176774189 TSecr=22033625
10
  • TCP sucks over Wi-Fi, deal with it.
    – BatchyX
    Feb 16, 2013 at 20:23
  • @BatchyX: If you read my question, this does not appear to be a TCP issue. Server is transmitting the packets but the client is not receiving them right away. I don't see how TCP vs UDP vs ICMP would make any difference.
    – mtoossi
    Feb 16, 2013 at 20:27
  • How are the client and server clocks synchronized ? via NTP ? Is the laptop running on batteries (or more precisely, is powersave enabled on the wifi interface ?) Is the channel congested by other stations ?
    – BatchyX
    Feb 16, 2013 at 21:05
  • @BatchyX: Yes, the clocks are synchronized via NTP. You can also see the lag decreasing as more packets are exchanged which cannot be explained by clock skew. The laptop was on power during the above test (could power saving still be enabled for wifi when on power adapter?). There are no other machines connected to the router and no heavy downloads are running.
    – mtoossi
    Feb 16, 2013 at 21:15
  • well, power saving could still be enabled when on power adapter, that really depends on the driver and/or OS. Powersaving means the AP will buffer frames while the laptop's card is sleeping, and when the card wakes up, it will requests the pending frames. Depending on which of the 20 wifi's powersave scheme is used, the laptop's card may be required to wake up every DTIM interval, which is a multiple of the beacon interval, and 100ms is a common beacon interval. And when i mean 'congested channel', i mean congested by other wifi networks using the same channel.
    – BatchyX
    Feb 16, 2013 at 21:29

1 Answer 1

2

I just found yesterday that setting a very low beacon interval on your wireless router can solve the choppiness.

For me packets were arriving in a garbled order causing Czech accented vowels (perhaps in longer packets) to come earlier or later than the surrounding consonants.

I have changed the beacon setting from 100ms to just 5ms although 10ms should be enough (you need to keep your wireless cards on the Synergyied-machines busy to prevent them from sleeping).

I would like to warn everyone about these drawbacks to this solution:

  • I did not research the security implications of sending a wireless beacon much more often (even though mine is a WPA2 situation). Perhaps such an AP can be broken into faster.
  • Preventing wireless clients from sleeping can draw more power from their batteries (for ex.: phones).
  • Sending the beacon too often can decrease the useful throughput of the wireless network (needs more testing).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .