-
Notifications
You must be signed in to change notification settings - Fork 62
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
Ability to Delete Mocks #303
Comments
Hi,
Currently Smocker is not necessarily optimized. It loads everything in memory and simply loops over each mock of the current session every time it receives a call. You can see it here: https://github.com/smocker-dev/smocker/blob/main/server/handlers/mocks.go#L53 This can be optimized using go routines to retrieve matched mocks faster but I'm not sure it will reduce the CPU usage. |
@gwleclerc thank you for the reply!
Currently not using sessions, as to my understanding, you can only use a single session at a time.
I'd guesstimate somewhere around ~20 mocks per test, each being unique mocks. While there are varying degrees of overlap between mocks, between tests, they are ultimately unique in smocker's eyes.
We did at first, but set a static retention value as we aren't currently interested in validating the mock payload was as expected, because we're inherently validating that with downstream changes in the logic. If the mock didn't return as expected, the data after the fact wouldn't be shaped as expected.
Thats a tough gauge but I will look into how I can assert that for you and get back to you asap. |
Howdy!
TLDR; Smocker appears to be increasing in CPU utilization as my integration suite grows. Having the ability to remove orphaned mocks may alleviate this.
First off, I saw this other issue that brought up edit/deletion of mocks, and the response therein.
However, my use case is different and wanted to at least plant the seed of hope.
I'm leveraging your wonderful service as a go-between for my integration suite.
The suite spins up all the necessary infra, including smocker, and then runs tests against those services.
Smocker acts as the dependency gap coverage, so each service in the infra points to smocker in place of an actual API dependency.
So when a single test initiates, the mocks it requires are posted to smocker and then the test runs.
As the suite grows (~150 tests), so does the amount of mocks smocker ingests and thus increases CPU utilization.
This is where my need to remove mocks comes into play, but I may be making an erroneous assumption that more mocks == more CPU util.
When a test completes, I'd like to dump those mocks to reduce overhead.
If this were a synchronous test suite, it'd be a non-issue, simply reset between tests. However, that would make test execution likely run for hours so that is not an option.
Worst comes to worse, I can roll my own delete endpoint into it, but obviously not an encouraged practice for several reasons.
Thoughts?
The text was updated successfully, but these errors were encountered: