Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRemote read/write interfaces use Snappy when they probably shouldn't #2692
Comments
This comment has been minimized.
This comment has been minimized.
|
Hi there - we chose snappy intentionally, as a trade off between compression ratio and cpu usage. It was out intention that this should work across languages.
This was suggested in issue #2522. I think this header is correct - the body is protobuf - but we should probably also send
This is concerning. Snappy is supposed to be cross language! Do you some code I can use to reproduce this? if this is indeed true then its a bug in the upstream snappy library IMO. |
This comment has been minimized.
This comment has been minimized.
|
It seems you are not the first person to notice this: xerial/snappy-java#175 I've reproduced the issue with a pair of simple test programs here: https://github.com/weaveworks-experiments/prometheus-benchmarks/tree/master/cmd/snappy |
This comment has been minimized.
This comment has been minimized.
|
https://github.com/eapache/go-xerial-snappy seems to imply the problem is on xerials end. |
This comment has been minimized.
This comment has been minimized.
|
Right, I think the problem is that snappy doesn't specify a streaming format, so each library has their own. I can't find a java library that is compatible with golang/snappy's framing format. I suggest we remove the framing format (we have all the data in memory) and just send the unframed snappy. |
This comment has been minimized.
This comment has been minimized.
|
And the content-encoding header has already been added: 3f23aa2 |
This comment has been minimized.
This comment has been minimized.
|
I didn't know about Snappy's framing format. https://github.com/google/snappy/blob/master/framing_format.txt says,
...so I think you're right that we have to omit the framing and use |
This comment has been minimized.
This comment has been minimized.
|
Yeah its a bit... weird. Even worse, the golang reader/writer can't read the non-framed encoding. So we'll need to bump the remote read/write version header, and detect it using that. PR incoming. |
tomwilkie
referenced this issue
May 9, 2017
Merged
Compress remote storage requests and responses with unframed/raw snappy. #2696
This comment has been minimized.
This comment has been minimized.
|
Thanks for addressing this. Other than the fix for cross-lang Snappy, it will also help that the Content-encoding header is now going to say it's Snappy (in my case it took me a couple of hours to figure out why my protobuf deserializer was not able to read the bytestream). Maybe it would be good to also mention in the docs that it's Snappy encoded. |
This comment has been minimized.
This comment has been minimized.
(edit) actually looks like I added it ages ago! d838792#diff-ae8db9d16d8057358e49d694522e7186R82 |
This comment has been minimized.
This comment has been minimized.
|
Looks like its not there on read though, and it should be. |
juliusv
closed this
in
#2696
May 10, 2017
mattbostock
added a commit
to mattbostock/timbala
that referenced
this issue
Jun 26, 2017
mattbostock
referenced this issue
Jun 26, 2017
Merged
Switch to unframed snappy under Prometheus 1.7.x #50
mattbostock
added a commit
to mattbostock/timbala
that referenced
this issue
Jun 26, 2017
prateek
referenced this issue
Nov 15, 2018
Open
Add a performant endpoint to allow non-Go users to interact with m3db directly. #1182
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
engelrob commentedMay 9, 2017
•
edited
What did you do?
I implemented a remote_read interface for Prometheus in Java.
What did you expect to see?
I expected to receive Protobuf-encoded remote ReadRequests from Prometheus, but instead...
What did you see instead? Under which circumstances?
Instead of the protobuf binary format, Prometheus' remote read requests are Snappy-compressed data.
First, this is not stated in the Content-type, which says "application/x-protobuf" indicating that it is protobuf binary format, not Snappy.
Second, I am currently not aware of any Java implementation of the Snappy codec that can successfully decode golang-snappy encoded data (I tried both xerial-snappy and dain/snappy and could not make it decompress the golang-snappy encoded data).
Prometheus version:
1.6.1
Prometheus configuration file: