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

Restricting sender queue size #1132

Merged
merged 5 commits into from
Dec 12, 2019
Merged

Restricting sender queue size #1132

merged 5 commits into from
Dec 12, 2019

Conversation

dougqh
Copy link
Contributor

@dougqh dougqh commented Dec 9, 2019

To prevent unbounded memory consumption, restricting the size of the sender queue. Also, lowering the size of the Disruptor queue.

Unfortunately, our choice of a ScheduledExecutorService makes this a bit difficult, since ScheduledExecutorService doesn't allow us to supply the queue.

A bigger change is in-order but for now, this change restricts the queue size by introducing a Semaphore around the ScheduledExecutorService.

In effort to making testing easier, I introduced Monitor.onFlush. This is used in the new slow response test which attempts to simulate a situation where the sending queue would back up.

To my chagrin, the current test doesn't fail reliably when the queue is unbounded; however, it does fail.

@dougqh dougqh requested a review from a team as a code owner December 9, 2019 22:22
this(api, new NoopMonitor(), disruptorSize, senderQueueSize, flushFrequencySeconds);
}

// DQH - TODO - Update the tests & remove this
Copy link
Contributor Author

@dougqh dougqh Dec 9, 2019

Choose a reason for hiding this comment

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

I'll probably end-up taking out the TODO for now.

However, I do think we need to find a better way to construct test objects.
I'd suggest creating finer grained Config objects with a Builder that works for both the Config & the object.

@dougqh dougqh force-pushed the dougqh/bounded-sender-queue branch 2 times, most recently from 8f1ec67 to c71cec5 Compare December 10, 2019 14:48
Copy link
Contributor

@tylerbenson tylerbenson left a comment

Choose a reason for hiding this comment

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

Minor question, but looks good otherwise.

@tylerbenson tylerbenson added this to the 0.39.0 milestone Dec 10, 2019
To prevent unbounded memory consumption, restricting the size of the sender queue.  Also, lowering the size of the Disruptor queue.

Unfortunately, our choice of a ScheduledExecutorService makes this a bit difficult, since ScheduledExecutorService doesn't allow us to supply the queue.

A bigger change is in-order but for now, this change restricts the queue size by introducing a Semaphore around the ScheduledExecutorService.

In effort to making testing easier, I introduced Monitor.onFlush.  This is used in the new slow response test which attempts to simulate a situation where the sending queue would back up.
Improving the reliability of the slow sender test.

Still needs work, but to make this truly reliable, I'd need to add to the DDAgentWriter API.  I'll probably do that, but I'm trying to start with sticking to the existing API.
Adding call to monitor.onFailedSend in case senderSemaphore acquisition is interrupted during shutdown
@dougqh dougqh merged commit e9e3b37 into master Dec 12, 2019
@tylerbenson tylerbenson deleted the dougqh/bounded-sender-queue branch December 12, 2019 17:05
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.

None yet

2 participants