From b2cadc45dfb514ef16c3353abe18845f146dfb2b Mon Sep 17 00:00:00 2001 From: dormando Date: Sat, 5 Oct 2019 13:22:45 -0700 Subject: network: response stacking for all commands This change refactors most of memcached's networking frontend code. The goals with this change: - Decouple buffer memory from client connections where plausible, reducing memory usage for currently inactive TCP sessions. - Allow easy response stacking for all protocols. Previously every binary command generates a syscall during response. This is no longer true when multiple commands are read off the wire at once. The new meta protocol and most text protocol commands are similar. - Reduce code complexity for network handling. Remove automatic buffer adjustments, error checking, and so on. This is accomplished by removing the iovec, msg, and "write buffer" structures from connection objects. A `mc_resp` object is now used to represent an individual response. These objects contain small iovec's and enough detail to be late-combined on transmit. As a side effect, UDP mode now works with extstore :) Adding to the iovec always had a remote chance of memory failure, so every call had to be checked for an error. Now once a response object is allocated, most manipulations can happen without any checking. This is both a boost to code robustness and performance for some hot paths. This patch is the first in a series, focusing on the client response. --- cache.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cache.h') diff --git a/cache.h b/cache.h index a602550..16fc0a7 100644 --- a/cache.h +++ b/cache.h @@ -55,6 +55,8 @@ typedef struct { size_t bufsize; /** The capacity of the list of elements */ int freetotal; + /** Total malloc'ed objects */ + int total; /** The current number of free elements */ int freecurr; /** The constructor to be called each time we allocate more memory */ -- cgit v1.2.1