Back to Linkerd

Thrift Protocol

linkerd/docs/protocol-thrift.md

1.7.51.9 KB
Original Source

Thrift Protocol

This config routes thrift (via buffered transport using the TCompactProtocol) from port 4004 to port 5005

yaml
routers:
- protocol: thrift
  label: port-shifter
  dtab: |
    /svc => /$/inet/127.1/5005;
  thriftProtocol: compact
  servers:
  - port: 4004
    ip: 0.0.0.0
    thriftFramed: false
  client:
    thriftFramed: false

protocol: thrift

If the TTwitter thrift protocol is used, the value from the dest request header will be used for routing:

Dtab Path Format For Thrift

  / dstPrefix [/ dest] [/ thriftMethod ]

Otherwise, the Thrift protocol does not encode a destination name in the message itself and the dest part of the path will be absent.

Thrift Router Parameters

KeyDefault ValueDescription
dstPrefix/svcA path prefix used in dtab.
thriftMethodInDstfalseIf true, thrift method names are appended to destinations for outgoing requests.
thriftProtocolbinaryEither binary (TBinaryProtocol) or compact (TCompactProtocol). Applies to both clients and servers.

Thrift Server Parameters

KeyDefault ValueDescription
port4114The TCP port number.
thriftFramedtrueIf true, a framed thrift transport is used for incoming requests; otherwise, a buffered transport is used. Typically this setting matches the router's thriftFramed param.

Thrift Client Parameters

KeyDefault ValueDescription
thriftFramedtrueIf true, a framed thrift transport is used for outgoing requests; otherwise, a buffered transport is used. Typically this setting matches the router's servers' thriftFramed param.
attemptTTwitterUpgradefalseControls whether thrift protocol upgrade should be attempted.