Open sloops77 opened 6 years ago
MessagePack would not be so suitable since you need to define a schema which makes the whole thing quite complex. It would need to be a schemaless format, also ideally at least as fast as JSON. Last I checked I could not find any...
messagepack is schemaless. https://github.com/pgriess/node-msgpack
also something interesting to use would be snappy. https://github.com/kesla/node-snappy
oh yes, sorry I mixed messagepack with protobuffers. Are your biggest concern space usage in redis, bandwidth or speed? When I research this some time ago I concluded that the fastest format was JSON, although not the most compact one.
Maybe the best way is as you propose, just keep using JSON, which is very fast in node and just compress the resulting string before storing in redis. We could just add a new option when creating a queue, 'compression: true' and compress all data in that case.
or even better:
compression: {
encode: myencoder,
decode: mydecoder
}
I think it is not right to add any possible feature user asked in 'core'. It is a very solid path to package bloat and support nightmare. I think @manast last suggestion the most elegant solution possible for now.
When there is a large payload JSON can be pretty verbose. Support for alternative serialization techniques for the jobData and/or serialization middlewares to support compression would be a great enhancement