<div dir="ltr">I agree with you Mark. I tried to check how much it would shrink with 1800 ports in the system:<div><br></div><div><div>[stack@ovn ovs]$ sudo ovn-nbctl list Logical_Switch_Port | grep uuid | wc -l</div><div>1809</div><div>[stack@ovn ovs]$ sudo ovn-sbctl list Logical_Flow | grep uuid | wc -l                                                                                                                         </div><div>50780</div><div>[stack@ovn ovs]$ ls -alh ovn*.db                                                                                                                                                              </div><div>-rw-r--r--. 1 stack stack 15M Mar  8 15:56 ovnnb_db.db</div><div>-rw-r--r--. 1 stack stack 61M Mar  8 15:56 ovnsb_db.db</div><div>[stack@ovn ovs]$ sudo ovs-appctl -t /usr/local/var/run/openvswitch/ovnsb_db.ctl ovsdb-server/compact </div><div>[stack@ovn ovs]$ sudo ovs-appctl -t /usr/local/var/run/openvswitch/ovnnb_db.ctl ovsdb-server/compact                                                                                          </div><div>[stack@ovn ovs]$ ls -alh ovn*.db</div><div>-rw-r--r--. 1 stack stack 5.8M Mar  8 20:45 ovnnb_db.db</div><div>-rw-r--r--. 1 stack stack  23M Mar  8 20:45 ovnsb_db.db</div><div><br></div><div>As you can see, with ~50K lflows, the database min size would be ~23M while the NB database</div><div>is much smaller. Still I think we need to do something to not allow delay the compact task to</div><div>kick in this much unnecessarily. Or maybe we want some sort of configuration (ie. normal, aggressive,...)</div><div>for this since in some situations it may help to have the full log of the DB (although this can be</div><div>achieved through periodic backups :?). That said, I&#39;m not a big fan of such configs but...</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 8, 2018 at 9:31 PM, Mark Michelson <span dir="ltr">&lt;<a href="mailto:mmichels@redhat.com" target="_blank">mmichels@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Most of the data in this thread has been pretty easily explainable based on what I&#39;ve seen in the code compared with the nature of the data in the southbound database.<br>
<br>
The southbound database tends to have more data in it than other databases in OVS, due especially to the Logical_Flow table. The result is that auto shrinking of the database does not shrink it down by as much as other databases. You can see in Daniel&#39;s graphs that each time the southbound database is shrunk, its &quot;base&quot; size ends up noticeably larger than it previously was.<br>
<br>
Couple that with the fact that the database has to increase to 4x its previous snapshot size in order to be shrunk, and you can end up with a situation after a while where the &quot;shrunk&quot; southbound database is 750MB, and it won&#39;t shrink again until it exceeds 3GB.<br>
<br>
To fix this, I think there are a few things that can be done:<br>
<br>
* Somehow make the southbound database have less data in it. I don&#39;t have any real good ideas for how to do this, and doing this in a backwards-compatible way will be difficult.<br>
<br>
* Ease the requirements for shrinking a database. For instance, once the database reaches a certain size, maybe it doesn&#39;t need to grow by 4x in order to be a candidate for shrinking. Maybe it only needs to double in size. Or, there could be some time cutoff where the database always will be shrunk. So for instance, every hour, always shrink the database, no matter how much activity has occurred in it (okay, maybe not if there have been 0 transactions).</blockquote><div><br></div><div>Maybe we can just do the the shrink if the last compact took place &gt;24h ago regardless of the other conditions.</div><div>I can send a patch for this if you guys like the idea. It&#39;s some sort of &quot;cleanup task&quot; just in case and seems harmless.</div><div>What do you say?</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
On 03/07/2018 02:50 PM, Ben Pfaff wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
OK.<br>
<br>
I guess we need to investigate this issue from the basics.<br>
<br>
On Wed, Mar 07, 2018 at 09:02:02PM +0100, Daniel Alvarez Sanchez wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
With OVS 2.8 branch it never shrank when I started to delete the ports since<br>
the DB sizes didn&#39;t grow, which makes sense to me. The conditions weren&#39;t<br>
met for further compaction.<br>
See attached image.<br>
<br>
NB:<br>
2018-03-07T18:25:49.269Z|00009<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnnb_db.db:<br>
compacting database online (647.317 seconds old, 436 transactions, 10505382<br>
bytes)<br>
2018-03-07T18:35:51.414Z|00012<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnnb_db.db:<br>
compacting database online (602.089 seconds old, 431 transactions, 29551917<br>
bytes)<br>
2018-03-07T18:45:52.263Z|00015<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnnb_db.db:<br>
compacting database online (600.563 seconds old, 463 transactions, 52843231<br>
bytes)<br>
2018-03-07T18:55:53.810Z|00016<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnnb_db.db:<br>
compacting database online (601.128 seconds old, 365 transactions, 57618931<br>
bytes)<br>
<br>
<br>
SB:<br>
2018-03-07T18:33:24.927Z|00009<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnsb_db.db:<br>
compacting database online (1102.840 seconds old, 775 transactions,<br>
10505486 bytes)<br>
2018-03-07T18:43:27.569Z|00012<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnsb_db.db:<br>
compacting database online (602.394 seconds old, 445 transactions, 15293972<br>
bytes)<br>
2018-03-07T18:53:31.664Z|00015<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnsb_db.db:<br>
compacting database online (603.605 seconds old, 385 transactions, 19282371<br>
bytes)<br>
2018-03-07T19:03:42.116Z|00031<wbr>|ovsdb_file|INFO|/opt/stack/<wbr>data/ovs/ovnsb_db.db:<br>
compacting database online (607.542 seconds old, 371 transactions, 23538784<br>
bytes)<br>
<br>
<br>
<br>
<br>
On Wed, Mar 7, 2018 at 7:18 PM, Daniel Alvarez Sanchez &lt;<a href="mailto:dalvarez@redhat.com" target="_blank">dalvarez@redhat.com</a>&gt;<br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
No worries, I just triggered the test now running OVS compiled out of<br>
2.8 branch (2.8.3). I&#39;ll post the results and investigate too.<br>
<br>
I have just sent a patch to fix the timing issue we can see in the traces I<br>
posted. I applied it and it works, I believe it&#39;s good to fix as it gives<br>
us<br>
an idea of how frequent the compact is, and also to backport if you<br>
agree with it.<br>
<br>
Thanks!<br>
<br>
On Wed, Mar 7, 2018 at 7:13 PM, Ben Pfaff &lt;<a href="mailto:blp@ovn.org" target="_blank">blp@ovn.org</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
OK, thanks.<br>
<br>
If this is a lot of trouble, let me know and I&#39;ll investigate directly<br>
instead of on the basis of a suspected regression.<br>
<br>
On Wed, Mar 07, 2018 at 07:06:50PM +0100, Daniel Alvarez Sanchez wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
All right, I&#39;ll repeat it with code in branch-2.8.<br>
Will post the results once the test finishes.<br>
Daniel<br>
<br>
On Wed, Mar 7, 2018 at 7:03 PM, Ben Pfaff &lt;<a href="mailto:blp@ovn.org" target="_blank">blp@ovn.org</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On Wed, Mar 07, 2018 at 05:53:15PM +0100, Daniel Alvarez Sanchez<br>
</blockquote></blockquote>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Repeated the test with 1000 ports this time. See attached image.<br>
For some reason, the sizes grow while deleting the ports (the<br>
deletion task starts at around x=2500). The weird thing is why<br>
they keep growing and the online compact doesn&#39;t work as when<br>
I do it through ovs-appctl tool.<br>
<br>
I suspect this is a bug and eventually it will grow and grow unless<br>
we manually compact the db.<br>
</blockquote>
<br>
Would you mind trying out an older ovsdb-server, for example the one<br>
from OVS 2.8?  Some of the logic in ovsdb-server around compaction<br>
changed in OVS 2.9, so it would be nice to know whether this was a<br>
regression or an existing bug.<br>
<br>
</blockquote></blockquote>
<br>
</blockquote>
<br>
<br>
</blockquote></blockquote>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div></div>