Skip to content

HDDS-15481. Avoid re-encoding the URL safe token for each read chunk - #10433

Closed
sodonnel wants to merge 1 commit into
apache:masterfrom
sodonnel:HDDS-15481-token-encode
Closed

HDDS-15481. Avoid re-encoding the URL safe token for each read chunk#10433
sodonnel wants to merge 1 commit into
apache:masterfrom
sodonnel:HDDS-15481-token-encode

Conversation

@sodonnel

@sodonnel sodonnel commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This is a small performance improvement - the Token is re-encoded as a URL-safe base64 string on every call to readBlockImpl(), which will be called for each 1MB read.

We can cache the URL encoded value and on re-encode it if the token is refreshed.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15481

How was this patch tested?

Depends on existing tests.

@szetszwo

szetszwo commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@sodonnel , this is a good catch! This problem was copied from BlockInputStream. How about we also fix BlockInputStream here? We should just change the token class from Token<OzoneBlockTokenIdentifier> to String in all the places.

@sodonnel

sodonnel commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

We should just change the token class from Token to String in all the places.

How far do you think we should go? Token is used all over the place - intellij just gives up searching for usages.

The nicest fix would be to cache the encoded token inside the token object itself, but its a hadoop class, so we cannot easily change it just in Ozone.

@szetszwo

szetszwo commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Just BlockInputStream/StreamBlockInputStream. I tried to change the code and the change seems not big. The reason to involve BlockInputStream here is that they have some shared code.

@chungen0126
chungen0126 self-requested a review June 8, 2026 13:54
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions Bot added the stale label Jul 3, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.

@github-actions github-actions Bot closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants