[ovs-discuss] OVN Database sizes - Auto compact feature

Mark Michelson mmichels at redhat.com
Wed Mar 7 14:35:27 UTC 2018

On 03/07/2018 07:40 AM, Daniel Alvarez Sanchez wrote:
> Hi folks,
> During the performance tests I've been doing lately I noticed
> that the size of the Southbound database was around 2.5GB
> in one of my setups. I couldn't dig further then but now I
> decided to explore a bit more and these are the results in
> my all-in-one OpenStack setup using OVN as a backend:
> * Created 800 ports on the same network (logical switch).
> * Deleted those 800 ports.
> * I logged the DB sizes for both NB and SB databases every second.
> See attached image for the results.
> At around x=2000, the creation task finished and deletion starts.
> As you can see, there's automatic compact happening in the
> NB database across the whole test. However, while I was deleting
> ports, the SB database stop shrinking and keeps growing.
> After the test finished, the DB sizes remaining the same
> thus SB database being around 34MB. It was not until I
> manually compacted it when it finally shrinked:
> [stack at ovn ovs]$ ls -alh ovnsb_db.db
> -rw-r--r--. 1 stack stack 34M Mar  7 12:04 ovnsb_db.db
> [stack at ovn ovs]$ sudo ovs-appctl -t 
> /usr/local/var/run/openvswitch/ovnsb_db.ctl ovsdb-server/compact
> [stack at ovn ovs]$ ls -alh ovnsb_db.db
> -rw-r--r--. 1 stack stack 207K Mar  7 13:32 ovnsb_db.db
> I'll try to investigate further in the code.
> Thanks,
> Daniel

Daniel and I discussed this offline and I think the attached result does 
not necessarily indicate a bug yet.

One of the requirements for the DB to compact automatically is that it 
needs to grow to at least 4x the size of the previous snapshot. In the 
graph, we can see that the first time the SB DB compacts (around 
x==1000), it shrinks down to ~5MB. We would expect the DB to compact 
again when it gets to ~20MB. This happens at around x==1900. The DB 
shrinks to ~9MB, so we would expect it to shrink again when it reaches 
~36MB. When the test ends, the SB DB is ~34 MB, so it is not quite large 
enough to compact yet. If the test had gone a bit longer, then 
presumably we might have seen the DB shrink again.

It will be interesting to see the test that leads to a 2.5GB southbound 


More information about the discuss mailing list