Twemproxy Flow   charsyam@naver.com
Twemproxy• Server Side Proxy For Memcache, Redis• Made by Twitter.• Github.com/twitter/twemproxy
Recv Loop(common)        core_loop        core_core        core_recv        msg_recv
Recv Loop(client-server)
Send Loop(common)        core_loop        core_core        core_send        msg_send
Send Loop(client-server)
Message• Using Memory Pool• Using mbuf
Message-req_get   req_get                   rsp_get               msg_get                             _msg_get            ...
mbuf• Using chained buffer• Using sendv, writev
mbufstruct iovec array[]       array[0].iov_base   Mbuf->pos       array[0].iov_len      mlen       array[n].iov_base   Mb...
mbuf
Why is Twemproxy Fast?• Using mbuf and avoiding buffer copy.   – Just forward packet.
Thank you
Upcoming SlideShare
Loading in …5
×

Twemproxy flow

5,932 views

Published on

0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,932
On SlideShare
0
From Embeds
0
Number of Embeds
2,581
Actions
Shares
0
Downloads
45
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide

Twemproxy flow

  1. 1. Twemproxy Flow charsyam@naver.com
  2. 2. Twemproxy• Server Side Proxy For Memcache, Redis• Made by Twitter.• Github.com/twitter/twemproxy
  3. 3. Recv Loop(common) core_loop core_core core_recv msg_recv
  4. 4. Recv Loop(client-server)
  5. 5. Send Loop(common) core_loop core_core core_send msg_send
  6. 6. Send Loop(client-server)
  7. 7. Message• Using Memory Pool• Using mbuf
  8. 8. Message-req_get req_get rsp_get msg_get _msg_get Processing …… req_put rsp_put
  9. 9. mbuf• Using chained buffer• Using sendv, writev
  10. 10. mbufstruct iovec array[] array[0].iov_base Mbuf->pos array[0].iov_len mlen array[n].iov_base Mbuf->pos array[n].iov_len mlen
  11. 11. mbuf
  12. 12. Why is Twemproxy Fast?• Using mbuf and avoiding buffer copy. – Just forward packet.
  13. 13. Thank you

×