Skip to content

Conversation

@ashvindeodhar
Copy link
Member

Loopback adapter creation operation comprises of two operations - createInterface and setWeakHostOnInterface. These operations take place inside the lock. If there are simultaneous requests, it interleaves these calls causing every loopback adapter creation to absorb the delay due to interleaving. createInterface can take time in seconds (typically 2 to 7 seconds based on the tests) while setWeakHostOnInterface finishes very quickly ( less than a second ). This change calls setWeakHostOnInterface within the same lock if createInterface succeeds. The tests show this improves the loopback adapter creation times for simultaneous requests.

What this PR does / why we need it:

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:

Release note:

@codecov
Copy link

codecov bot commented Sep 26, 2019

Codecov Report

Merging #408 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #408   +/-   ##
=======================================
  Coverage   52.29%   52.29%           
=======================================
  Files          28       28           
  Lines        4044     4044           
=======================================
  Hits         2115     2115           
  Misses       1654     1654           
  Partials      275      275

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 149062d...951d5cf. Read the comment docs.

bytes, err := c.Output()
loopbackOperationLock.Unlock()

if err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we can just combine this? a single line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which lines are you suggesting to combine?

}

func setWeakHostOnInterface(ipAddress string) error {
func setWeakHostOnInterface(ipAddress, ncID string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this function even needed now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean separately?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there way to asset the lock has been acquired already?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asset the lock?
Keeping the function separate because it's still a separate functionality

}

func setWeakHostOnInterface(ipAddress string) error {
func setWeakHostOnInterface(ipAddress, ncID string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there way to asset the lock has been acquired already?

@ashvindeodhar ashvindeodhar merged commit df4f226 into Azure:master Sep 30, 2019
@ashvindeodhar ashvindeodhar deleted the networkcontainer-optimization branch September 30, 2019 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants