[ovs-discuss] Deleting internal ports takes too long

Ben Pfaff blp at nicira.com
Thu Aug 20 04:31:46 UTC 2015


On Thu, Aug 13, 2015 at 12:16:53PM -0700, Han Zhou wrote:
> On Thu, Aug 13, 2015 at 9:52 AM, Flavio Leitner <fbl at sysclose.org> wrote:
> >
> > You could try deleting a bunch of interfaces at once to avoid the
> > cost of reading all the configuration on every operation.
> >
> > ovs-vsctl del-port <bridge> <port1> -- del-port <bridge> <port2> ...
> >
> > fbl
> >
> 
> Hi Flavio,
> 
> Good suggestion!
> Yes, the time spent are mostly caused by the ovsdb transaction
> including the change notification to the controller.
> So combining multiple ports deletion in one transaction reduces the
> time significantly.

This is pretty much like the FAQ:

### Q: I want to add thousands of ports to an Open vSwitch bridge, but
   it takes too long (minutes or hours) to do it with ovs-vsctl.  How
   can I do it faster?

A: If you add them one at a time with ovs-vsctl, it can take a long
   time to add thousands of ports to an Open vSwitch bridge.  This is
   because every invocation of ovs-vsctl first reads the current
   configuration from OVSDB.  As the number of ports grows, this
   starts to take an appreciable amount of time, and when it is
   repeated thousands of times the total time becomes significant.

   The solution is to add the ports in one invocation of ovs-vsctl (or
   a small number of them).  For example, using bash:

       ovs-vsctl add-br br0
       cmds=; for i in {1..5000}; do cmds+=" -- add-port br0 p$i"; done
       ovs-vsctl $cmds

   takes seconds, not minutes or hours, in the OVS sandbox environment.



More information about the discuss mailing list