Skip to content

Commit

Permalink
ovn-controller: Handle addresses addition in address set incrementally.
Browse files Browse the repository at this point in the history
To avoid reprocessing the lflow when a referenced address set has new
addresses added, this patch generates a fake address set that only
contains the added addresses for flow generation, and then eliminates
the flows that are not related to the newly added addresses.

Scale test shows obvious performance gains because the time complexity
changed from O(n) to O(1). The bigger the size of address set, the more
CPU savings. With the AS size of 10k, the test shows ~40x speed up.

Test setup:
CPU: Intel(R) Core(TM) i9-7920X CPU @ 2.90GHz.
5 ACL all referencing an address set of 10,000 IPs.

Measure the time spent by ovn-controller for handling one IP
addition from the address set.

Before: ~400ms
After: 11-12ms

Signed-off-by: Han Zhou <hzhou@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
Acked-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
hzhou8 committed Feb 24, 2022
1 parent 6a60154 commit 7c0b538
Show file tree
Hide file tree
Showing 7 changed files with 396 additions and 36 deletions.
15 changes: 15 additions & 0 deletions controller/lflow-conj-ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ static void lflow_conj_ids_insert_(struct conj_ids *,
const struct uuid *lflow_uuid,
const struct uuid *dp_uuid,
uint32_t start_conj_id, uint32_t n_conjs);
static struct lflow_conj_node *
lflow_conj_ids_find_(struct conj_ids *conj_ids, const struct uuid *lflow_uuid,
const struct uuid *dp_uuid);
static void lflow_conj_ids_free_(struct conj_ids *, struct lflow_conj_node *);
static void lflow_conj_ids_free_for_lflow_dp(struct conj_ids *,
const struct uuid *lflow_uuid,
Expand Down Expand Up @@ -197,6 +200,18 @@ lflow_conj_ids_alloc_specified(struct conj_ids *conj_ids,
return true;
}

/* Find and return the start id that is allocated to the logical flow for the
* dp_uuid. Return 0 if not found. */
uint32_t
lflow_conj_ids_find(struct conj_ids *conj_ids, const struct uuid *lflow_uuid,
const struct uuid *dp_uuid)
{
struct lflow_conj_node *lflow_conj = lflow_conj_ids_find_(conj_ids,
lflow_uuid,
dp_uuid);
return lflow_conj ? lflow_conj->start_conj_id : 0;
}

/* Frees the conjunction IDs used by lflow_uuid. */
void
lflow_conj_ids_free(struct conj_ids *conj_ids, const struct uuid *lflow_uuid)
Expand Down
2 changes: 2 additions & 0 deletions controller/lflow-conj-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ bool lflow_conj_ids_alloc_specified(struct conj_ids *,
const struct uuid *dp_uuid,
uint32_t start_conj_id, uint32_t n_conjs);
void lflow_conj_ids_free(struct conj_ids *, const struct uuid *lflow_uuid);
uint32_t lflow_conj_ids_find(struct conj_ids *, const struct uuid *lflow_uuid,
const struct uuid *dp_uuid);
void lflow_conj_ids_init(struct conj_ids *);
void lflow_conj_ids_destroy(struct conj_ids *);
void lflow_conj_ids_clear(struct conj_ids *);
Expand Down

0 comments on commit 7c0b538

Please sign in to comment.