Skip to content

PHOENIX-7528 Add metrics for overall wall clock query wait time in Phoenix client thread pool and total time spent in executing HBase scan tasks #2077

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sanjeet006py
Copy link
Contributor

Summary of the change:

  • Introducing two new metrics for tracking wall clock wait time of a query in Phoenix client thread pool and wall clock time spent in executing HBase scan tasks in Phoenix client thread pool.
  • Also, made the change to use JobCallable in RoundRobinResultItr. when submitting next batches of scans as scanner cache of previous batches of scan has been exhausted. By using JobCallable we can track total wall clock time spent by a query waiting in Phoenix client thread pool queue along with total wall clock time spent in executing tasks (end to end).

long vpk3 = 1000;
try(Connection conn = DriverManager.getConnection(getUrl())) {
PreparedStatement stmt = conn.prepareStatement(upsertRows);
stmt.execute(creatTableDdl);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a slightly weird pattern. Creating a table with a PreparedStatement for upsert rows. Generally, we just do conn.createStatement().execute(ddl)

SecurityException, IllegalArgumentException, IllegalAccessException {
private void changeInternalStateForTesting(PhoenixResultSet rs,
ReadMetricQueue testMetricsQueue) throws
NoSuchFieldException, SecurityException, IllegalArgumentException,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just change it to throws Exception

@@ -1298,5 +1301,225 @@ public Connection call() throws Exception {
}
}

@Test
public void testPhoenixClientQueueWaitTimeAndEndToEndTime() throws SQLException,
NoSuchFieldException,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just change it to throws Exception

}
getRows += ")";
final String upsertRows = "UPSERT INTO " + tableName + " VALUES(?, ?, ?, ?, ?, ?)";
String creatTableDdl = "CREATE TABLE IF NOT EXISTS " + tableName + " (\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally we put the table schema first and then the upsert statements and the select statements. This makes it easy to understand the code.

Comment on lines 1475 to 1476
int[] taskQueueWaitTime = {10, 5, 20, 7};
int[] taskEndToEndTime = {20, 15, 41, 16};
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass these as parameters in the constructor

@sanjeet006py sanjeet006py requested a review from tkhurana March 25, 2025 04:18
@tkhurana
Copy link
Contributor

@sanjeet006py We need more testing around different iterators like Serial, MergeSort and also different kind of queries like Aggregate

@sanjeet006py
Copy link
Contributor Author

sanjeet006py commented Mar 26, 2025

@sanjeet006py We need more testing around different iterators like Serial, MergeSort and also different kind of queries like Aggregate

  • For Serial iterators we can have a case for single region being scanned.
  • I understand there are many other iterators also apart from Serial and MergeSort like ConcatResultIterator and UnionResultIterator so, I should add test cases for these also? I think tests are also needed for Join queries, correct?

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.

2 participants