On 6/19/24 2:54 PM, Mike Pattrick wrote:
> Currently all OVSDB database queries except for UUID lookups all result
> in linear lookups over the entire table, even if an index is present.
> 
> This patch modifies ovsdb_query() to attempt an index lookup first, if
> possible. If no matching indexes are present then a linear index is
> still conducted.
> 
> To test this, I set up an ovsdb database with a variable number of rows
> and timed the average of how long ovsdb-client took to query a single
> row. The first two tests involved a linear scan that didn't match any
> rows, so there was no overhead associated with sending or encoding
> output. The post-patch linear scan was a worst case scenario where the
> table did have an appropriate index but the conditions made its usage
> impossible. The indexed lookup test was for a matching row, which did
> also include overhead associated with a match. The results are included
> in the table below.
> 
> Rows                   | 100k | 200k | 300k | 400k | 500k
> -----------------------+------+------+------+------+-----
> Pre-patch linear scan  |  9ms | 24ms | 37ms | 49ms | 61ms
> Post-patch linear scan |  9ms | 24ms | 38ms | 49ms | 61ms
> Indexed lookup         |  3ms |  3ms |  3ms |  3ms |  3ms
> 
> I also tested the performance of ovsdb_query() by wrapping it in a loop
> and measuring the time it took to perform 1000 linear scans on 1, 10,
> 100k, and 200k rows. This test showed that the new index checking code
> did not slow down worst case lookups to a statistically detectable
> degree.
> 
> Reported-at: https://issues.redhat.com/browse/FDP-590
> Signed-off-by: Mike Pattrick <m...@redhat.com>
> 
> ---
> 
> v3:
>  - Included txn in index code
>  - Added benchmarks
>  - Refactored code
>  - Added more tests
>  - Now a mock row is created to perform the search with standard
>  functions
> Signed-off-by: Mike Pattrick <m...@redhat.com>
> ---
>  ovsdb/execution.c        |  20 +++--
>  ovsdb/query.c            | 174 +++++++++++++++++++++++++++++++++++----
>  ovsdb/query.h            |   6 +-
>  ovsdb/rbac.c             |  15 ++--
>  ovsdb/rbac.h             |  10 ++-
>  ovsdb/row.h              |  28 +++++++
>  ovsdb/transaction.c      |  29 +------
>  ovsdb/transaction.h      |   5 ++
>  tests/ovsdb-execution.at | 108 +++++++++++++++++++++++-
>  tests/ovsdb-macros.at    |  10 +++
>  tests/ovsdb-query.at     |  18 ++--
>  tests/ovsdb-server.at    |   2 +-
>  tests/ovsdb-tool.at      |   2 +-
>  tests/test-ovsdb.c       |  15 +++-
>  14 files changed, 363 insertions(+), 79 deletions(-)

Thanks, Mike!  Sorry it took so long...

The change doesn't really affect normal applications that use IDL, especially
because the indexes are not used for in-flight transactions, but it is useful
for manual queries.

Applied.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to