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

Yingjianw/list db with follower reader timestamp #589

Merged
merged 2 commits into from
May 1, 2024

Conversation

stevie9868
Copy link
Contributor

@stevie9868 stevie9868 commented Apr 26, 2024

As we see more dbs added to our metadata service, the load on crdb increases when there are many listDB calls, and we see only subset of certain nodes in our cluster experiencing high cpu usage.

Thus, in order to better spread the traffic, for list dbs operation, we are going to use the read_follower_timestamp.

Unfortunately, we need to rollback previous 2 commits as we don't want them to be included into the same rollout

@stevie9868 stevie9868 force-pushed the yingjianw/ListDBWithFollowerReaderTimestamp branch 3 times, most recently from 5e2624a to acc623e Compare April 27, 2024 02:33
@insyncoss
Copy link
Collaborator

To make things cleaner, could you first separate out the revert changes from the core logic changes?

@stevie9868 stevie9868 force-pushed the yingjianw/ListDBWithFollowerReaderTimestamp branch from acc623e to 289adee Compare April 29, 2024 17:12
@@ -77,6 +77,7 @@ public void create(final ConnectorRequestContext context, final DatabaseInfo dat
* {@inheritDoc}.
*/
@Override
@Transactional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you add this annotation to this method, if it's for the exists check, the exists check and deletion do not need to be transactional. If it's for something else then what is it for?

Copy link
Contributor Author

@stevie9868 stevie9868 Apr 30, 2024

Choose a reason for hiding this comment

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

Good Catch. Not sure why I added this, might be something I accidentally included during my rebase...

@@ -226,6 +226,7 @@ class MetacatFunctionalSpec extends Specification {

when:
api.createDatabase(catalog.name, databaseName, dto)
Thread.sleep(5000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the other tests the wait time is 10 seconds delay is this delay enough for the follower read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it turns out 5 seconds is enough. I will adjust other test to use 5 seconds as well.

.map(d -> QualifiedName.ofDatabase(name.getCatalogName(), d.getDbName()))
final String dbPrefix = prefix == null ? "" : prefix.getDatabaseName();
final List<QualifiedName> qualifiedNames = polarisStoreService.getDatabaseNames(
dbPrefix, sort, 1000)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we try a larger page size like 5000 or 10000? That's what we bumped it to for table names and it seems it could be more efficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.

I think 1000 was also too small, and once we did a backfill, we need to get the result back and forth from the db, which increase the time holding to the db connection.

@stevie9868 stevie9868 force-pushed the yingjianw/ListDBWithFollowerReaderTimestamp branch from f739e60 to 73210f5 Compare April 30, 2024 17:15
@stevie9868 stevie9868 merged commit 5d0a3a0 into master May 1, 2024
2 checks passed
stevie9868 added a commit that referenced this pull request May 1, 2024
* follower_read_timestamp for list db calls

* address comments

---------

Co-authored-by: Yingjian Wu <[email protected]>
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