Reduce redundant refreshMetadata and HTS lookups in PUT request#509
Draft
cbb330 wants to merge 1 commit intolinkedin:mainfrom
Draft
Reduce redundant refreshMetadata and HTS lookups in PUT request#509cbb330 wants to merge 1 commit intolinkedin:mainfrom
cbb330 wants to merge 1 commit intolinkedin:mainfrom
Conversation
During a single PUT /tables request for an existing table, there were 4 doRefresh calls (each hitting HTS + HDFS) and ~7 HTS GET lookups. This was adding ~200ms+ of unnecessary latency per request. Changes: - Pass pre-loaded Iceberg Table from service layer into save() to skip redundant existsById and catalog.loadTable calls (addresses the FIXME at TablesServiceImpl line 136) - Cache FileIO resolution in OpenHouseInternalCatalog with a 30s TTL Guava cache to avoid repeated HTS lookups for storage type - Cache committed metadata location in OpenHouseInternalTableOperations so post-commit doRefresh skips the HTS lookup Expected reduction: ~7 HTS GETs -> ~2-3, ~4 HDFS reads -> ~1-2
fe80df8 to
b646513
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A single PUT
/tablesrequest for an existing table was triggering 4doRefreshcalls (each hitting HTS + HDFS) and ~7 HTS GET lookups, adding ~200ms+ of unnecessary latency per request (~451ms total observed in Jaeger trace with 42 spans).This PR reduces redundant IO in three ways:
findById, thensave()calledexistsById+catalog.loadTable()again. Now the raw IcebergTablefrom the initial lookup is passed through and reused. (Addresses the FIXME atTablesServiceImpl)resolveFileIO()inOpenHouseInternalCatalogwas doing an HTS lookup on every call. Added a 30s TTL Guava cache since storage type is immutable per table.doCommitsaves to HTS, the post-commitdoRefreshwas doing another HTS lookup to get the metadata location we just wrote. Now we cache it and skip the lookup.Expected reduction: ~7 HTS GETs → ~2-3, ~4 HDFS reads → ~1-2 (~50% latency reduction)
Test plan
internalcatalogandtablesmodulesTablesControllerTest,SnapshotsControllerTest)