Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Modify bookbuyer demo to trip circuit breaker #1184

Merged
merged 7 commits into from
Aug 4, 2020
Merged

Conversation

Jont828
Copy link
Contributor

@Jont828 Jont828 commented Jul 23, 2020

Modify the bookbuyer demo to spin up several concurrent goroutines that buy books (configured with an env variable) and apply the CRD to see changes in Grafana and the logs.

@Jont828 Jont828 added the wip Work-in-Progress label Jul 23, 2020
@@ -16,15 +18,17 @@ import (

const (
participantName = "bookbuyer"
numConnections = 15
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to move this out into an env var (os.Getenv) or a CLI param to the bookbuyer binary -- default it to 1

Copy link
Contributor

@draychev draychev Jul 24, 2020

Choose a reason for hiding this comment

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

This is actually interesting - if you merge it like this (before you introduce os.Getenv we'd probably have lower flakyness, which TBH might be a good thing at this stage of the project.
This would run 15 parallel tests. One of them succeeding and notifying ci/maestro that it succeeded would be sufficient for the entire test to be successful (even if the rest of the tests / goroutines fail).

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest making the env change so that the tests are reliable with defaults. Backpressure is experimental and not enabled by default, so there shouldn't be a need to make concurrent connections. This might have an impact on how the output is rendered, and how success/failures are handled for individual goroutines by maestro.go.

One of them succeeding and notifying ci/maestro that it succeeded would be sufficient for the entire test to be successful (even if the rest of the tests / goroutines fail).

This is not true, if there are any failures those should be caught because it shouldn't fail at all when the backpressure policy is not applied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by flakiness?

@draychev
Copy link
Contributor

This looks good @Jont828 - you could convert to a ready for review PR.
This PR may be relevant to what you are working on at the moment: #1187 (I added latency and noise to the response time of Bookstore)

@Jont828 Jont828 marked this pull request as ready for review July 24, 2020 21:00
@Jont828 Jont828 requested a review from a team as a code owner July 24, 2020 21:00
Copy link
Member

@shashankram shashankram left a comment

Choose a reason for hiding this comment

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

To introduce this feature with minimal impact on the CI, please introduce an env variable to configure numConnections. This will give us better control to fine tune the CI if things go wrong. When backpressure testing is integrated as a part of the CI suite, we can increase numConnections and use that as the default.

@@ -16,15 +18,17 @@ import (

const (
participantName = "bookbuyer"
numConnections = 15
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest making the env change so that the tests are reliable with defaults. Backpressure is experimental and not enabled by default, so there shouldn't be a need to make concurrent connections. This might have an impact on how the output is rendered, and how success/failures are handled for individual goroutines by maestro.go.

One of them succeeding and notifying ci/maestro that it succeeded would be sufficient for the entire test to be successful (even if the rest of the tests / goroutines fail).

This is not true, if there are any failures those should be caught because it shouldn't fail at all when the backpressure policy is not applied.

@Jont828
Copy link
Contributor Author

Jont828 commented Jul 24, 2020

@shashankram Would it cause issues to have numConnections=1 as the default so there is only one connection? Or should we revert the default behavior to a non-concurrent bookbuyer?

@shashankram
Copy link
Member

@shashankram Would it cause issues to have numConnections=1 as the default so there is only one connection? Or should we revert the default behavior to a non-concurrent bookbuyer?

@shashankram Would it cause issues to have numConnections=1 as the default so there is only one connection? Or should we revert the default behavior to a non-concurrent bookbuyer?

I think keeping it concurrent while leaving the default connection as 1 should be okay because of wg.Wait() should keep the client from not exiting. Existing code looks good, but would leave the default as 1, with a CI_CLIENT_CONCURRENT_CONNECTIONS env variable to make it configurable and only enable it when backpressure is enabled and integrated with the CI.

@Jont828 Jont828 force-pushed the concurrent-bookbuyer branch 5 times, most recently from b7acadc to 26d150a Compare July 30, 2020 20:29
@Jont828 Jont828 requested a review from shashankram July 31, 2020 20:16
@Jont828 Jont828 force-pushed the concurrent-bookbuyer branch from 26d150a to 26f8d64 Compare August 3, 2020 16:46
@Jont828 Jont828 requested a review from snehachhabria August 3, 2020 19:48
@Jont828 Jont828 force-pushed the concurrent-bookbuyer branch from c0860c6 to 129ecd3 Compare August 3, 2020 22:05
@Jont828 Jont828 force-pushed the concurrent-bookbuyer branch from 0ac9cdf to 129ecd3 Compare August 3, 2020 22:59
Copy link
Contributor

@draychev draychev left a comment

Choose a reason for hiding this comment

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

This looks great - we will continue to iterate!

@draychev draychev merged commit 6091c93 into main Aug 4, 2020
@draychev draychev deleted the concurrent-bookbuyer branch August 4, 2020 17:51
@draychev
Copy link
Contributor

draychev commented Aug 5, 2020

ref #1376

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wip Work-in-Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants