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

Add stream-time metric #756

Merged
merged 8 commits into from
Sep 28, 2020
Merged

Conversation

JustPlay
Copy link

Signed-off-by: houyu houyu02@baidu.com

Add stream-time metric

@wjxiz1992
Copy link
Collaborator

build

@svcngcc
Copy link
Contributor

svcngcc commented Sep 13, 2020

Can one of the admins verify this patch?

@@ -134,15 +135,17 @@ trait GpuHashJoin extends GpuExec with HashJoin {
override def hasNext: Boolean = {
while (nextCb.isEmpty && (first || stream.hasNext)) {
Copy link
Member

Choose a reason for hiding this comment

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

As I mentioned in the previous PR, stream.hasNext() can be expensive. Some iterators do their work in hasNext() rather than next() (i.e.: need to compute the next batch to see if there is a next batch, thus it may be attempting to grab the semaphore, fetch from disk, etc.).

We need to account for the time spent in stream.hasNext() or the time could be significantly underreported, similar to what was reported in #658. The total time could be underreported in the same way. I think we need to change where startTime is being setup to capture the time spent in stream.hasNext().

Copy link
Author

Choose a reason for hiding this comment

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

@jlowe I have made a change to include the hasNext(); please review the code; Thanks.

while (nextCb.isEmpty && (first || stream.hasNext)) {
var may_continue = true
while (nextCb.isEmpty && may_continue) {
val startTime = System.nanoTime()
if (stream.hasNext) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: It would be nice to take the chance to clean up the metrics collection using some of our convenience methods/classes. I think this makes the code much more readable.

withResource(new MetricRange(totalTime)) { _ =>
    val upstreamHasNext = withResource(new MetricRange(streamTime)) { _ =>
        stream.hasNext
    }
    if (upstreamHasNext) {
       ...

Copy link
Author

@JustPlay JustPlay Sep 23, 2020

Choose a reason for hiding this comment

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

will you merge the current commit first or waiting me to change it to withResource?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer to have it fixed first unless it is blocking you in some way.

zhangjishun and others added 3 commits September 25, 2020 10:44
Signed-off-by: houyu <houyu02@baidu.com>
Signed-off-by: houyu <houyu02@baidu.com>
Signed-off-by: houyu <houyu02@baidu.com>
@revans2
Copy link
Collaborator

revans2 commented Sep 25, 2020

build

houyu and others added 5 commits September 27, 2020 16:36
Signed-off-by: houyu <houyu02@baidu.com>
Signed-off-by: houyu <houyu02@baidu.com>
Signed-off-by: houyu <houyu02@baidu.com>
Signed-off-by: houyu <houyu02@baidu.com>
@JustPlay
Copy link
Author

JustPlay commented Sep 27, 2020

sorry, a little chaos for this commiting...

@revans2
Copy link
Collaborator

revans2 commented Sep 28, 2020

build

@revans2
Copy link
Collaborator

revans2 commented Sep 28, 2020

@JustPlay is this intended to be your final version of the patch? or were you going to try and use withResource?

@JustPlay
Copy link
Author

@JustPlay is this intended to be your final version of the patch? or were you going to try and use withResource?

Sorry. I am still a new hand in scala, i can not change it into withResouce in a very short time. so you can merge it if it is ok for you.

Thanks for review the code and answer my other question(s) @revans2

@revans2
Copy link
Collaborator

revans2 commented Sep 28, 2020

That is fine I think the code is good and I can take a crack and cleaning it up in a follow on PR.

@revans2 revans2 merged commit 41ff33c into NVIDIA:branch-0.3 Sep 28, 2020
@JustPlay JustPlay deleted the 20200913-branch-0.3 branch September 29, 2020 03:20
sperlingxx pushed a commit to sperlingxx/spark-rapids that referenced this pull request Nov 20, 2020
* Add stream-time metric

Signed-off-by: houyu <houyu02@baidu.com>

Co-authored-by: zhangjishun <zhangjishun@baidu.com>
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Add stream-time metric

Signed-off-by: houyu <houyu02@baidu.com>

Co-authored-by: zhangjishun <zhangjishun@baidu.com>
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* Add stream-time metric

Signed-off-by: houyu <houyu02@baidu.com>

Co-authored-by: zhangjishun <zhangjishun@baidu.com>
tgravescs pushed a commit to tgravescs/spark-rapids that referenced this pull request Nov 30, 2023
…IDIA#756)

Signed-off-by: spark-rapids automation <70000568+nvauto@users.noreply.github.com>

Signed-off-by: spark-rapids automation <70000568+nvauto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants