How to reduce latency?

(C Chen) #1

I am wondering if anybody has any suggestion on how to tweak a home network to reduce latency, without buying new hardware or upgrading my internet connection.

I have a somewhat slow internet connection (advertised download 1Mbps and upload 384 Kbps). I use wifi for my mobile.

When I use the SmartThings App to turn on/off my lights, I noticed that if I am only browsing web pages, the response is immediate. If I have one youtube or downloading going on, then the delay is about 1 second; if I have two, then about 2 seconds; and so on…

I have tried to set QoS in my wireless router (WRT54G) to tell it to give higher priority to the port my hub is connected to and also to give my mobile device (based on its MAC) higher priority. However, that doesn’t seem to have any impact. Perhaps setting QoS is not effective for burst transmissions. It is more for gaming.

I don’t see any QoS setting in my DSL modem so I don’t think I can adjust anything there (and I doubt there is a way for me to control incoming QoS at that point anyways).

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

I am following this topic.

I think some deep network activity tracing is required to pin down the latency causes and see if QoS config could help.

My response time varies too, but I feel it is external to my LAN… but haven’t proven that.

(C Chen) #3

I haven’t had time to find out how to do network traffic analysis. However, I am 95% sure my bottleneck is at traffic coming in into my DSL modem since I was able to reproduce the ‘N downloads -> ~N sec delay’ several different times. And I usually only have one computer, the ST hub, and my mobile connected to my network, so there shouldn’t be any unexpected/unknown traffic there.

Trouble is, I don’t think there is anything I can do to that side of the modem. I looked at several possibilities:

  • packet header QoS: this one seems to be more for intranet and requires the whole network to be set up to support it;
  • ask my ISP to give traffic from/to certain addresses higher priority: no way;
  • set my modem to give traffic from/to certain addresses higher priority: not on my 5+ year old one; and I don’t see any firmware update for it. And I am not even sure if the ST packets all use a single ip.

(Andrew Urman) #4

This may be a cool thing to test. The hub takes very little network traffic, kilobytes. I think the hangup may be in the data the mobile OS needs. Be it iOS or Android. If you have a multi sensor and an outlet setup the SmartApp “Let There Be Light” which will turn the outlet on when the multi is open, and turn it off when it is closed. Using that, you can test to see if you’re seeing the same latency when switching an outlet than you were with the app.

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5


Interesting observation…

As you know, there is a difference between latency (time of responses; e.g., ping) and bandwidth (amount of traffic).

I don’t know how much the various ISP’s and their data plans vary in latency. Does Quality of Service options help with this if you have a lot of local traffic? Or does QoS send more packets through for high priority items / devices?

Regardless: If you think that the problem may be the Mobile OS (Client UI), then this is a “bigger deal” in a way, because this client may frequently be run over 3G cellular network, where speeds are usually MUCH slower than home ISP (cable, DSL).

(C Chen) #6

@urman: Using “Let There Be Light” seems to take 2 ~ 4 times longer than tapping the App, with QoS either enabled or disabled.

Also, when I don’t have any download going on, the response using App is immediate, but “Let There Be Light” takes about 1 sec after I open the contact.

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #7

I definitely experience quite inconsistent response times (in both UI and SmartApps), despite my strong ISP connection (Comcast Cable

I have not been able to strongly correlate this latency with any particular factors; except possibly latency on average is shorter outside of peak daytime “business hours”.

Just now, for example, with a consistent non-trivial amount of activity through my internet, “Let There Be Light” takes about 1 second from contact open to light on (with updates on the iOS UI showing up during the process as expected).

But if I do this test repeatedly, I will – not infrequently (i.e., more often than rarely) – experience a delay of 5 seconds or even 10 seconds. The iOS UI doesn’t show the contact opening (or closing…), so the delay is from the trigger signal, not the switch activation by the SmartApp… I think.

Anyway: I have tried variations of this in the IDE, with debug console prints and cross-examining the event logs: It does confirm the latency between certain events at times. But inconclusively random and difficult to repeat (though … sometimes it does appear to repeat: I have hints that some delay issues are due to particular function calls in some SmartApps).

Of course, unless there is frequent slow response across multiple switches or Apps, I don’t have the time to escalate or further investigate. Yet there are “enough” cases of lag that I have some underlying concern – and reinforcement of my concern that the SmartCloud is involved in even the most basic logic (i.e., I’m waiting with bated breath for the “hard-wiring / caching” of some logic down into the SmartHub where possible).

I will raise a case with Support if I come upon reproducible scenarios.

(Solardave1) #8

I’m seeing latency across my wifi network as a whole which I’m attributing to the fact that I’ve spent the last 2 days doing wifi ip camera testing and I’ve got half a zillion up and running. I just spoke to the nice folks at Almond halfway around the world somewhere and I think segmenting LANS, 2 routers/different channels and dedicating one to the Cameras and the others HA and everything else might be a solution but not sure what will happen when I try to bridge them. That streaming video absolutely EATS up bandwidth.

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #9

@solardave1… What is your job and who do you work for? :-\