mnot’s blog

Design depends largely on constraints.” — Charles Eames

Thursday, 3 June 2010

Why Our New TV Doesn't Like the Web

Filed under: Caching HTTP Web

A while back we used an absurd amount of reward points from our credit card to get some Myer gift certificates, and on the weekend these miraculously turned into a new TV, the Sony 32EX600.

Overall, we really like it; while I’m still trying to find the exact recipe to successfully encode video to feed to it via DLNA, it’s beautiful to look at, and (unlike most TVs these days), the UI is a pleasure to use.


One of the big selling features of the TV is that it offers “Internet Streaming” as well as DLNA. Basically, this means that it can stream directly from YouTube, the Onion, and a number of other places that will soon include back episodes of most programs on at least two major Australian networks.

That’s very cool, and kudos to Sony for making arrangements for content in the local market. However, actually using this feature from Australia — the same market they’re customising a TV for — is less-than-impressive.

That’s because every time you access one of these “Internet Streaming” channels, the TV makes not one but up to five SSL connections serially to a server in the US.

1275275765.332 1044 TCP_MISS/200 4157 CONNECT - DIRECT/ -
1275275766.432 1012 TCP_MISS/200 3845 CONNECT - DIRECT/ -
1275275767.456 905 TCP_CLIENT_REFRESH_MISS/200 4139 GET - DIRECT/ image/png
1275275767.836 1290 TCP_MISS/200 5036 CONNECT - DIRECT/ -
1275275769.276 1294 TCP_MISS/200 5139 CONNECT - DIRECT/ -
1275275771.066 1745 TCP_MISS/200 32170 CONNECT - DIRECT/ -

Since they’re serialised, it means we have to wait each time for the TCP connection to come up, the SSL context to be established, and the HTTP request and response to be received before you see a byte; hence the latencies of anywhere from about one to two seconds (second column, in milliseconds) from Australia, since their servers are in the US:

7 ( 188.653 ms 187.361 ms 187.985 ms
 8 ( 212.445 ms 211.550 ms 215.080 ms
 9 ( 200.850 ms 200.829 ms 200.435 ms
10 ( 201.915 ms 200.725 ms 201.477 ms
11 ( 201.194 ms 201.141 ms 201.253 ms
12 ( 191.396 ms 192.539 ms 191.285 ms
13 * * *

Which means it’s about five seconds before you see anything come up in this interface, despite the fact that there’s nothing personalised or particularly dynamic in the content. Ouch.

After that, you get a screen with a bunch of icons for different shows and/or episodes on it, but again the TV doesn’t want to play nicely; not only are many of the responses uncacheable, but the TV also sends Pragma: no-cache on everything:

Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive

…which results in a lot of cache misses:

1275275772.242 809 TCP_CLIENT_REFRESH_MISS/200 3043 GET - DIRECT/ image/jpeg
1275275772.276 906 TCP_CLIENT_REFRESH_MISS/200 4502 GET - DIRECT/ image/png
1275275772.337 909 TCP_CLIENT_REFRESH_MISS/200 5727 GET - DIRECT/ image/png
1275275772.882 1509 TCP_CLIENT_REFRESH_MISS/200 4388 GET - DIRECT/ image/jpeg
1275275773.213 1757 TCP_CLIENT_REFRESH_MISS/200 2901 GET - DIRECT/ image/jpeg
1275275773.491 2030 TCP_CLIENT_REFRESH_MISS/200 4355 GET - DIRECT/ image/jpeg
1275275773.887 366 TCP_CLIENT_REFRESH_MISS/200 3372 GET - DIRECT/ image/jpeg

…and so on. All up, it takes about twenty — yes, twenty — seconds to load a page with a few thumbnails on it.

It’s not just the TV’s fault, to be fair; the content providers are providing things like this — which as per above takes nearly a second to load from Australia, and is uncacheable. Looking at it in REDbot, we see why; they send Cache-Control: private, meaning that shared caches like mine can’t store this static, non-personalised image.

It’s possible to fix some of these problems in Squid, luckily. The recipe I have so far is:

refresh_pattern ^http://ssm\\.tv/BIVL/icons/ 2880 50% 10800 ignore-reload
refresh_pattern ^http://brevia\.condenet\.com/.*\.jpg 2880 50% 10800 ignore-reload
refresh_pattern ^http://treb\.internet\.sony\.tv/content/thumbs/ 2880 50% 10800 ignore-reload
refresh_pattern ^http://www\.videodetective\.net/utils/dynamicthumb.aspx 2880 50% 10800 ignore-private override-expire ignore-reload
refresh_pattern ^http://images\.onnetworks\.com/ 2880 50% 10800 ignore-reload

Here, you can see the ignore-reload option which tells Squid to ignore the TV’s Pragma: no-cache, as well as ignore-private for the videodetective URLs.

Of course, I shouldn’t have to do this, and to really improve things, Sony needs to use something other than that dance of CONNECTs to view content; making multiple serialised SSL connections from halfway around the world is just not good user experience.


Subbu Allamaraju said:

Atleast they used GETs! When I last checked, the bing app on IPhone uses POST+POX. There are others like that - no matter what - they won’t get it.

Thursday, June 3 2010 at 11:14 AM

Steve Clay said:

With your squid rules, how much faster is it?

Friday, June 4 2010 at 11:28 AM

daniel.haxx said:

Just a little curiosity:

The look of that HTTP request (including the pragma) does match libcurl’s request exactly (as in contents and order of headers) as how it used to do it…

Friday, November 12 2010 at 5:45 AM

Creative Commons