[ovs-git] [openvswitch/ovs] 222bed: ovsdb-monitor: Refactor ovsdb monitor implementation.

Han Zhou noreply at github.com
Thu Feb 28 19:15:10 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 222bed54cd97da30dc2d6c7da36a4f1c3e98adbf
      https://github.com/openvswitch/ovs/commit/222bed54cd97da30dc2d6c7da36a4f1c3e98adbf
  Author: Han Zhou <hzhou8 at ebay.com>
  Date:   2019-02-28 (Thu, 28 Feb 2019)

  Changed paths:
    M ovsdb/jsonrpc-server.c
    M ovsdb/monitor.c
    M ovsdb/monitor.h

  Log Message:
  -----------
  ovsdb-monitor: Refactor ovsdb monitor implementation.

Current ovsdb monitor maintains its own transaction version through an
incremental integer and use it to identify changes starting from different
version, and also use it to figure out if each set of changes should be
flushed. In particular, it uses number 0 to represent that the change set
contains all data for initial client population.  It is a smart way but it
prevents further extension of the monitoring mechanism to support future use
case for clients to request changes starting from a given history point. This
patch refactors the structures so that change sets are referenced directly
through the pointer. It uses additional members such as init_change_set,
new_change_set to indicates the specific change set explicitely, instead of
through calculated version numbers based on implicite rules.

At the same time, this patch provides better encapsulation for change set
(composed of data in a list of tables), while still allowing traversing
across change sets for a given table.

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 695e815027945cbefe3619fc3fc0c93942a1beb8
      https://github.com/openvswitch/ovs/commit/695e815027945cbefe3619fc3fc0c93942a1beb8
  Author: Han Zhou <hzhou8 at ebay.com>
  Date:   2019-02-28 (Thu, 28 Feb 2019)

  Changed paths:
    M ovsdb/ovsdb-server.c
    M ovsdb/ovsdb.c
    M ovsdb/ovsdb.h
    M ovsdb/transaction.c
    M ovsdb/transaction.h

  Log Message:
  -----------
  ovsdb-server: Transaction history tracking.

Maintaining last N (n = 100) transactions in memory, which will be
used for future patches for generating monitor data from any point
in this N transactions.

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 9167cb52fa8708ff524be9fc41a8f5ccdfa0a15d
      https://github.com/openvswitch/ovs/commit/9167cb52fa8708ff524be9fc41a8f5ccdfa0a15d
  Author: Han Zhou <hzhou8 at ebay.com>
  Date:   2019-02-28 (Thu, 28 Feb 2019)

  Changed paths:
    M Documentation/ref/ovsdb-server.7.rst
    M ovsdb/jsonrpc-server.c
    M ovsdb/monitor.c
    M ovsdb/monitor.h
    M ovsdb/ovsdb-client.1.in
    M ovsdb/ovsdb-client.c
    M ovsdb/transaction.c
    M ovsdb/transaction.h
    M tests/ovsdb-monitor.at

  Log Message:
  -----------
  ovsdb-monitor: Support monitor_cond_since.

Support the new monitor method monitor_cond_since so that a client
can request monitoring start from a specific point instead of always
from beginning. This will reduce the cost at scenarios when server
is restarted/failed-over but client still has all existing data. In
these scenarios only new changes (and in most cases no change) needed
to be transfered to client. When ovsdb-server restarted, history
transactions are read from disk file; when ovsdb-server failed over,
history transactions exists already in the memory of the new server.

There are situations that the requested transaction may not be found.
For example, a transaction that is too old and has been discarded
from the maintained history list in memory, or the transactions on
disk has been compacted during ovsdb compaction. In those situations
the server fall backs to transfer all data start from begining.

For more details of the protocol change, see
Documentation/ref/ovsdb-server.7.rst.

This change includes both server side and ovsdb-client side changes
with the new protocol. IDLs using this capability will be added in
future patches.

Now the feature takes effect only for cluster mode of ovsdb-server,
because cluster mode is the only mode that supports unique transcation
uuid today. For other modes, the monitor_cond_since always fall back
to transfer all data with found = false. Support for those modes can
be added in the future.

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: b49b9316a48b3997b3dcb738af6838617b610f12
      https://github.com/openvswitch/ovs/commit/b49b9316a48b3997b3dcb738af6838617b610f12
  Author: Han Zhou <hzhou8 at ebay.com>
  Date:   2019-02-28 (Thu, 28 Feb 2019)

  Changed paths:
    M lib/ovsdb-idl.c

  Log Message:
  -----------
  ovsdb-idl: Support monitor_cond_since method in C IDL.

Use monitor_cond_since in C IDL. If it is not supported by server,
fall back to old method (monitor_cond, or monitor).

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


  Commit: 403a6a0cb003f1d48b0a3cbf11a2806c45e9d076
      https://github.com/openvswitch/ovs/commit/403a6a0cb003f1d48b0a3cbf11a2806c45e9d076
  Author: Han Zhou <hzhou8 at ebay.com>
  Date:   2019-02-28 (Thu, 28 Feb 2019)

  Changed paths:
    M lib/ovsdb-idl.c

  Log Message:
  -----------
  ovsdb-idl: Fast resync from server when connection reset.

Use monitor_cond_since to request changes after last version of local
data when connection to server is reset, without clearing the local
data. It falls back to clearing and repopulating all the data when
the requested id cannot be fulfilled by the server.

Test result at ovn-scale-test environment using clustered mode:
- 1K HVs (ovsdb clients)
- 10K lports

Without the patch it took 30+ min for the SB ovsdb-server to calm down
and HVs to stablize the connectin and finish syncing data.

With the patch there were no noticible CPU spike of SB ovsdb-server,
and all HVs were in sync with SB within 1 min, which is the probe
interval set in this test (so it took at most 1 min for HVs to notice
the TCP connection reset and reconnect and resync finished immediately
after that).

Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2018-September/047457.html
Signed-off-by: Han Zhou <hzhou8 at ebay.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>


Compare: https://github.com/openvswitch/ovs/compare/abe3cf8fd040...403a6a0cb003


More information about the git mailing list