mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-13 11:19:33 +02:00
MEDIUM: connection: reintegrate conn_hash_node into connection
Previously the conn_hash_node was placed outside the connection due to the big size of the eb64_node that could have negatively impacted frontend connections. But having it outside also means that one extra allocation is needed for each backend connection, and that one memory indirection is needed for each lookup. With the compact trees, the tree node is smaller (16 bytes vs 40) so the overhead is much lower. By integrating it into the connection, We're also eliminating one pointer from the connection to the hash node and one pointer from the hash node to the connection (in addition to the extra object bookkeeping). This results in saving at least 24 bytes per total backend connection, and only inflates connections by 16 bytes (from 240 to 256), which is a reasonable compromise. Tests on a 64-core EPYC show a 2.4% increase in the request rate (from 2.08 to 2.13 Mrps).
This commit is contained in:
@@ -598,6 +598,14 @@ struct conn_tlv_list {
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/* node for backend connection in the idle trees for http-reuse
|
||||
* A connection is identified by a hash generated from its specific parameters
|
||||
*/
|
||||
struct conn_hash_node {
|
||||
struct ceb_node node; /* indexes the hashing key for safe/idle/avail */
|
||||
uint64_t key; /* the hashing key, also used by session-owned */
|
||||
};
|
||||
|
||||
/* This structure describes a connection with its methods and data.
|
||||
* A connection may be performed to proxy or server via a local or remote
|
||||
* socket, and can also be made to an internal applet. It can support
|
||||
@@ -643,7 +651,7 @@ struct connection {
|
||||
/* used to identify a backend connection for http-reuse,
|
||||
* thus only present if conn.target is of type OBJ_TYPE_SERVER
|
||||
*/
|
||||
struct conn_hash_node *hash_node;
|
||||
struct conn_hash_node hash_node;
|
||||
|
||||
/* Members used if connection must be reversed. */
|
||||
struct {
|
||||
@@ -656,15 +664,6 @@ struct connection {
|
||||
uint8_t tos; /* set ip tos, if CO_FL_OPT_TOS is set */
|
||||
};
|
||||
|
||||
/* node for backend connection in the idle trees for http-reuse
|
||||
* A connection is identified by a hash generated from its specific parameters
|
||||
*/
|
||||
struct conn_hash_node {
|
||||
struct ceb_node node; /* indexes the hashing key for safe/idle/avail */
|
||||
uint64_t key; /* the hashing key, also used by session-owned */
|
||||
struct connection *conn; /* connection owner of the node */
|
||||
};
|
||||
|
||||
struct mux_proto_list {
|
||||
const struct ist token; /* token name and length. Empty is catch-all */
|
||||
enum proto_proxy_mode mode;
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <haproxy/task-t.h>
|
||||
|
||||
extern struct pool_head *pool_head_connection;
|
||||
extern struct pool_head *pool_head_conn_hash_node;
|
||||
extern struct pool_head *pool_head_sockaddr;
|
||||
extern struct pool_head *pool_head_pp_tlv_128;
|
||||
extern struct pool_head *pool_head_pp_tlv_256;
|
||||
@@ -91,7 +90,6 @@ struct connection *conn_new(void *target);
|
||||
void conn_free(struct connection *conn);
|
||||
void conn_release(struct connection *conn);
|
||||
void conn_set_errno(struct connection *conn, int err);
|
||||
struct conn_hash_node *conn_alloc_hash_node(struct connection *conn);
|
||||
struct sockaddr_storage *sockaddr_alloc(struct sockaddr_storage **sap, const struct sockaddr_storage *orig, socklen_t len);
|
||||
void sockaddr_free(struct sockaddr_storage **sap);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user