From 0a8535fec8645db9d8891875553879f44063f598 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 13 Oct 2012 10:05:56 +0200 Subject: [PATCH] OPTIM: channel: reorganize struct members to improve cache efficiency Now that the buffer is moved out of the channel, it is possible to move the pointer earlier in the struct and reorder some fields. This new ordering improves overall performance by 2%, mainly saved in the HTTP parsers and data transfers. --- include/types/channel.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/types/channel.h b/include/types/channel.h index efd1a128c..778339a14 100644 --- a/include/types/channel.h +++ b/include/types/channel.h @@ -172,21 +172,21 @@ struct session; struct channel { unsigned int flags; /* CF_* */ + unsigned int analysers; /* bit field indicating what to do on the channel */ + struct buffer *buf; /* buffer attached to the channel, always present but may move */ + struct stream_interface *cons; /* consumer attached to this channel */ + struct stream_interface *prod; /* producer attached to this channel */ + struct pipe *pipe; /* non-NULL only when data present */ + unsigned int to_forward; /* number of bytes to forward after out without a wake-up */ + unsigned char xfer_large; /* number of consecutive large xfers */ + unsigned char xfer_small; /* number of consecutive small xfers */ + unsigned long long total; /* total data read */ int rex; /* expiration date for a read, in ticks */ int wex; /* expiration date for a write or connect, in ticks */ int rto; /* read timeout, in ticks */ int wto; /* write timeout, in ticks */ - unsigned int to_forward; /* number of bytes to forward after out without a wake-up */ - unsigned int analysers; /* bit field indicating what to do on the channel */ - int analyse_exp; /* expiration date for current analysers (if set) */ void (*hijacker)(struct session *, struct channel *); /* alternative content producer */ - unsigned char xfer_large; /* number of consecutive large xfers */ - unsigned char xfer_small; /* number of consecutive small xfers */ - unsigned long long total; /* total data read */ - struct stream_interface *prod; /* producer attached to this channel */ - struct stream_interface *cons; /* consumer attached to this channel */ - struct pipe *pipe; /* non-NULL only when data present */ - struct buffer *buf; /* buffer attached to the channel, always present but may move */ + int analyse_exp; /* expiration date for current analysers (if set) */ };