avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-2) optimize RPC handshake
Date Tue, 26 May 2009 22:38:45 GMT

    [ https://issues.apache.org/jira/browse/AVRO-2?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713302#action_12713302

Doug Cutting commented on AVRO-2:

Matt's suggested the handshake should be represented using Avro schemas.  Here's an attempt.
 Note that, since these are appended to the front of request and response payloads by the
runtime, I do not attempt to express this as an Avro protocol.

{"type": "record", "name": "HandshakeRequest", "fields": [
  {"name": "clientProtocolHash", "type": "MD5"},
  {"name": "clientProtocol", "type": ["null", "string"]},
  {"name": "serverProtocolHash", "type": "MD5"}
{"type": "record", "name": "HandshakeResponse", "fields": [
  {"name": "match", "type": {"type": "enum", "name": "HandshakeMatch",
   "symbols": ["BOTH", "CLIENT", "NONE"]},
  {"name": "serverProtocol", "type": ["null", "ProtocolHash"}}
{"type": "record", "name": "ProtocolHash", "fields": [
  {"name": "text", "type": "string"},
  {"name": "hash", "type": "MD5"},
{"type": "fixed", "name": "MD5", "size": 16}

Here's some draft text for the spec:

Until a connection is established, request payloads must be preceded by HandshakeRequest and
response payloads are preceded by HandshakeResponse.  A connection is not established until
a HandshakeResponse with match=BOTH or match=CLIENT is returned.  In these cases the response
payload follows the HandShakeResponse.  When match=NONE no response payload is sent and the
request payload is ignored.

A client should initially try establishing a session by sending a HandshakeRequest that does
not include its protocol text.  If it does not yet know the server's protocol hash, it should
send its own as a guess.  If it receives a match=CLIENT then it should store the returned
server protocol's hash and cache it for use in establishing future connections with this server.
 It should only send its protocol text after it has recieved a match=NONE response.

How does that sound?

> optimize RPC handshake
> ----------------------
>                 Key: AVRO-2
>                 URL: https://issues.apache.org/jira/browse/AVRO-2
>             Project: Avro
>          Issue Type: Improvement
>          Components: spec
>    Affects Versions: 1.0
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
> In the current RPC handshake, each client sends its full protocol at the start of each
session, and the server must return its full protocol.  This could be expensive, and should
be avoided when possible.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message