Skip to content

Conversation

@behzad-mir
Copy link
Contributor

Moving the lock from InitializeKeyValueStore() function to restore/save functions to improve cni performance on windows.

Reason for Change:
In Windows CNI We are currently lock access to statefile in the init phase which may cause some CNI performance issue. This PR will move the lock to the exact point when we read/write from/to statefile.

@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch 2 times, most recently from 12b7b4c to 9d6145d Compare December 5, 2022 17:07
Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

I'm also thinking..we should add these changes under a config field somethinng like "optimizeLock" so that we can release only to customers we want and also revert back easily for any mitigation

@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from 51bfd0d to c9919e2 Compare December 9, 2022 00:09
@behzad-mir behzad-mir requested a review from a team as a code owner December 12, 2022 22:25
@behzad-mir behzad-mir requested review from rsagasthya and removed request for a team December 12, 2022 22:25
@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from e205c74 to 4146ac6 Compare January 4, 2023 22:45
@behzad-mir behzad-mir enabled auto-merge (squash) January 4, 2023 23:40
@behzad-mir behzad-mir disabled auto-merge January 4, 2023 23:58
@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from ae3512f to b44ff46 Compare January 5, 2023 23:13
cni/plugin.go Outdated

// Lock key-value store for Windows Runtime. This function is being used for locking access to TelemetryService start.
func (plugin *Plugin) LockKeyValueStore() error {
if runtime.GOOS == "windows" {
Copy link
Member

Choose a reason for hiding this comment

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

can we move this condition to a place where we call LockKeyValueStore()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in the new commit

tb.Cleanup(FdName)
StartTelemetryService(path, args)
WaitForTelemetrySocket(telemetryNumRetries, time.Duration(telemetryWaitTimeInMilliseconds))
if err = netPlugin.UnLockKeyValueStore(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

unlock only if windows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in the new commit

@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from b44ff46 to 5915954 Compare January 6, 2023 20:03
@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from 5915954 to 276d2cf Compare January 6, 2023 20:51
Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

lgtm

@behzad-mir behzad-mir enabled auto-merge (squash) January 7, 2023 00:20
@behzad-mir behzad-mir force-pushed the behzadm-windows-cni-lock branch from 276d2cf to 47b69a3 Compare January 7, 2023 01:33
@behzad-mir behzad-mir merged commit 7b647be into master Jan 7, 2023
@behzad-mir behzad-mir deleted the behzadm-windows-cni-lock branch January 7, 2023 08:03
rjdenney pushed a commit to rjdenney/azure-container-networking that referenced this pull request Jan 19, 2023
* Moving the lock from InitializeKeyValueStore() function to restore/save functions to improve cni performance on windows.

* fix: use defer function to unlock statefile.

* fix: fixing the IPAM lock and defer func

* fix: Optimizing cni file lock by moving SetSdnRemoteArpMacAddress() on startup for CRD and MultitenantCRD mode.

* adding store lock on telemetry service start to avoid race condition on windows.
smittal22 pushed a commit to smittal22/azure-container-networking that referenced this pull request Jan 26, 2023
* Moving the lock from InitializeKeyValueStore() function to restore/save functions to improve cni performance on windows.

* fix: use defer function to unlock statefile.

* fix: fixing the IPAM lock and defer func

* fix: Optimizing cni file lock by moving SetSdnRemoteArpMacAddress() on startup for CRD and MultitenantCRD mode.

* adding store lock on telemetry service start to avoid race condition on windows.
smittal22 pushed a commit to smittal22/azure-container-networking that referenced this pull request Feb 3, 2023
* Moving the lock from InitializeKeyValueStore() function to restore/save functions to improve cni performance on windows.

* fix: use defer function to unlock statefile.

* fix: fixing the IPAM lock and defer func

* fix: Optimizing cni file lock by moving SetSdnRemoteArpMacAddress() on startup for CRD and MultitenantCRD mode.

* adding store lock on telemetry service start to avoid race condition on windows.
behzad-mir added a commit that referenced this pull request Feb 23, 2023
behzad-mir added a commit that referenced this pull request Feb 24, 2023
behzad-mir added a commit that referenced this pull request Feb 24, 2023
…event CNI fro…" (#1819)

* Revert "fix: Adding a defer func to connecttoTelemetryservice() to prevent CNI fro… (#1800)"

This reverts commit 879b644.

* Revert "fix: repair windows cni lock issue (#1712)"

This reverts commit 7b647be.

* mend
rjdenney pushed a commit that referenced this pull request Mar 13, 2023
…event CNI fro…" (#1819)

* Revert "fix: Adding a defer func to connecttoTelemetryservice() to prevent CNI fro… (#1800)"

This reverts commit 879b644.

* Revert "fix: repair windows cni lock issue (#1712)"

This reverts commit 7b647be.

* mend
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.

3 participants