All you really need to do is wrap the TSocket, Transport, and Protocol
into your own MyConnection class and have 1 per thread. There is
nothing inefficient about it, except maybe a bit more memory. Or you
can put a lock around your service and make it so only 1 thread can talk
at any given
On Wed, Aug 8, 2012 at 4:55 PM, Mark Slee ms...@fb.com wrote:
The Thrift transport layer is not thread-safe. It is essentially a wrapper on
a socket.
You can't interleave writing things to a single socket from multiple threads
without locking. You also don't know what order the responses
sometimes having more threads than the number of cores is
desirable when you have a thread pool with worker threads doing
network/disk I/O
Yep, totally agreed, and this is certainly an intuitive way of programming.
But in all of these systems, either each worker thread has exclusive ownership