Skip to content

Fix wall time printed on CLI#18743

Merged
yingsu00 merged 1 commit intoprestodb:masterfrom
aaneja:fixCLIEndTime
Jan 22, 2023
Merged

Fix wall time printed on CLI#18743
yingsu00 merged 1 commit intoprestodb:masterfrom
aaneja:fixCLIEndTime

Conversation

@aaneja
Copy link
Contributor

@aaneja aaneja commented Nov 30, 2022

For queries with large number of results, the wall time reported on the CLI is misleading since it includes query execution + time spent iterating through the pager. Using the server side elapsed time makes more sense

Testing done

Run on CLI :
select * from tpch.sf100.lineitem limit 10000;
... < Wait 10-12 s on less pager> ..

Before

0:12 [52.1K rows, 0B] [4.5K rows/s, 0B/s]

After

[Latency: client-side: 413ms, server-side: 317ms] [24.4K rows, 0B] [76.8K rows/s, 0B/s]
== RELEASE NOTES ==

General Changes
* Report both client-side and server-side latency in presto-cli result summary. With this change, the client-side latency is the wall time presto-cli spends for this query to finish, but no longer includes the time spent by user paging through results. The server side latency is acquired from the Presto server which represents the wall time the engine uses to finish executing this query.

@aaneja aaneja requested a review from a team as a code owner November 30, 2022 18:59
@aaneja aaneja requested review from fgwang7w and yingsu00 December 8, 2022 15:33
Copy link
Member

@fgwang7w fgwang7w left a comment

Choose a reason for hiding this comment

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

LGTM, minor change in update of the comment in presto-cli/src/main/java/com/facebook/presto/cli/StatusPrinter.java#L86

Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

Anant, thanks for the fix. Based on my previous knowledge, I think the "Release Notes" line can be removed from the PR message, just have the "No release notes" line stay. Not sure if the release bot would be confused seeing both lines.

@yingsu00 yingsu00 self-assigned this Dec 12, 2022
@yingsu00
Copy link
Contributor

@aaneja I actually think it might make sense to introduce a new metric for just the execution time. So we have 2 elapsed times: execution + result retrieval, and execution only. When the result is very large, the query may be blocked by the output buffer being full and the client not retrieving the data fast enough. For such cases how is the "execution only" time be evaluated?

@aaneja
Copy link
Contributor Author

aaneja commented Dec 22, 2022

@aaneja I actually think it might make sense to introduce a new metric for just the execution time. So we have 2 elapsed times: execution + result retrieval, and execution only. When the result is very large, the query may be blocked by the output buffer being full and the client not retrieving the data fast enough. For such cases how is the "execution only" time be evaluated?

@yingsu00 If you look at the current stats being reported, we're computing all of them from server reported StatementStats. So IMO the execution time reported here should also be the server side execution time.
I agree that we should also capture the client side wall time. IMO we are better of reporting this in the 'debug' stats. I can take this up in a separate PR. WDYT ?

@yingsu00
Copy link
Contributor

current stats being reported

Hi @aaneja, I think this change might make the users get confused and make mistakes if we just silently replace the wall time to the serverSideWallTime. They may observe big difference on query's wall time in the next release and mistakenly think it's big perf improvement, but it's actually not. Maybe it'll safer to output both on the CLI.

@yingsu00
Copy link
Contributor

Actually I think the release note is needed since this is directly user facing. Would you please add a "general change" for it?

@aaneja
Copy link
Contributor Author

aaneja commented Dec 27, 2022

Okay let me compute client side time separately as well; note that this different from the currently computed time since that includes time spent in the pager as well.

@aaneja aaneja force-pushed the fixCLIEndTime branch 2 times, most recently from 514f8fe to 8e8411b Compare December 27, 2022 16:03
Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

@aaneja Anant, if you're uncertain about the way how to pass the client stop time to the printer, you could also split this PR into two PRs, with the first keep the way the client time as is, and the second PR to address passing it from the client itself. Then we can approve the first PR first. If you do agree the way I suggested inline, you can just update the PR.

Also please make sure the tests are all green. Thanks.

@aaneja aaneja force-pushed the fixCLIEndTime branch 2 times, most recently from a8ab922 to 05728e7 Compare January 13, 2023 13:13
Copy link
Contributor

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

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

Mostly looks good, just some nits.

@aaneja
Copy link
Contributor Author

aaneja commented Jan 18, 2023

@yingsu00 I fixed your final comments. Test failures are unrelated to this change. I'm observing identical failures in other PRs

@aaneja aaneja force-pushed the fixCLIEndTime branch 3 times, most recently from 9f0988a to 1df8a48 Compare January 19, 2023 11:02
For interactive queries, the wall time reported for final info is
misleading, since it will include query execution + time spent
iterating through the pager. We instead start tracking & reporting
both the client-side and server-side latency
@yingsu00 yingsu00 self-requested a review January 21, 2023 05:21
@yingsu00 yingsu00 merged commit 2f7ea25 into prestodb:master Jan 22, 2023
@aaneja aaneja deleted the fixCLIEndTime branch January 23, 2023 04:48
@wanglinsong wanglinsong mentioned this pull request Feb 25, 2023
12 tasks
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.

3 participants