neutron/neutron/tests/unit
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
..
agent Use diffs for iptables restore instead of all rules 2015-12-09 15:55:17 +00:00
api Avoid race condition for reserved DHCP ports 2015-11-27 12:42:53 +00:00
callbacks Improve callback registry devref documentation and usability 2015-08-12 10:15:07 -07:00
cmd Fix import path in neutron-sanity-check for ml2_sriov opts 2015-09-01 04:16:01 +00:00
common /common/utils.py py34 incompatibility 2015-10-02 09:26:08 -07:00
core_extensions QoS core extension: fixed dict extension when QoS policy is unset 2015-08-08 15:44:27 +02:00
db Merge "DVR:don't reschedule the l3 agent running on compute node" into stable/liberty 2015-12-09 13:08:01 +00:00
debug Reorganize unit test tree 2015-04-06 23:28:31 +00:00
extensions Validate ethertype for icmp protocols 2015-11-14 08:41:01 +01:00
hacking Restructure agent code in preparation for decomp 2015-06-26 15:06:49 +00:00
ipam Add the missing arg of RetryRequest exception in _lock_subnetpool 2015-11-27 13:11:00 +00:00
notifiers Merge "Revert "Revert "Add VIF_DELETED notification event to Nova""" 2015-08-12 18:05:47 +00:00
objects No network devices on network attached qos policies 2015-09-16 15:11:04 +02:00
plugins Don't drop ARP table jump during OVS rewiring 2015-11-25 18:34:12 -08:00
quota Reduce the chance of random check/gate test failures 2015-09-09 14:45:16 -07:00
scheduler Ensure l3 agent receives notification about added router 2015-12-03 15:17:50 +03:00
services Get rid of ConfigParser code in ProviderConfiguration 2015-09-21 10:55:56 -07:00
tests Merge "Different approach to indicate failure on SystemExit" 2015-07-16 06:57:16 +00:00
__init__.py oslo: migrate to namespace-less import paths 2015-02-05 15:09:32 +01:00
_test_extension_portbindings.py Context: Remove logic for read_deleted and deprecate it 2015-06-09 13:50:03 -07:00
dummy_plugin.py Remove lingering traces of q_ 2015-07-07 17:04:44 -04:00
extension_stubs.py Remove get_namespace from API extensions 2015-06-15 09:17:32 -04:00
test_auth.py oslo: migrate to namespace-less import paths 2015-02-05 15:09:32 +01:00
test_context.py Python 3: fix test_context 2015-07-27 16:57:08 +02:00
test_manager.py Flavor Framework implementation 2015-07-16 09:07:41 -07:00
test_policy.py Mock oslo policy HTTPCheck instead of urllib 2015-10-13 17:26:23 +02:00
test_service.py Refactor TestRpcWorker and TestWorkerService 2015-06-16 15:49:48 +03:00
test_wsgi.py Enable most unit tests for py34 job 2015-09-04 08:30:22 +00:00
testlib_api.py Improve fixture usage. 2015-07-01 14:53:48 +12:00