[ovs-dev] [PATCH] raft: Report jsonrpc backlog in kilobytes.

Ilya Maximets i.maximets at ovn.org
Tue Oct 20 11:16:44 UTC 2020


While sending snapshots backlog on raft connections could quickly
grow over 4GB and this will overflow raft-backlog counter.

Let's report it in kB instead. (Using kB and not KB to match with
ru_maxrss counter reported by kernel)

Fixes: 3423cd97f88f ("ovsdb: Add raft memory usage to memory report.")
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 ovsdb/raft.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 708b0624c..3411323aa 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -1020,13 +1020,14 @@ void
 raft_get_memory_usage(const struct raft *raft, struct simap *usage)
 {
     struct raft_conn *conn;
+    uint64_t backlog = 0;
     int cnt = 0;
 
     LIST_FOR_EACH (conn, list_node, &raft->conns) {
-        simap_increase(usage, "raft-backlog",
-                       jsonrpc_session_get_backlog(conn->js));
+        backlog += jsonrpc_session_get_backlog(conn->js);
         cnt++;
     }
+    simap_increase(usage, "raft-backlog-kB", backlog / 1000);
     simap_increase(usage, "raft-connections", cnt);
 }
 
-- 
2.25.4



More information about the dev mailing list