basho / riak_api

Riak Client APIs
27 stars 46 forks source link

READY: Perf/query ttb encoding #109

Closed erikleitch closed 8 years ago

erikleitch commented 8 years ago

Context

This is part of a set of related PRs to rework handling of PB vs TTB encoding for client/server messages:

The original addition of alternate encodings was a hybrid implementation which 1) required the client and server to agree via a handshaking protocol about what encoding would be used, 2) used messages for both encodings that were generated from the .proto files, but some were only used for TTB encoding, and 3) allowed the server to send PB-encoded responses to TTB-encoded requests.

This work is an attempt to rationalize this situation, and to simplify how differently-encoded messages are handled within riak. The guiding principles are:

  1. Even as we optimize encodings for RiakTS performance, the server should continue to support PB-encoding as before. We do not, for example, want to break custom PB connections made outside our supported client codebase
  2. We should be able to optimize messages for whatever encoding is imposed on them.
  3. The server should handle interleaved messages with different encodings seamlessly, without any handshaking about encoding type
  4. We should guarantee that responses are encoded in the same way as the requests that generated them

Notes


Changes in this repo:

This change removes the need to synchronize encoding schemes between client and server that was accomplished by sending the PB_TOGGLE_ENCODING message. Changes to riak_api_pb_server.erl simply remove all code that deals with the now-obsolete handshaking.

lukebakken commented 8 years ago

Take all of this with a grain of salt, it's just me being pedantic:

hazen commented 8 years ago

@lukebakken We'd still want to make the changes Erik is prosing here. You'd just take it one step further by renaming to a TCP server, right?

lukebakken commented 8 years ago

@javajolt yeah these changes are minor. I started work on basho/riak_kv#1379 today and will get that done tomorrow.

erikleitch commented 8 years ago

I think the renaming proposed here is ok, however I think we should table any further pedantry for a post-TS1.3-release timeframe. (Technically the whole riak_pb repo is now a misnomer, and should be riak_tcp, or a separate repo should be created for other encodings, etc., but these are changes that would break lots of rebar.config dependencies, builds, etc)

Actually, I don't think even this renaming is advisable at this point. riak_api_pb_XXX naming convention is used all over riak_kv and yokozuna. I would suggest a separate effort to renormalize our naming scheme when we are not a few days out from a release.

alexmoore commented 8 years ago

+1 03471df

alexmoore commented 8 years ago

@borshop merge