MINOR: activity: report the number of failed pool/buffer allocations
Haproxy is designed to be able to continue to run even under very low
memory conditions. However this can sometimes have a serious impact on
performance that it hard to diagnose. Let's report counters of failed
pool and buffer allocations per thread in show activity.
diff --git a/include/common/buffer.h b/include/common/buffer.h
index ce6d38c..9604026 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -33,6 +33,7 @@
#include <common/istbuf.h>
#include <common/memory.h>
+#include <proto/activity.h>
/* an element of the <buffer_wq> list. It represents an object that need to
* acquire a buffer to continue its process. */
@@ -77,8 +78,10 @@
*buf = BUF_WANTED;
area = pool_alloc_dirty(pool_head_buffer);
- if (unlikely(!area))
+ if (unlikely(!area)) {
+ activity[tid].buf_wait++;
return NULL;
+ }
buf->area = area;
buf->size = pool_head_buffer->size;
@@ -175,8 +178,10 @@
HA_SPIN_UNLOCK(POOL_LOCK, &pool_head_buffer->lock);
#endif
- if (unlikely(!area))
+ if (unlikely(!area)) {
+ activity[tid].buf_wait++;
return NULL;
+ }
done:
buf->area = area;
diff --git a/include/types/activity.h b/include/types/activity.h
index 618785d..3725150 100644
--- a/include/types/activity.h
+++ b/include/types/activity.h
@@ -54,6 +54,8 @@
unsigned int accepted; // accepted incoming connections
unsigned int accq_pushed; // accept queue connections pushed
unsigned int accq_full; // accept queue connection not pushed because full
+ unsigned int pool_fail; // failed a pool allocation
+ unsigned int buf_wait; // waited on a buffer allocation
#if defined(DEBUG_DEV)
/* keep these ones at the end */
unsigned int ctr0; // general purposee debug counter