Skip to content

Commit

Permalink
ToR Agent OVSDB - performance on HA
Browse files Browse the repository at this point in the history
Issue:
------
After the initial read from OVSDB server all the previous
VlanPortBindingsEntries are created as Stale entries,
later on subscribing to operDB all the entries start getting
converted from stale to non-stale, however the data remains
same, where OVSDB client not identifying no op keeps on
triggering updates on Physical Port entry, resulting in
preformance degradation

Fix:
----
Keep track of old_logical_switch_name in vlan port binding
entry and if on change it is a no op avoid triggering
updates to physical port entry

Partial-Bug: #1456284
Change-Id: I4a61904056ca374a34d40823f623fc14dfbcff67
(cherry picked from commit 363ef44)
  • Loading branch information
Prabhjot Singh Sethi committed Jun 5, 2015
1 parent e5fe2a7 commit 819b18b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Expand Up @@ -35,13 +35,14 @@ VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
uint16_t vlan_tag, const std::string &logical_switch) :
OvsdbDBEntry(table_), logical_switch_name_(logical_switch),
physical_port_name_(physical_port), physical_device_name_(physical_device),
vlan_(vlan_tag), vmi_uuid_(nil_uuid()) {
vlan_(vlan_tag), vmi_uuid_(nil_uuid()), old_logical_switch_name_() {
}

VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
const VlanLogicalInterface *entry) : OvsdbDBEntry(table_),
logical_switch_name_(), physical_port_name_(),
physical_device_name_(""), vlan_(entry->vlan()), vmi_uuid_(nil_uuid()) {
physical_device_name_(""), vlan_(entry->vlan()), vmi_uuid_(nil_uuid()),
old_logical_switch_name_() {
RemotePhysicalInterface *phy_intf = dynamic_cast<RemotePhysicalInterface *>
(entry->physical_interface());
assert(phy_intf);
Expand All @@ -54,7 +55,7 @@ VlanPortBindingEntry::VlanPortBindingEntry(VlanPortBindingTable *table,
logical_switch_name_(key->logical_switch_name_),
physical_port_name_(key->physical_port_name_),
physical_device_name_(key->physical_device_name_), vlan_(key->vlan_),
vmi_uuid_(nil_uuid()) {
vmi_uuid_(nil_uuid()), old_logical_switch_name_() {
}

void VlanPortBindingEntry::PreAddChange() {
Expand All @@ -79,6 +80,11 @@ void VlanPortBindingEntry::AddMsg(struct ovsdb_idl_txn *txn) {
PhysicalPortEntry *port =
static_cast<PhysicalPortEntry *>(physical_port_.get());

// update logical switch name propagated to OVSDB server, this will
// be used in change Operation to reduce the unncessary computation
// when there is change which VlanPortBindingEntry is not
// interested into
old_logical_switch_name_ = logical_switch_name_;
if (!logical_switch_name_.empty()) {
port->AddBinding(vlan_,
static_cast<LogicalSwitchEntry *>(logical_switch_.get()));
Expand All @@ -98,6 +104,10 @@ void VlanPortBindingEntry::AddMsg(struct ovsdb_idl_txn *txn) {
}

void VlanPortBindingEntry::ChangeMsg(struct ovsdb_idl_txn *txn) {
if (logical_switch_name_ == old_logical_switch_name_) {
// no change return from here.
return;
}
PhysicalPortEntry *port =
static_cast<PhysicalPortEntry *>(physical_port_.get());
OVSDB_TRACE(Trace, "Changing port vlan binding port " +
Expand Down
Expand Up @@ -67,6 +67,7 @@ class VlanPortBindingEntry : public OvsdbDBEntry {
std::string physical_device_name_;
uint16_t vlan_;
boost::uuids::uuid vmi_uuid_;
std::string old_logical_switch_name_;
DISALLOW_COPY_AND_ASSIGN(VlanPortBindingEntry);
};
};
Expand Down

0 comments on commit 819b18b

Please sign in to comment.