neutron/neutron/tests/unit/agent
Kevin Benton fb55693713 Use diffs for iptables restore instead of all rules
This patch changes our iptables logic to generate a delta of
iptables commands (inserts + deletes) to get from the current
iptables state to the new state. This will significantly reduce
the amount of data that we have to shell out to iptables-restore
on every call (and reduce the amount of data iptables-restore has
to parse).

We no longer have to worry about preserving counters since
we are adding and deleting specific rules, so the rule modification
code got a nice cleanup to get rid of the old rule matching.

This also gives us a new method of functionally testing that we are
generating rules in the correct manner. After applying new rules
once, a subsequent call should always have no work to do. The new
functional tests added leverage that property heavily and should
protect us from regressions in how rules are formed.


Performance metrics relative to HEAD~1:
+====================================+============+=======+
|               Scenario             | This patch | HEAD~1|
|------------------------------------|------------|-------|
| 200 VMs*22 rules existing - startup|            |       |
|                       _modify_rules|   0.67s    | 1.05s |
|                 _apply_synchronized|   1.87s    | 2.89s |
|------------------------------------|------------|-------|
| 200 VMs*22 rules existing - add VM |            |       |
|                       _modify_rules|   0.68s    | 1.05s |
|                 _apply_synchronized|   2.07s    | 2.92s |
|------------------------------------+------------+-------+
|200 VMs*422 rules existing - startup|            |       |
|                       _modify_rules|   5.43s    | 8.17s |
|                 _apply_synchronized|  12.77s    |28.00s |
|------------------------------------|------------|-------|
|200 VMs*422 rules existing - add VM |            |       |
|                       _modify_rules|   6.41s    | 8.33s |
|                 _apply_synchronized|  33.09s    |33.80s |
+------------------------------------+------------+-------+

The _apply_synchronized times seem to converge when dealing
with ~85k rules. In the profile I can see that both approaches
seem to wait on iptables-restore for approximately the same
amount of time so it could be hitting the performance limits
of iptables-restore.

DocImpact
Partial-Bug: #1502297
Change-Id: Ia6470c85b6b71979006ffe5da9095fdcce3122c1
(cherry picked from commit f066e46bb7)
2015-12-09 15:55:17 +00:00
..
common Better tolerate deleted OVS ports in OVS agent 2015-11-01 17:34:10 +00:00
dhcp Cleanup dhcp namespace upon dhcp setup. 2015-11-14 13:40:19 +01:00
l2 No network devices on network attached qos policies 2015-09-16 15:11:04 +02:00
l3 Merge "Don't add default route to HA router if there is no gateway ip" into stable/liberty 2015-11-19 19:38:27 +00:00
linux Use diffs for iptables restore instead of all rules 2015-12-09 15:55:17 +00:00
metadata metadata: don't crash proxy on non-unicode user data 2015-10-02 15:54:26 +00:00
ovsdb ovsdb: attempt to enable connection_uri for native impl on startup 2015-06-25 10:09:42 +02:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
test_rpc.py Fix a microsecond format of isoformat() 2015-07-28 13:54:56 +09:00
test_securitygroups_rpc.py Use diffs for iptables restore instead of all rules 2015-12-09 15:55:17 +00:00