In short, database snapshot stored inside the raft module is
a huge json object.  E.g. in ovn-heater scale tests with 270 MB
on-disk Southbound DB, json object of a snapshot takes 1.6 GB of
RAM out of total 3.8 GB of the RSS of an ovsdb-server process.

Second patch of the set is targeted to free that json object as
soon as it no longer needed and keep its serialized version instead.
First patch provides required json infrastructure.

Testing on a bit smaller cluster with 97 MB of on-disk database
showed *58%* of the memory consumption decrease with this change.
Testing with 270 MB database showed RSS decrease by 1.5 GB.

The third patch re-uses same json infrastructure to significantly
reduce CPU time by pre-serializing json cache.

All changes applied allowed to reduce CPU time by 50% and memory
consumption by 1.5G on 120 node density-heavy test with ovn-heater.
Duration of long poll intervals on Southbound database dropped
from 7.5 to 2 seconds.

More details on testing and implementation in commit messages.

Version 2:
 - Added patch #3.
 - Updated test data in commit messages.

Ilya Maximets (3):
  json: Add support for partially serialized json objects.
  raft: Don't keep full json objects in memory if no longer needed.
  ovsdb: monitor: Store serialized json in a json cache.

 include/openvswitch/json.h |   9 ++-
 lib/json.c                 |  34 ++++++++++++
 ovsdb/monitor.c            |   9 +++
 ovsdb/ovsdb-tool.c         |  10 ++--
 ovsdb/raft-private.c       | 111 +++++++++++++++++++++++++++++++++----
 ovsdb/raft-private.h       |  12 +++-
 ovsdb/raft.c               |  94 +++++++++++++++++--------------
 ovsdb/raft.h               |   3 +-
 ovsdb/storage.c            |   4 +-
 9 files changed, 220 insertions(+), 66 deletions(-)

-- 
2.31.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to