Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce API mutex locking #3618

Merged
merged 3 commits into from
Jul 28, 2021
Merged

Reduce API mutex locking #3618

merged 3 commits into from
Jul 28, 2021

Conversation

buger
Copy link
Member

@buger buger commented Jul 9, 2021

At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If pulling from your own
    fork, don't request your master!
  • Make sure you are making a pull request against the master branch (left side). Also, you should start
    your branch off our latest master.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
    • If new config option added, ensure that it can be set via ENV variable
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • When updating library version must provide reason/explanation for this update.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • go fmt -s
    • go vet

buger added 2 commits July 9, 2021 14:46
At the moment it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially shoud fix https://tyktech.atlassian.net/browse/TD-123
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Jul 27, 2021
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Jul 27, 2021
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Jul 27, 2021
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Jul 27, 2021
@buger buger merged commit 2475fb2 into master Jul 28, 2021
@buger buger deleted the fix/td-123-api-lock branch July 28, 2021 11:02
@buger
Copy link
Member Author

buger commented Jul 28, 2021

/release to release-3

@buger
Copy link
Member Author

buger commented Jul 28, 2021

/release to release-3.2

@buger
Copy link
Member Author

buger commented Jul 28, 2021

/release to release-3.2.2

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Working on it! Note that it can take a few minutes.

1 similar comment
@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Working on it! Note that it can take a few minutes.

@buger
Copy link
Member Author

buger commented Jul 28, 2021

/release to release-3-lts

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Working on it! Note that it can take a few minutes.

tykbot bot pushed a commit that referenced this pull request Jul 28, 2021
At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

## How This Has Been Tested
<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests you ran to see how your change affects other areas of
the code, etc. -->

## Screenshots (if appropriate)

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes that apply -->
<!-- If you're unsure about any of these, don't hesitate to ask; we're here to help! -->
- [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). If pulling from your own
      fork, don't request your `master`!
- [ ] Make sure you are making a pull request against the **`master` branch** (left side). Also, you should start
      *your branch* off *our latest `master`*.
- [ ] My change requires a change to the documentation.
  - [ ] If you've changed APIs, describe what needs to be updated in the documentation.
  - [ ] If new config option added, ensure that it can be set via ENV variable
- [ ] I have updated the documentation accordingly.
- [ ] Modules and vendor dependencies have been updated; run `go mod tidy && go mod vendor`
- [ ] When updating library version must provide reason/explanation for this update.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Check your code additions will not fail linting checks:
  - [ ] `go fmt -s`
  - [ ] `go vet`

(cherry picked from commit 2475fb2)
@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Working on it! Note that it can take a few minutes.

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

@buger Succesfully merged 2475fb25c3dd609cc5f6103685f23fdba705651e to release-3 branch.

@buger
Copy link
Member Author

buger commented Jul 28, 2021

/release to release-3.0.7

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Still working...

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

@buger Seems like there is conflict and it require manual merge.

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Working on it! Note that it can take a few minutes.

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Still working...

1 similar comment
@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Still working...

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

@buger Seems like there is conflict and it require manual merge.

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

Still working...

@tykbot
Copy link

tykbot bot commented Jul 28, 2021

@buger Seems like there is conflict and it require manual merge.

1 similar comment
@tykbot
Copy link

tykbot bot commented Jul 28, 2021

@buger Seems like there is conflict and it require manual merge.

buger added a commit that referenced this pull request Aug 6, 2021
At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests you ran to see how your change affects other areas of
the code, etc. -->

<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

<!-- Go over all the following points, and put an `x` in all the boxes that apply -->
<!-- If you're unsure about any of these, don't hesitate to ask; we're here to help! -->
- [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). If pulling from your own
      fork, don't request your `master`!
- [ ] Make sure you are making a pull request against the **`master` branch** (left side). Also, you should start
      *your branch* off *our latest `master`*.
- [ ] My change requires a change to the documentation.
  - [ ] If you've changed APIs, describe what needs to be updated in the documentation.
  - [ ] If new config option added, ensure that it can be set via ENV variable
