Twemproxy flow

13
Twemproxy Flow [email protected]

Transcript of Twemproxy flow

Page 1: Twemproxy flow

Twemproxy Flow [email protected]

Page 2: Twemproxy flow

Twemproxy • Server Side Proxy For Memcache, Redis

• Made by Twitter.

• Github.com/twitter/twemproxy

Page 3: Twemproxy flow

Recv Loop(common)

core_loop

core_core

core_recv

msg_recv

Page 4: Twemproxy flow

Recv Loop(client-server)

Page 5: Twemproxy flow

Send Loop(common)

core_loop

core_core

core_send

msg_send

Page 6: Twemproxy flow

Send Loop(client-server)

Page 7: Twemproxy flow

Message • Using Memory Pool

• Using mbuf

Page 8: Twemproxy flow

Message-req_get

req_get

msg_get

rsp_get

_msg_get

Processing ……

req_put rsp_put

Page 9: Twemproxy flow

mbuf • Using chained buffer

• Using sendv, writev

Page 10: Twemproxy flow

mbuf

struct iovec array[]

Mbuf->pos array[0].iov_base

array[0].iov_len mlen

Mbuf->pos array[n].iov_base

array[n].iov_len mlen

Page 11: Twemproxy flow

mbuf

Page 12: Twemproxy flow

Why is Twemproxy Fast? • Using mbuf and avoiding buffer copy.

– Just forward packet.

Page 13: Twemproxy flow

Thank you