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

BackpressureIntegrationTest failing #13

Closed
dturanski opened this issue Nov 13, 2017 · 11 comments
Closed

BackpressureIntegrationTest failing #13

dturanski opened this issue Nov 13, 2017 · 11 comments
Milestone

Comments

@dturanski
Copy link

I'm running this on macOS Sierra 10.12.6 MacBookPro, 2.5GH Intel Core 17 16GB. It passes if I set madMultipleCutoff = 1. Anything higher will fail at least one of the tests.

@rmichela
Copy link
Collaborator

Backpressure detection is tricky, because there is no API event to say it happened. Instead, we have to rely on a statistical method that can be unreliable. Basically, the faster and more powerful your computer is, the less likely backpressure will be triggered.

You can safely ignore this test if everything else is passing.

@dturanski
Copy link
Author

Everything else appears to be passing. It looks like early days, but may want to @ignore it in master. Just sayin` I can submit a PR for that if you want

@cbornet
Copy link
Collaborator

cbornet commented Nov 13, 2017

Wouldn't simulating a long lasting operation on the consumer be a way to ensure backpressure ?

@dturanski
Copy link
Author

True but how do you reliably detect BP?

@cbornet
Copy link
Collaborator

cbornet commented Nov 13, 2017

So the consumers are actually slowed down by thread-sleeping.
@rmichela are you sure the test would fail on fast-hardware ? I would say it should fail on the contrary on slow HW when the producer is not fast-enough compared to this waiting time.

@cbornet
Copy link
Collaborator

cbornet commented Nov 13, 2017

Maybe a good other way to test would be a quite long consumer sleep, eg. 1s. Then assert that after 2.5s you only get one tick difference with the number of ticks that was detected at 1.5s

@rmichela
Copy link
Collaborator

You may be right. We can add longer sleeps to the consumer to force backpressure even on slow machines.

@cbornet
Copy link
Collaborator

cbornet commented Nov 13, 2017

So the assertions on the number of ticks during 1s will not work since there seems to be some kind of buffering (probably at gRPC level)
Another idea : measure the max time between 2 ticks and assert that it's superior than a given value.

@cbornet
Copy link
Collaborator

cbornet commented Nov 14, 2017

I have a PoC working : I use a non waiting producer (IntStream) and a non waiting consumer except for one of the early values (eg. 3) where I wait for a long time (eg. 2s). During that time the producer will fill the buffer until it is full (about 128 values) and then will get backpressured. The filling of the buffer takes far less than 1s. So in the assertion I test that the max time between 2 producer onNext is more than 1s.
This way no need for a complex detector, the test should be quite reliable for any hardware and is much faster (less than 3s).

WDYT ?

@dturanski
Copy link
Author

dturanski commented Nov 14, 2017 via email

@rmichela
Copy link
Collaborator

rmichela commented Nov 19, 2017 via email

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

No branches or pull requests

3 participants