[PATCH] allow gzip compression while posting json

824 views
Skip to first unread message

pla...@acipia.com

unread,
Feb 4, 2014, 4:12:59 AM2/4/14
to open...@googlegroups.com
Hi list,

This is a very small patch against 2.0RC to allow HTTP client to use gzip compression while posting to api/put endpoint. As it is quite simple (thanks to netty) i just post it here rather that forking on github.

A 32 kbytes clear JSON file is easy to compress with gzip algorithm (32kb -> 1666 bytes), allowing putting more values in a single POST (20 times more). It is really helpful if you prefer some cpu cycles rather than many http exchanges, for example on high latency networks (umts, satelite etc).

A curl example :

$ gzip -9c clear-32k.json > gzip-32k.json

$ file gzip
-32k.json
gzip
-32k.json: gzip compressed data, was "clear-32k.json", from Unix, last modified: Thu Jan 16 15:31:55 2014

$ ls
-l gzip-32k.json
-rw-r--r-- 1 root root 1666 févr.  4 09:57 gzip-32k.json

$ curl
-X POST --data-binary "@gzip-32k.json" --header "Content-Type: application/json" --header "Content-Encoding: gzip" http://mytsdb1:4242/api/put?details
{"errors":[],"failed":0,"success":280}


Note that while aiming to allow GZIPed POST, all netty http pipeline is affected, so using gzip with other API endpoints is possible. It only allows compression in requets and doesn't modify TSDB response behaviour. The patch doesn't break clients without gzip and should be safe to use. We're using it for a couple of weeks without problem.

P
opentsdb-2.0-gzip-http-post.patch

ManOLamancha

unread,
Feb 10, 2014, 12:15:42 PM2/10/14
to open...@googlegroups.com
On Tuesday, February 4, 2014 4:12:59 AM UTC-5, pla...@acipia.com wrote:

This is a very small patch against 2.0RC to allow HTTP client to use gzip compression while posting to api/put endpoint. As it is quite simple (thanks to netty) i just post it here rather that forking on github.

Sweet, thanks! Would you mind signing http://opentsdb.net/contributing.html

Pierre Laden

unread,
Feb 13, 2014, 5:46:07 AM2/13/14
to open...@googlegroups.com
Done !

Kyle Brandt

unread,
Apr 15, 2014, 9:39:49 AM4/15/14
to open...@googlegroups.com
It doesn't look like this has made into next? gzip support would be nice...

ManOLamancha

unread,
Apr 15, 2014, 12:08:18 PM4/15/14
to open...@googlegroups.com
On Tuesday, April 15, 2014 9:39:49 AM UTC-4, Kyle Brandt wrote:
It doesn't look like this has made into next? gzip support would be nice...

Right, didn't make it into next unfortunately. I'll put it into 2.1 though. 

Kyle Brandt

unread,
May 27, 2014, 4:46:25 PM5/27/14
to open...@googlegroups.com
Any chance of getting this in "next" now?

ManOLamancha

unread,
May 30, 2014, 1:47:56 PM5/30/14
to open...@googlegroups.com
On Tuesday, May 27, 2014 4:46:25 PM UTC-4, Kyle Brandt wrote:
Any chance of getting this in "next" now?

Absolutely, I'll be working on the backlog this next week. 

Kyle Brandt

unread,
Jul 11, 2014, 9:26:03 AM7/11/14
to open...@googlegroups.com
Hi Chris,

Just wanted to ping you on this as a reminder, hoping to see it in 2.1.

Best,
Kyle

ManOLamancha

unread,
Jul 18, 2014, 12:25:01 PM7/18/14
to open...@googlegroups.com
On Friday, July 11, 2014 9:26:03 AM UTC-4, Kyle Brandt wrote:
Hi Chris,

Just wanted to ping you on this as a reminder, hoping to see it in 2.1.

Definitely want to get it in, keep reminding me :) Super swamped these next few weeks 

Kyle Brandt

unread,
Jul 29, 2014, 11:01:23 AM7/29/14
to open...@googlegroups.com
Reminder as requested :-) 

Also, someone put this in a PR: 

ManOLamancha

unread,
Aug 18, 2014, 9:28:19 PM8/18/14
to open...@googlegroups.com
On Tuesday, July 29, 2014 8:01:23 AM UTC-7, Kyle Brandt wrote:
Reminder as requested :-) 

Also, someone put this in a PR: 


Finally working again so I can take a look at this, thanks for pinging me :) 

ManOLamancha

unread,
Aug 22, 2014, 11:50:09 PM8/22/14
to open...@googlegroups.com
On Monday, August 18, 2014 6:28:19 PM UTC-7, ManOLamancha wrote:
On Tuesday, July 29, 2014 8:01:23 AM UTC-7, Kyle Brandt wrote:
Reminder as requested :-)

Finally posted it to 2.1 (next) today so you're good to go. Thanks!
Reply all
Reply to author
Forward
0 new messages