Live data from Hacker News

Bandwidth needs halved by new compression written in Go

arstechnica.com

81–90 of 121 posts

Re: Bandwidth needs halved by new compression written in Go

#81

Earlier quoted context omitted.

Take a look at the various WAN accelerator appliances (Cisco, Silverpeak, Riverbed). They do almost exactly what it sounds like you want (if I'm remembering back to my evaluations, Cisco at least uses a multi-request dictionary for their compression)

I was going to mention Riverbed, glad someone else did. They've saved a huge amount for us (I think of 90%) of AJP (http tomcat) traffic. Not particularly difficult to set up.

Riverbed looks ideal but aren't they incredibly expensive? We looked at it years ago and I believe the necessary endpoints in our data center and in Singapore pushed past $140,000.

Re: Bandwidth needs halved by new compression written in Go

#82
post #40

Earlier quoted context omitted.

Is anyone aware of a performance analysis between SDCH and one of the dynamic compressions like deflate? I google, but all I find is people complaining their proxy/filter/appliance/diagnostic is breaking because it doesn't understand SDCH. It seems like SDCH has been around for 4 years, I presume the lack of data means it hasn't worked out. (I imagine that you could drastically reduce the CPU load of compression by m…

What you describe is exactly what I've been looking for. There are remarkably few resources on this. We have users in Singapore who access various XML-heavy web services in our NY office. A dictionary-style over-multiple-requests compression technique would be brilliant for their case.

Also see http://rproxy.samba.org/

Re: Bandwidth needs halved by new compression written in Go

#84
post #51

How large is the per site cache? Are cookies part of the hash (and if so how do you strip meaningless cookies)? Otherwise the this is more compelling for content sites like the referenced 4chan. But still very cool.

There isn't a per-site cache in Railgun because it's part of our large shared in-memory cache in our infrastructure. Currently, cookies are not part of the hash. We have customers of all types using Railgun. As an example, there's a British luggage manufacturer who launched a US e-commerce site last month. They are using it to help alleviate the cross-Atlantic latency. At the same time they see high compression level…

> What sort of sites do you think it doesn't apply to?

Single page webapps. In those cases the html/js is normally static and already CDN'ed and the data is a JSON API which varies on a per user basis.

There would be some gain as the dictionary would learn the JSON keys but I doubt it would be very dramatic vs deflate compared to the content sites referenced in the article.

Re: Bandwidth needs halved by new compression written in Go

#85

Earlier quoted context omitted.

That kind of fits Rob Pike's explanation for why Go isn't more popular with C++ programmers (although he gave it a negative spin). In a neutral way, it's like: if you spent all that effort mastering this language to get such fine-grained control, why would you give that up again? And really, I understand: why would you give that up? Especially if you know how to use C++ in a fairly painless way.

Do you have a link to that? I would be interested to read it. I also couldn't agree more, but normally, people retort with the Hammer and Screwdriver argument.

http://commandcenter.blogspot.de/2012/06/less-is-exponential...

Re: Bandwidth needs halved by new compression written in Go

#86
post #61

Earlier quoted context omitted.

Agree with you there on "profile first." But knowing jgrahamc, he did -- and I'd love to know the results.

:-) Yes, that's very true. Initially, I wasn't actually planning to do deltas for the compression technique and it was in testing with a whole bunch of common sites that I stumbled upon the fact that they don't change very much. That lead me to wonder about the algorithms that might be used. I did test quite a lot of stuff (and at one point thought I'd come up with a truly cool new algorithm only to realize that I wa…

Out of curiosity, can you say anything about the algorithm you are using?

A year or two ago I got quite interested in delta compression, read all the papers I could find on the topic, and eventually came up with an algorithm that seems pretty competitive, although I've mostly focussed on efficient compression rather than speed. Someday I'll get around to porting the code from Python to C and find out what the performance is really like.

For what it's worth, my code is here: https://gitorious.org/python-blip

Re: Bandwidth needs halved by new compression written in Go

#87

Earlier quoted context omitted.

I agree. The benefit of using Go is that it's fast to write and has good concurrency features. To give you an idea of the size, there are 7,329 lines of Go code in Railgun (including comments) and a 6,602 line test suite. In the process we've committed various things back to Go itself and at some point I'll write a blog on the whole experience, but one thing that made a big difference was to write a memory recycler s…

"write a memory recycler" sigh This is by far go's biggest wart IMO, and one that frequently sends me back to a pauseless (hah! at least less pausy:) systems language. I sure do like it in almost every other meaningful regard. But I wish latency wasn't something the designers punted on.

I occasionally hear this kind of complaint, but I've yet to see any silver-bullet memory management system. AFAICT, the best we've been able to accomplish is to provide a easier path to correctness with decent overall performance. Also, GC latency isn't the only concern. As soon as the magic incantation "high performance" is uttered, all bets are off.

There's been decades of work on real-time garbage collection yet all of those approaches still have tradeoffs. Consider that object recycling is a ubiquitous iOS memory management pattern. This reduces both memory allocation latencies and object recreation overhead. Ever flick-scroll a long list view on an iPhone? Those list elements that fly off the top are virtually immediately recycled back to the bottom -- it's like a carousel with only about as many items as you can see on screen. The view objects are continually reused, just with new backing data. This approach to performance is more holistic than simply pushing responsibility onto the memory allocator.

Memory recycling here also reminds me of frame-based memory allocator techniques written up in the old Graphics Gems books, a technique likewise covered in real-time systems resources. Allocating memory from the operating system can be relatively expensive and inefficient, even using good ol' malloc. A frame-based allocator grabs a baseline number of pages and provides allocation for one or more common memory object sizes (aka "frames"). Pools for a given frame size are kept separate, which prevents memory fragmentation. Allocation performance is much faster than straight malloc, while increasing memory efficiency for small object allocation and eliminating fragmentation. Again, this is a problem-specific approach that considers needs beyond latency.

Re: Bandwidth needs halved by new compression written in Go

#88
post #69

Earlier quoted context omitted.

I've never used go professionally and most of my spare time is split between C++ and Scheme at the moment, but when I did go spelunking with Go, I found it a breeze to write complicated functionality in it - it felt like C++, but easier and more initially powerful. I still feel that C++ is generally a better choice, but if I only had a short time to write something in, I would definitely go for Go.

I'm curious, if you can get things done more quickly in Go, why do you feel C++ is generally a better choice? Performance?

For me, I just don't see enough benefits of Go over C++. I already know how to use C++ in a way that avoids or mitigates the problems Go solves. With C++11 support starting to take off Go's advantages are even smaller.

On the other hand, if I didn't know C++ and I was looking for a native compiled language to learn, I'd probably choose Go over C++.

Re: Bandwidth needs halved by new compression written in Go

#89
Other than general traffic data compression, I've always been somewhat interested in html compression in particular.

I know lots of webservers zip their response data, but I was always curious about the things in html that show up very often and if there's a way to optimize around that.

For example, most web xml data contains a lot of common tags, like "div" and "span" and others that are specific to html. I think if you add them up, they might make up a considerable percent of traffic data. Is it possible for the web server to swap those out for a single character before it sends the data, and have the browser replace it when it arrives?

Or does zip compression already do that somehow?

Re: Bandwidth needs halved by new compression written in Go

#90

Other than general traffic data compression, I've always been somewhat interested in html compression in particular. I know lots of webservers zip their response data, but I was always curious about the things in html that show up very often and if there's a way to optimize around that. For example, most web xml data contains a lot of common tags, like "div" and "span" and others that are specific to html. I think if…

Yeees, no.

Zip will replace the common tags (like "div") with a single "div" (in the compression dictionary), then a single character every time it appears (more or less - it might be less than a single byte if it's a really common tag). So there'll be a wasted overhead of a dictionary of common tags (which is kind of wasted).

It would be more efficient if both the browsers and compression algorithms could agree (beforehand) had a dictionary of common terms which would be likely to appear in the document.

If you're compressing a lot of data which is likely to be similar, you can do this with a common dictionary. See - http://stackoverflow.com/questions/479218/how-to-compress-sm...

Of course, my answer on Stackoverflow is pretty crude. You could create a dictionary used to compress the compression dictionary. Google is probably going to do this any time soon (if they haven't already) since they control the client (Chrome), server (google web server) and protocol (SPDY).

Post reply on HN