[
https://issues.apache.org/jira/browse/THRIFT-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671583#action_12671583
]
Esteve Fernandez commented on THRIFT-311:
-----------------------------------------
Here's an updated version of a Thrift+ASIO server. It uses a single thread for
accepting connections and dispatches them to a configurable thread pool. You'd
need to make your handlers thread-safe, though.
I have some ideas for making servers truly asynchronous, we could use
io_service.post(...) for dispatching processor calls to a thread pool or add
support for coroutines in the Thrift compiler. The former is really easy to
accomplish, but might put too much work on the thread pool and hinder servers
scalability. Whereas the latter requires modifying the Thrift compiler, but
would probably make servers have better performance (this is the approach used
in THRIFT-148)
BTW, I've tested it in Linux, but not in Windows. However I added the specific
bits to make it compile in Windows (copied from the ASIO examples), so it would
be great if someone could test it :-)
> ASIO client & server
> --------------------
>
> Key: THRIFT-311
> URL: https://issues.apache.org/jira/browse/THRIFT-311
> Project: Thrift
> Issue Type: Sub-task
> Components: Library (C++)
> Reporter: Esteve Fernandez
> Attachments: thrift_connection.cpp, thrift_connection.hpp,
> thrift_handler.cpp, thrift_handler.hpp, thrift_main.cpp, thrift_server.cpp,
> thrift_server.hpp, ThriftCalculatorASIOServer.cpp
>
>
> Given the recent discussion on a Windows port and moving to ASIO
> (http://mail-archives.apache.org/mod_mbox/incubator-thrift-dev/200901.mbox/%[email protected]%3e),
> I decided to hack a little Thrift asynchronous prototype server using ASIO
> and here's the result. It implements the Calculator service that can be found
> in the tutorial and, just like TNonblockingServer, it uses a FramedTransport.
> It's just a quick prototype, but I think it's enough for building a more
> generic server/protocol. I've only tested it in Linux, but I think there's
> nothing platform-dependent and can be compiled "as is" in Windows.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.