jasonk000 opened a new pull request #12102:
URL: https://github.com/apache/druid/pull/12102
### Description
Introduce a back-off to the `HttpPostEmitter` `send()` thread loop to
minimise the amount of log spamming and CPU.
Fixes #11279.
#### Introduce HttpPostEmitterLoggerStressTest
Introduce a test to count how many logged events are triggered during a loop
scenario. It confirms that no more than some maximum send timeout log events
are written in duration of the test. Test runs typically for 6 seconds, and
expects limit of 1000 send attempts in that 6 second period.
Currently, the HttpPostEmitter thread submits 150K events in the test window.
```
[ERROR] Failures:
[ERROR]
org.apache.druid.java.util.emitter.core.HttpPostEmitterLoggerStressTest.testBurstFollowedByQuietPeriod(org.apache.druid.java.util.emitter.core.HttpPostEmitterLoggerStressTest)
[ERROR] Run 1:
HttpPostEmitterLoggerStressTest.testBurstFollowedByQuietPeriod:98 too many
timeouts (159620), expect less than (1000)
[ERROR] Run 2:
HttpPostEmitterLoggerStressTest.testBurstFollowedByQuietPeriod:98 too many
timeouts (166201), expect less than (1000)
[ERROR] Run 3:
HttpPostEmitterLoggerStressTest.testBurstFollowedByQuietPeriod:98 too many
timeouts (173177), expect less than (1000)
[ERROR] Run 4:
HttpPostEmitterLoggerStressTest.testBurstFollowedByQuietPeriod:98 too many
timeouts (175135), expect less than (1000)
```
#### Introduce a backoff to the send() loop when the specific timeout is
experienced.
A simple backoff is chosen at 1/5th the minimum time.
An alternative solution which might be better involves a larger rewrite of
this class, as the class currently splits responsibilities for managing the
batching and sending across multiple classes and threads. A simpler codebase
might run a simpler submission loop with a more explicit throttle and batching
mechanism instead of the current batching handoffs.
This PR has:
- [x] been self-reviewed.
- [ ] N/A using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [x] added documentation for new or modified features or behaviors.
- [x] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [ ] N/A added or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [x] added comments explaining the "why" and the intent of the code
wherever would not be obvious for an unfamiliar reader.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
- [ ] N/A added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]