Twemproxy source analysis of the five: zero copy

Source: Internet
Author: User

The data structure of MSG is given first:


Truct MSG {tailq_entry (msg) C_TQE; tailq_entry (msg) S_TQE; tailq_entry (msg) M_TQE;      uint64_t              Id                  int                  route_ Idx          struct msg            *peer;              struct Conn           *owner;               struct Rbnode         tmo_rbe;             struct MHDR           mhdr;                 uint32_t             mlen;                 int                   state;              uint8_t               *pos;                uint8_t               *token;               msg_parse_t           parser;              msg_parse_result_t    Result               mbuf_copy_t          pre_splitcopy;      msg_post_splitcopy_t post_splitcopy;      msg_coalesce_t       pre_coalesce;        msg_coalesce_t       post_coalesce;       msg_type_t           type ;                 uint8_t               *key_start;          uint8_t               *key_end;             uint32_t              vlen;                 uint8_t               *end;                 uint8_t               *narg_start;        uint8_t               *narg_end;          uint32_t              narg;                uint32_t              rnarg;              uint32_t              rlen;                 uint32_t              integer;             struct msg            *frag_owner;        uint32_t              nfrag;              uint64_t              frag_id;             err_t                 err;                unsigned              error:1;            unsigned              ferror:1;            unsigned              request:1;          unsigned              quit:1;              unsigned              noreply:1;          unsigned              done:1;              unsigned              fdone:1;            unsigned             first_fragment:1;    unsigned              last_fragment:1;     unsigned             swallow:1;          unsigned              redis:1;          
See these three members of Tailq_entry (msg) C_TQE;tailq_entry (msg) S_TQE; tailq_entry (msg) M_TQE; C_TQE is an input or output queue that is used to insert input into the conn of the client type or output queue s_tqe is used to insert into the conn of the type of server (that is, Conn that connects to the back-end Redis server) m_ TQE is used to insert into a send-to column (a send queue corresponding to a remote or client or redisinstance) in the input or output queue of the specific insertion and deletion process see the previous article.

Twemproxy source analysis of the five: zero copy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.