I've been playing with the Tcp module for a while now, trying to use it to 
build a Memcached client that performs as well as the spymemcached java 
client does.  I got stuff working a while back with the plain Tcp extension 
but the code was tricky (back pressure handling) and always seemed to hit a 
bottleneck at around 10K QPS; it will plateau there and never go higher. 
 The spymemcached client, which uses a single I/O thread can get going up 
to 100K QPS (pipelining multiple requests into a single write to the 
outbound channel).  I recently converted my code to use StreamTcp now, 
hoping this would be cleaner (it is) and also possibly remove that 
unexplained bottleneck.  Unfortunately it still hits the same bottleneck, 
even though I am pipelining too (via a groupWithin).  The only way I can 
get above 10K QPS is to create multiple clients, each opening its own 
StreamTcp connection, but this is not a great idea; I should be able to 
achieve high throughput on this long lived connection with only a single 
connection into memcached.

A few things to note:

   - My Memcached client actor connects via StreamTcp.Connect
   - On the resulting OutboundTcpConnection, I create two Flows; one for 
   outbound data, one for inbound
   - The outbound Flow uses a custom ActorPublisher at the head of the Flow 
   and the Flow looks like this: ActorPublisher -> groupWithin -> map (to fold 
   the multiple requests into one mega request) -> 
   produceTo(outboundConnection)
   - The Custom Publisher uses an internal Queue (a mutable java.util.Queue 
   for perf reasons) that it will add to if there is no demand
   - The inbound Flow uses a custom ActorSubscriber at the tail of the Flow 
   and the Flow looks like this: Inbound Connection -> transform (for 
   memcached frame decoding) -> produceTo(Custom Subscriber)

I know it's going to be tough to completely diagnose this issue without 
seeing my code, and I'm willing to share it, but I wanted to reach out 
first and see if this type of situation is a known issue or not.  Is there 
an issue trying to do a very high throughput single StreamTcp connection? 
 FWIW, on the custom publisher, I generally only ever see the demand at 4 
when I get a Request message so it seems as if the downstream stuff is 
exhibiting significant back pressure on me.  

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to