mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
OPTIM: listener: optimize cache-line packing for struct listener
Some unused fields were placed early and some important ones were on the second cache line. Let's move the proto_list and name closer to the end of the structure to bring accept() and default_target() into the first cache line.
This commit is contained in:
parent
fc647360e0
commit
4ed84c96cf
@ -191,7 +191,6 @@ struct listener {
|
|||||||
enum li_state state; /* state: NEW, INIT, ASSIGNED, LISTEN, READY, FULL */
|
enum li_state state; /* state: NEW, INIT, ASSIGNED, LISTEN, READY, FULL */
|
||||||
short int nice; /* nice value to assign to the instanciated tasks */
|
short int nice; /* nice value to assign to the instanciated tasks */
|
||||||
int fd; /* the listen socket */
|
int fd; /* the listen socket */
|
||||||
char *name; /* listener's name */
|
|
||||||
int luid; /* listener universally unique ID, used for SNMP */
|
int luid; /* listener universally unique ID, used for SNMP */
|
||||||
int options; /* socket options : LI_O_* */
|
int options; /* socket options : LI_O_* */
|
||||||
struct fe_counters *counters; /* statistics counters */
|
struct fe_counters *counters; /* statistics counters */
|
||||||
@ -200,22 +199,26 @@ struct listener {
|
|||||||
int maxconn; /* maximum connections allowed on this listener */
|
int maxconn; /* maximum connections allowed on this listener */
|
||||||
unsigned int backlog; /* if set, listen backlog */
|
unsigned int backlog; /* if set, listen backlog */
|
||||||
unsigned int maxaccept; /* if set, max number of connections accepted at once */
|
unsigned int maxaccept; /* if set, max number of connections accepted at once */
|
||||||
struct list proto_list; /* list in the protocol header */
|
|
||||||
int (*accept)(struct listener *l, int fd, struct sockaddr_storage *addr); /* upper layer's accept() */
|
int (*accept)(struct listener *l, int fd, struct sockaddr_storage *addr); /* upper layer's accept() */
|
||||||
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
|
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
|
||||||
|
/* cache line boundary */
|
||||||
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
|
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
|
||||||
unsigned int analysers; /* bitmap of required protocol analysers */
|
unsigned int analysers; /* bitmap of required protocol analysers */
|
||||||
int maxseg; /* for TCP, advertised MSS */
|
int maxseg; /* for TCP, advertised MSS */
|
||||||
int tcp_ut; /* for TCP, user timeout */
|
int tcp_ut; /* for TCP, user timeout */
|
||||||
|
/* 4 bytes hole */
|
||||||
char *interface; /* interface name or NULL */
|
char *interface; /* interface name or NULL */
|
||||||
|
char *name; /* listener's name */
|
||||||
|
|
||||||
__decl_hathreads(HA_SPINLOCK_T lock);
|
__decl_hathreads(HA_SPINLOCK_T lock);
|
||||||
|
|
||||||
const struct netns_entry *netns; /* network namespace of the listener*/
|
const struct netns_entry *netns; /* network namespace of the listener*/
|
||||||
|
|
||||||
|
/* cache line boundary */
|
||||||
struct list by_fe; /* chaining in frontend's list of listeners */
|
struct list by_fe; /* chaining in frontend's list of listeners */
|
||||||
struct list by_bind; /* chaining in bind_conf's list of listeners */
|
struct list by_bind; /* chaining in bind_conf's list of listeners */
|
||||||
struct bind_conf *bind_conf; /* "bind" line settings, include SSL settings among other things */
|
struct bind_conf *bind_conf; /* "bind" line settings, include SSL settings among other things */
|
||||||
|
struct list proto_list; /* list in the protocol header */
|
||||||
|
|
||||||
/* warning: this struct is huge, keep it at the bottom */
|
/* warning: this struct is huge, keep it at the bottom */
|
||||||
struct sockaddr_storage addr; /* the address we listen to */
|
struct sockaddr_storage addr; /* the address we listen to */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user