| haproxy_frontend_failed_header_rewriting_total |
| haproxy_frontend_http_cache_lookups_total |
| haproxy_frontend_http_cache_hits_total |
+| haproxy_frontend_http_cache_hint_hits_total |
| haproxy_frontend_internal_errors_total |
+-------------------------------------------------+
| haproxy_backend_connection_reuses_total |
| haproxy_backend_http_cache_lookups_total |
| haproxy_backend_http_cache_hits_total |
+| haproxy_backend_http_cache_hint_hits_total |
| haproxy_backend_max_queue_time_seconds |
| haproxy_backend_max_connect_time_seconds |
| haproxy_backend_max_response_time_seconds |
case ST_I_PX_INTERCEPTED:
case ST_I_PX_CACHE_LOOKUPS:
case ST_I_PX_CACHE_HITS:
+ case ST_I_PX_CACHE_HINT_HITS:
case ST_I_PX_COMP_IN:
case ST_I_PX_COMP_OUT:
case ST_I_PX_COMP_BYP:
case ST_I_PX_REQ_TOT:
case ST_I_PX_CACHE_LOOKUPS:
case ST_I_PX_CACHE_HITS:
+ case ST_I_PX_CACHE_HINT_HITS:
case ST_I_PX_COMP_IN:
case ST_I_PX_COMP_OUT:
case ST_I_PX_COMP_BYP:
process started
117. resbout [LFBS]: total number of response bytes sent since the worker
process started
+ 118. cache_hint_hits [.FB.]: cumulative number of cache hits having served
+ early hints
For all other statistics domains, the presence or the order of the fields are
not guaranteed. In this case, the header line should always be used to parse
long long cum_req[4]; /* cumulated number of processed other/h1/h2/h3 requests */
long long cache_hits; /* cache hits */
long long cache_lookups;/* cache lookups */
+ long long cache_hint_hits; /* cache hits serving early hints */
long long comp_rsp; /* number of compressed responses */
long long rsp[6]; /* http response codes */
} http;
long long cache_hits; /* cache hits */
long long cache_lookups;/* cache lookups */
+ long long cache_hint_hits; /* cache hits serving early hints */
long long comp_rsp; /* number of compressed responses */
long long rsp[6]; /* http response codes */
};
#define SHM_STATS_FILE_VER_MAJOR 1
-#define SHM_STATS_FILE_VER_MINOR 2
+#define SHM_STATS_FILE_VER_MINOR 3
#define SHM_STATS_FILE_HEARTBEAT_TIMEOUT 60 /* passed this delay (seconds) process which has not
* sent heartbeat will be considered down
ST_I_PX_REQ_OUT,
ST_I_PX_RES_IN,
ST_I_PX_RES_OUT,
+ ST_I_PX_CACHE_HINT_HITS,
/* must always be the last one */
ST_I_PX_MAX
};
* length <hint_data_len>. The format matches what http_action_store_cache
* writes: concatenated records of {uint16_t length, char value[length]}, each
* value being a Link header value. Skipped for HTTP/1.0 clients.
+ * Returns 1 if a 103 response was emitted, 0 otherwise.
*/
-static void cache_emit_early_hints(struct stream *s, const char *hint_data,
- unsigned int hint_data_len)
+static int cache_emit_early_hints(struct stream *s, const char *hint_data,
+ unsigned int hint_data_len)
{
struct htx *htx;
const char *p = hint_data;
const char *end = hint_data + hint_data_len;
if (!(s->txn.http->req.flags & HTTP_MSGF_VER_11))
- return;
+ return 0;
htx = http_early_hint_start(s);
if (!htx)
if (!http_early_hint_end(s))
goto error;
- return;
+ return 1;
error:
channel_htx_truncate(&s->res, htxbuf(&s->res.buf));
s->txn.http->status = 0;
+ return 0;
}
enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *px,
shctx_wrunlock(shctx);
cache_rdunlock(cache_tree);
- if (hint_buf && b_data(hint_buf) > 0)
- cache_emit_early_hints(s, b_orig(hint_buf), b_data(hint_buf));
+ if (hint_buf && b_data(hint_buf) > 0 &&
+ cache_emit_early_hints(s, b_orig(hint_buf), b_data(hint_buf))) {
+ long long *ctr = NULL;
+
+ if (px == strm_fe(s)) {
+ if (px->fe_counters.shared.tg)
+ ctr = &px->fe_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits;
+ }
+ else if (px->be_counters.shared.tg)
+ ctr = &px->be_counters.shared.tg[tgid - 1]->p.http.cache_hint_hits;
+
+ if (ctr)
+ _HA_ATOMIC_INC(ctr);
+ }
/* In case of Vary, we could have multiple entries with the same
* primary hash. We need to calculate the secondary hash in order
BUG_ON(sizeof(struct shm_stats_file_hdr) != 672, "shm_stats_file_hdr struct size changed, "
"it is part of the exported API: ensure all precautions were taken (ie: shm_stats_file "
"version change) before adjusting this");
- BUG_ON(sizeof(struct shm_stats_file_object) != 552, "shm_stats_file_object struct size changed, "
+ BUG_ON(sizeof(struct shm_stats_file_object) != 560, "shm_stats_file_object struct size changed, "
"it is part of the exported API: ensure all precautions were taken (ie: shm_stats_file "
"version change) before adjusting this");
"<tr><th>Intercepted requests:</th><td>%s</td></tr>"
"<tr><th>Cache lookups:</th><td>%s</td></tr>"
"<tr><th>Cache hits:</th><td>%s</td><td>(%d%%)</td></tr>"
+ "<tr><th>Cache hint hits:</th><td>%s</td></tr>"
"<tr><th>Failed hdr rewrites:</th><td>%s</td></tr>"
"<tr><th>Internal errors:</th><td>%s</td></tr>"
"",
U2H(stats[ST_I_PX_CACHE_HITS].u.u64),
stats[ST_I_PX_CACHE_LOOKUPS].u.u64 ?
(int)(100 * stats[ST_I_PX_CACHE_HITS].u.u64 / stats[ST_I_PX_CACHE_LOOKUPS].u.u64) : 0,
+ U2H(stats[ST_I_PX_CACHE_HINT_HITS].u.u64),
U2H(stats[ST_I_PX_WREW].u.u64),
U2H(stats[ST_I_PX_EINT].u.u64));
}
"<tr><th>- other responses:</th><td>%s</td></tr>"
"<tr><th>Cache lookups:</th><td>%s</td></tr>"
"<tr><th>Cache hits:</th><td>%s</td><td>(%d%%)</td></tr>"
+ "<tr><th>Cache hint hits:</th><td>%s</td></tr>"
"<tr><th>Failed hdr rewrites:</th><td>%s</td></tr>"
"<tr><th>Internal errors:</th><td>%s</td></tr>"
"",
U2H(stats[ST_I_PX_CACHE_HITS].u.u64),
stats[ST_I_PX_CACHE_LOOKUPS].u.u64 ?
(int)(100 * stats[ST_I_PX_CACHE_HITS].u.u64 / stats[ST_I_PX_CACHE_LOOKUPS].u.u64) : 0,
+ U2H(stats[ST_I_PX_CACHE_HINT_HITS].u.u64),
U2H(stats[ST_I_PX_WREW].u.u64),
U2H(stats[ST_I_PX_EINT].u.u64));
}
[ST_I_PX_REQ_OUT] = ME_NEW_PX_SHARED("reqbout", "req_bytes_out_total", FN_COUNTER, FF_U64, req_out, STATS_PX_CAP_LFBS, "Total number of request bytes sent since process started"),
[ST_I_PX_RES_IN] = ME_NEW_PX_SHARED("resbin", "res_bytes_in_total", FN_COUNTER, FF_U64, res_in, STATS_PX_CAP_LFBS, "Total number of response bytes received since process started"),
[ST_I_PX_RES_OUT] = ME_NEW_PX_SHARED("resbout", "res_bytes_out_total", FN_COUNTER, FF_U64, res_out, STATS_PX_CAP_LFBS, "Total number of response bytes sent since process started"),
+ [ST_I_PX_CACHE_HINT_HITS] = ME_NEW_PX_SHARED("cache_hint_hits", "http_cache_hint_hits_total", FN_COUNTER, FF_U64, p.http.cache_hint_hits, STATS_PX_CAP__FB_, "Total number of HTTP requests for which a 103 Early Hints response was emitted from the cache on this frontend/backend since the worker process started"),
};
case ST_I_PX_INTERCEPTED:
case ST_I_PX_CACHE_LOOKUPS:
case ST_I_PX_CACHE_HITS:
+ case ST_I_PX_CACHE_HINT_HITS:
return px->mode != PR_MODE_HTTP;
case ST_I_PX_CHKFAIL: