We have a lot of unused space in 'struct json' that can be used for storing short strings and arrays without requiring and extra memory allocation. More details are in commits themselves. The largest part of the patch set is refactoring to remove all the accesses to internals of 'struct json' from the other code. And this refactoring is, IMO, something that should be done even without the in-place storage change. After that, the structure changes are relatively small.
There are performance test results in individual patches, here is a summary for the case where the whole set is applied. With 350MB OVN Northbound database with 12M atoms: Before After Improvement ovsdb-client dump 18.6 sec 14.9 sec 19.9 % Compaction 14.0 sec 11.0 sec 21.4 % Memory usage (RSS) 2.28 GB 1.90 GB 16.7 % With 615MB OVN Southbound database with 23M atoms: Before After Improvement ovsdb-client dump 46.1 sec 40.5 sec 12.1 % Compaction 34.8 sec 29.4 sec 15.5 % Memory usage (RSS) 5.29 GB 4.46 GB 15.7 % In the results above, 'ovsdb-client dump' is measuring how log it takes for the server to prepare and send a reply, 'Memory usage (RSS)' reflects the RSS of the ovsdb-server after loading the full database. ovn-heater tests report similar reduction in CPU and memory usage on heavy operations like compaction. The set was initially prepared last year, but I just didn't get around of sending it. Version 2: * Fixed crash in patch 1 by moving the string vs serialized object split from patch 2 into patch 1. * Converted more serialized object accesses into specialized json_serialized_object() calls. * Removed storage type checks for the serialized object as they only apply to strings. The storage type for serialized objects is not meaningful. Ilya Maximets (4): json: Always use the json_string() method to access the strings. json: Store short strings in-place. json: Use functions to access json arrays. json: Store short arrays in-place. include/openvswitch/json.h | 39 ++++- lib/db-ctl-base.c | 8 +- lib/json.c | 316 +++++++++++++++++++++++++++---------- lib/jsonrpc.c | 4 +- lib/ovsdb-cs.c | 51 +++--- lib/ovsdb-data.c | 26 +-- lib/ovsdb-idl.c | 69 ++++---- lib/ovsdb-parser.c | 2 +- lib/ovsdb-types.c | 4 +- lib/unixctl.c | 18 ++- ovsdb/column.c | 11 +- ovsdb/condition.c | 24 ++- ovsdb/execution.c | 20 +-- ovsdb/jsonrpc-server.c | 106 +++++++------ ovsdb/log.c | 2 +- ovsdb/mutation.c | 33 ++-- ovsdb/ovsdb-client.c | 131 +++++++-------- ovsdb/ovsdb-idlc.in | 12 +- ovsdb/ovsdb-server.c | 10 +- ovsdb/ovsdb-tool.c | 32 ++-- ovsdb/ovsdb-util.c | 8 +- ovsdb/raft-private.c | 11 +- ovsdb/raft-private.h | 3 +- ovsdb/raft-rpc.c | 16 +- ovsdb/replication.c | 23 +-- ovsdb/storage.c | 17 +- ovsdb/table.c | 8 +- ovsdb/trigger.c | 4 +- python/ovs/_json.c | 10 +- python/ovs/db/data.py | 6 +- python/ovs/db/types.py | 2 +- tests/test-json.c | 23 ++- tests/test-jsonrpc.c | 2 +- tests/test-ovsdb.c | 109 +++++++------ 34 files changed, 694 insertions(+), 466 deletions(-) -- 2.49.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev