You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "zachjsh (via GitHub)" <gi...@apache.org> on 2023/09/25 23:10:04 UTC
[PR] Add timeout for getting the next record when sampling (druid)
zachjsh opened a new pull request, #15035:
URL: https://github.com/apache/druid/pull/15035
### Description
Previously, when sampling streaming data, the sampler would wait `timeoutMs` for `numRows` to be returned. If the stream has less rows than `numRows`, the sampler would wait the full `timeoutMs` period. In some cases, initially connecting to a given stream to sample may take a considerable amount of time, but reading subsequent records thereafter is a much faster operation. For these cases, this PR adds a new sampler config property `nextRecordTimeoutMs`, which if specified, causes the sampler to return after this period of time if no further records are found between the last record found, or `timeoutMs`, whichever comes first. For example if a stream has only 1 record in it at a given time, and `timeoutMs` is configured as `15000` miliseconds and `nextRecordTimeoutMs` is configured as `2000` milliseconds while `numRows` is configured as `500`, then assuming the first record is read quickly, the sampler will return after roughly `2000` milliseconds, whereas previously it would ha
ve returned after the full `15000` millesecond `timeoutMs` config value.
This PR has:
- [ ] been self-reviewed.
- [ ] 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.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] 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.
- [ ] 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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "dkoepke (via GitHub)" <gi...@apache.org>.
dkoepke commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1747278958
> Something like having the sampler check the latest offset available in Kafka first (using RecordSupplier#getLatestSequenceNumber) and then returning early once it has read up through that latest message.
Would this cause issues when `useEarliestOffset` is false? Or if the earliest offset happens to be close to the latest in a stream that's actively receiving data?
From my understanding, the timeout here is basically defining how long a stream can be idle (have no data arrive / offsets stay the same). The goal is to improve the experience for web console (and similar UIs) when a stream is low volume at the time ingestion is being setup in Druid. Right now, for the web console, if there are fewer than 500 (`numRows`) rows, each call to the sampler always takes 15 seconds (`timeoutMs`). The web console calls the sampler a lot during the normal flow, so this can be pretty slow.
> I can't imagine that most users will set any of these config parameters in a case like that.
Agreed. The intent of the config in the sampler payload is to allow UIs to tweak their settings without users having to redeploy Druid. It's not intended to be set (or even seen) by normal end users.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-2033314171
This pull request/issue has been closed due to lack of activity. If you think that
is incorrect, or the pull request requires review, you can revive the PR at any time.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1736613576
I am not entirely sure we need a config here either. Irrespective of what we name the config, it is going to cause confusion with the existing `timeoutMs`, especially since the `SamplerConfig` is used with batch too where this config would not be meaningful.
I think we could just have a __fixed__ maximum number of empty polls. When we poll the topic for records, and say we don't get anything for 10 tries or say, we just wrap up the sampler.
Since this is only used for sampling, there is no real obligation to keep waiting until we have read the requested number of records. Compare this to batch where if there is no file at the specified path, we just fail or return empty and don't wait for data to show up.
@zachjsh , @abhishekagarwal87 , what do you think?
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "zachjsh (via GitHub)" <gi...@apache.org>.
zachjsh commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1737809462
> I am not entirely sure we need a config here either. Irrespective of what we name the config, it is going to cause confusion with the existing `timeoutMs`, especially since the `SamplerConfig` is used with batch too where this config would not be meaningful.
>
> I think we could just have a **fixed** maximum number of empty polls. When we poll the topic for records, and say we don't get anything for say 10 tries, we finish the sampling.
>
> Since this is only used for sampling, there is no real obligation to keep waiting until we have read the requested number of records. Compare this to batch where if there is no file at the specified path, we just fail or return empty and don't wait for data to show up.
>
> @zachjsh , @abhishekagarwal87 , what do you think?
thanks @kfaraz , just wanted to be clear that this new config is not strictly needed for things to work properly, most users will not have to touch this. However its usage enabled an improved UX
About your idea described above, the poll timeout is hardcoded to 100 milliseconds. There could be cases where a user may want to allow for longer than 1 second to for the next record to be read. As for confusion with timeoutMs, let me know if there is something I can add that helps differentiate them
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1737988472
Btw, on general design. Sampling is intended to be used in a very specific situation— it's there so the web console (& any similar third-party UIs) can show people a few records from a stream prior to configuring their supervisors. I can't imagine that most users will set any of these config parameters in a case like that. They'll just get whatever behavior the UI requests from the API.
For that reason I think it's important to focus on the out-of-box behavior, so users using the builtin web console get the benefit of these adjustments.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add timeout for getting the next record when sampling (druid)
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1734854325
We really have to resist the temptation to add a config for every corner case we run into. Is it absolutely necessary to have this config? Even if you need these, why not use standard terms such as connectTimeout, readTimeout that are more common names and easier to relate to than something like nextRecordTimeout?
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "jon-wei (via GitHub)" <gi...@apache.org>.
jon-wei commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1737885551
I feel that some kind of config here makes sense, either as a timeout or a max number of tries after encountering an empty read, to allow the behavior to be disabled or adjusted to the characteristics of a specific stream
imo it should be called something like `streamingNextRecordTimeout` or something with "streaming" in the name if we're concerned that there would be confusion with batch sampling cases
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #15035: Add read timeout for getting records when sampling a stream
URL: https://github.com/apache/druid/pull/15035
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add timeout for getting the next record when sampling (druid)
Posted by "zachjsh (via GitHub)" <gi...@apache.org>.
zachjsh commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1735814168
> We really have to resist the temptation to add a config for every corner case we run into. Is it absolutely necessary to have this config? Even if you need these, why not use standard terms such as connectTimeout, readTimeout that are more common names and easier to relate to than something like nextRecordTimeout?
@abhishekagarwal87 , yes I can change to `readTimeout`, that is a better name.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1977713668
This pull request has been marked as stale due to 60 days of inactivity.
It will be closed in 4 weeks if no further activity occurs. If you think
that's incorrect or this pull request should instead be reviewed, please simply
write any comment. Even if closed, you can still revive the PR at any time or
discuss it on the dev@druid.apache.org list.
Thank you for your contributions.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Add read timeout for getting records when sampling a stream (druid)
Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on PR #15035:
URL: https://github.com/apache/druid/pull/15035#issuecomment-1737981043
It seems that the intent here is to prevent sampling from Kafka getting stuck when fewer than `numRows` exist in the stream. Instead of adding a second shorter timeout, could we tackle that problem directly? Something like having the sampler check the latest offset available in Kafka first (using `RecordSupplier#getLatestSequenceNumber`) and then returning early once it has read up through that latest message.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org