Similarly to strings, 24 bytes that we have in 'struct json' can fit
up to 3 JSON_ARRAY elements. And we can use separate storage types
to count them.
There are many small arrays in typical databases, for example, every
UUID is a 2-element array. So, the change does have a noticeable
performance impact.
With 350MB OVN Northbound database with 12M atoms:
Before After Improvement
ovsdb-client dump 16.6 sec 14.9 sec 10.2 %
Compaction 13.4 sec 11.0 sec 17.9 %
Memory usage (RSS) 2.05 GB 1.90 GB 7.3 %
With 615MB OVN Southbound database with 23M atoms:
Before After Improvement
ovsdb-client dump 43.7 sec 40.5 sec 7.3 %
Compaction 32.5 sec 29.4 sec 9.5 %
Memory usage (RSS) 4.80 GB 4.46 GB 7.1 %
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.
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>