- [ ] I have updated the documentation accordingly.
- [ ] Modules and vendor dependencies have been updated; run `go mod tidy && go mod vendor`
- [ ] When updating library version must provide reason/explanation for this update.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Check your code additions will not fail linting checks:
  - [ ] `go fmt -s`
  - [ ] `go vet`
buger added a commit that referenced this pull request Aug 6, 2021
At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests you ran to see how your change affects other areas of
the code, etc. -->

<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

<!-- Go over all the following points, and put an `x` in all the boxes that apply -->
<!-- If you're unsure about any of these, don't hesitate to ask; we're here to help! -->
- [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). If pulling from your own
      fork, don't request your `master`!
- [ ] Make sure you are making a pull request against the **`master` branch** (left side). Also, you should start
      *your branch* off *our latest `master`*.
- [ ] My change requires a change to the documentation.
  - [ ] If you've changed APIs, describe what needs to be updated in the documentation.
  - [ ] If new config option added, ensure that it can be set via ENV variable
- [ ] I have updated the documentation accordingly.
- [ ] Modules and vendor dependencies have been updated; run `go mod tidy && go mod vendor`
- [ ] When updating library version must provide reason/explanation for this update.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Check your code additions will not fail linting checks:
  - [ ] `go fmt -s`
  - [ ] `go vet`
buger added a commit that referenced this pull request Aug 6, 2021
At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests you ran to see how your change affects other areas of
the code, etc. -->

<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

<!-- Go over all the following points, and put an `x` in all the boxes that apply -->
<!-- If you're unsure about any of these, don't hesitate to ask; we're here to help! -->
- [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). If pulling from your own
      fork, don't request your `master`!
- [ ] Make sure you are making a pull request against the **`master` branch** (left side). Also, you should start
      *your branch* off *our latest `master`*.
- [ ] My change requires a change to the documentation.
  - [ ] If you've changed APIs, describe what needs to be updated in the documentation.
  - [ ] If new config option added, ensure that it can be set via ENV variable
- [ ] I have updated the documentation accordingly.
- [ ] Modules and vendor dependencies have been updated; run `go mod tidy && go mod vendor`
- [ ] When updating library version must provide reason/explanation for this update.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Check your code additions will not fail linting checks:
  - [ ] `go fmt -s`
  - [ ] `go vet`
buger added a commit that referenced this pull request Aug 6, 2021
At the moment, it locks for the whole period of getting APIs from Dash/RPC and parsing the output.
In the context of Legacy Cloud it can be a few seconds.

Mutex should be locked only when we swap the global variable.

Potentially should fix https://tyktech.atlassian.net/browse/TD-123

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests you ran to see how your change affects other areas of
the code, etc. -->

<!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

<!-- Go over all the following points, and put an `x` in all the boxes that apply -->
<!-- If you're unsure about any of these, don't hesitate to ask; we're here to help! -->
- [ ] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). If pulling from your own
      fork, don't request your `master`!
- [ ] Make sure you are making a pull request against the **`master` branch** (left side). Also, you should start
      *your branch* off *our latest `master`*.
- [ ] My change requires a change to the documentation.
  - [ ] If you've changed APIs, describe what needs to be updated in the documentation.
  - [ ] If new config option added, ensure that it can be set via ENV variable
- [ ] I have updated the documentation accordingly.
- [ ] Modules and vendor dependencies have been updated; run `go mod tidy && go mod vendor`
- [ ] When updating library version must provide reason/explanation for this update.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] Check your code additions will not fail linting checks:
  - [ ] `go fmt -s`
  - [ ] `go vet`
gernest added a commit that referenced this pull request Aug 10, 2021
* master:
  [TT-3061] Fix request signature when using custom keys (#3634)
  update graphql-go-tools version (#3635)
  Update README.md
  Reduce API mutex locking (#3618)
buger added a commit that referenced this pull request Jan 21, 2022
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.

1 participant