You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Rob Slifka <rs...@sfu.ca> on 2009/08/14 06:33:04 UTC
PATCH: Protocol and Server Indepdent Multiplexing
Hi everyone,
We're really digging Thrift over here and are happy to be able to contribute so quickly. This is due in large part to the AMAZING object model you've all put together; just brilliant, really. Also, the Thrift whitepaper was indispensable.
Here's our first contribution. Please let us know what you think.
WHAT:
A patch file that allows protocol- and server-independent multiplexing. I.e. a single TServer can serve multiple services. Any protocol and any server can be used.
WHY:
We're planning on using Thrift for a significant amount of transfer between at least three languages meaning we're already dealing with at least two open ports. We're not excited about the prospect of a single service definition on each port as the number of functions is expected to grow rather large (a good problem!) and we're worried about maintainability of the interfaces.
HOW:
There are three files, using only decoration of the pre-existing Thrift object model.
+ TProtocolDecorator
- Allows subclassing without having to implement all of TProtocol, used by each of the following.
+ TMultiplexedProtocol
- Prepends the service name to the function name during TProtocol::writeMessageBegin().
+ TMultiplexedProcessor
- Extracts the service name from the header and dispatches the request to the appropriate processor.
Hope this helps!
Providing this seems applicable to others, should we file in Jira?
Thanks guys,
Rob
Re: PATCH: Protocol and Server Indepdent Multiplexing
Posted by "Rob S." <rs...@sfu.ca>.
Hi David,
Our approach is a bit different; much less complex I think (and
therefore hopefully more valuable to the project).
We chose to insert ourselves at the TProcessor level of abstraction,
not the TServer and TProtocol levels; changes to which are
significantly more involved/risky.
Relying on the robustness of those layers:
- We do not modify the protocol; only changes to existing structures
in-flight, not seen by TProtocol implementations on either end.
- No TServer modification required; it works with all TServer
implementations.
I'd be very curious to head what everyone thinks of our choices there!
Thanks guys,
Rob
On Aug 13, 2009, at 9:47 PM, David Reiss wrote:
> FYI, there was another set of patches implementing a similar feature,
> but they were dropped due to general lack of interest:
>
> https://issues.apache.org/jira/browse/THRIFT-66
>
> Rob Slifka wrote:
>> Hi everyone,
>>
>> We're really digging Thrift over here and are happy to be able to
>> contribute so quickly. This is due in large part to the AMAZING
>> object model you've all put together; just brilliant, really.
>> Also, the Thrift whitepaper was indispensable.
>>
>> Here's our first contribution. Please let us know what you think.
>>
>> WHAT:
>> A patch file that allows protocol- and server-independent
>> multiplexing. I.e. a single TServer can serve multiple services.
>> Any protocol and any server can be used.
>>
>> WHY:
>> We're planning on using Thrift for a significant amount of transfer
>> between at least three languages meaning we're already dealing with
>> at least two open ports. We're not excited about the prospect of a
>> single service definition on each port as the number of functions
>> is expected to grow rather large (a good problem!) and we're
>> worried about maintainability of the interfaces.
>>
>> HOW:
>> There are three files, using only decoration of the pre-existing
>> Thrift object model.
>>
>> + TProtocolDecorator
>> - Allows subclassing without having to implement all of TProtocol,
>> used by each of the following.
>>
>> + TMultiplexedProtocol
>> - Prepends the service name to the function name during
>> TProtocol::writeMessageBegin().
>>
>> + TMultiplexedProcessor
>> - Extracts the service name from the header and dispatches the
>> request to the appropriate processor.
>>
>> Hope this helps!
>>
>> Providing this seems applicable to others, should we file in Jira?
>>
>> Thanks guys,
>>
>> Rob
>>
Re: PATCH: Protocol and Server Indepdent Multiplexing
Posted by David Reiss <dr...@facebook.com>.
FYI, there was another set of patches implementing a similar feature,
but they were dropped due to general lack of interest:
https://issues.apache.org/jira/browse/THRIFT-66
Rob Slifka wrote:
> Hi everyone,
>
> We're really digging Thrift over here and are happy to be able to contribute so quickly. This is due in large part to the AMAZING object model you've all put together; just brilliant, really. Also, the Thrift whitepaper was indispensable.
>
> Here's our first contribution. Please let us know what you think.
>
> WHAT:
> A patch file that allows protocol- and server-independent multiplexing. I.e. a single TServer can serve multiple services. Any protocol and any server can be used.
>
> WHY:
> We're planning on using Thrift for a significant amount of transfer between at least three languages meaning we're already dealing with at least two open ports. We're not excited about the prospect of a single service definition on each port as the number of functions is expected to grow rather large (a good problem!) and we're worried about maintainability of the interfaces.
>
> HOW:
> There are three files, using only decoration of the pre-existing Thrift object model.
>
> + TProtocolDecorator
> - Allows subclassing without having to implement all of TProtocol, used by each of the following.
>
> + TMultiplexedProtocol
> - Prepends the service name to the function name during TProtocol::writeMessageBegin().
>
> + TMultiplexedProcessor
> - Extracts the service name from the header and dispatches the request to the appropriate processor.
>
> Hope this helps!
>
> Providing this seems applicable to others, should we file in Jira?
>
> Thanks guys,
>
> Rob
>