Skip to content

Conversation

@yma955
Copy link
Member

@yma955 yma955 commented Feb 8, 2023

Update the implementation of ProxyStreamingOutput to handle ProxyService.get. We need bytes to read from the buffer to take on the responsibility for computing digest for the sidecar tracking report.
The buffer reading is different from #31 since we already change HTTP client into okhttp3. The okio BufferedSource could keep a buffer internally so that callers can do small reads without a performance penalty.
We could request the case from PNC to test the large streaming performance, from what I tested locally, it's stable so far.
Related bug: https://issues.redhat.com/browse/MMENG-3532

@yma955 yma955 requested a review from ligangty February 8, 2023 13:09
@yma955
Copy link
Member Author

yma955 commented Feb 8, 2023

Hi, @ligangty could you help to review the code? This is a bug related to sidecar 2.0.0 which blocked the streaming reading. Thanks!

Copy link
Member

@ligangty ligangty left a comment

Choose a reason for hiding this comment

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

Generally looks good.
BTW, do we have a unit test for this ProxyStreamingOutput?

logger.trace( "Copying from: {} to: {}", bodyStream, out );
IOUtils.copy( bodyStream, out );

OutputStream out = cout;
Copy link
Member

Choose a reason for hiding this comment

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

Is this out needed? Why not use cout directly here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ligangty This is the same with the previously removed code, I think what John considered here might be out is used for writing, cout is used for bytes count.

}
catch ( IOException e )
{
if ( otel.enabled() )
Copy link
Member

Choose a reason for hiding this comment

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

Is this possible to happen in the new okhttp3 way?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ligangty it's verified, IOException is never thrown in responsebody.close().

@yma955
Copy link
Member Author

yma955 commented Feb 10, 2023

Generally looks good. BTW, do we have a unit test for this ProxyStreamingOutput?

@ligangty no, sidecar doesn't have the ReportService and WebClientAdapter related unit tests, this streaming should call both of them for the testing, it needs to be perfect then.

@ligangty
Copy link
Member

Ok, so it LGTM.

@yma955 yma955 merged commit 1e322ac into Commonjava:2.0.x Feb 10, 2023
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