-
Notifications
You must be signed in to change notification settings - Fork 931
Apache5x SDkBenhmark Tests #6206
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
Merged
joviegas
merged 23 commits into
feature/master/apache5x
from
joviegas/apache-5-achitecture-test-fix
Jun 26, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9e8fc15
Fix architecture test failures for apache5.x
joviegas 70a120e
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas c7b09a2
Merge issues resolved
joviegas 068cada
Checkstyle issues
joviegas 4766e74
Update to use PoolingHttpClientConnectionManager class reference that…
joviegas c81efdc
Merge branch 'master' into joviegas/apache-5-achitecture-test-fix
joviegas 6b64589
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 89debeb
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 7f9e77f
Fix stream reset failure in RepeatableInputStreamRequestEntity by sto…
joviegas 5fb2d35
writeTo_ConcurrentWrites_HandlesCorrectly no longer needed since even…
joviegas 52fedbd
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 8b83790
Fix connectionPoolingWorks by setting skipping setConnectionTimeToLi…
joviegas 14a2ead
disableAutomaticRetries in Apache 5.x since SDK handles retries , als…
joviegas 9431959
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 5f33ad9
Added Test case for Async , handled review ocmments
joviegas 270c0f7
Donot do buffer the response using BufferedHttpEntity since it might …
joviegas 1a18785
merge from master
joviegas e2d16ad
Fix compilation issues
joviegas 85efdaf
Fix checkstyle issues
joviegas bb70f7d
Remove test which are specific to apache http
joviegas 8deb7d0
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas ca832c7
Merge branch 'feature/master/apache5x' into joviegas/apache-5-achitec…
joviegas 602c659
Add benchmark for Apache5 and add Streaming Api test cases
joviegas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
112 changes: 112 additions & 0 deletions
112
...benchmarks/src/main/java/software/amazon/awssdk/benchmark/utils/StreamingMockServlet.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.benchmark.utils; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.io.PrintWriter; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class StreamingMockServlet extends HttpServlet { | ||
private static final byte[] STREAMING_RESPONSE_DATA = new byte[1024 * 1024]; // 1MB response | ||
|
||
static { | ||
// Initialize response data | ||
for (int i = 0; i < STREAMING_RESPONSE_DATA.length; i++) { | ||
STREAMING_RESPONSE_DATA[i] = (byte) (i % 256); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
handleRequest(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
handleRequest(request, response); | ||
} | ||
|
||
@Override | ||
protected void doPut(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
handleRequest(request, response); | ||
} | ||
|
||
private void handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
// Check if this should be a streaming response | ||
if (isStreamingOperation(request)) { | ||
handleStreamingRequest(request, response); | ||
} else { | ||
handleJsonRequest(request, response); | ||
} | ||
} | ||
|
||
private boolean isStreamingOperation(HttpServletRequest request) { | ||
String uri = request.getRequestURI(); | ||
String contentType = request.getContentType(); | ||
|
||
return uri.contains("streaming") || | ||
uri.contains("StreamingInput") || | ||
uri.contains("StreamingOutput") || | ||
"application/octet-stream".equals(contentType); | ||
} | ||
|
||
private void handleStreamingRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
|
||
// Consume input stream if present | ||
try (InputStream inputStream = request.getInputStream()) { | ||
byte[] buffer = new byte[8192]; | ||
while (inputStream.read(buffer) != -1) { | ||
// Just consume the data | ||
} | ||
} | ||
|
||
// Send streaming response | ||
response.setStatus(HttpServletResponse.SC_OK); | ||
response.setContentType("application/octet-stream"); | ||
response.setContentLength(STREAMING_RESPONSE_DATA.length); | ||
response.setHeader("x-amz-request-id", "streaming-" + System.currentTimeMillis()); | ||
|
||
try (OutputStream outputStream = response.getOutputStream()) { | ||
outputStream.write(STREAMING_RESPONSE_DATA); | ||
outputStream.flush(); | ||
} | ||
} | ||
|
||
private void handleJsonRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
|
||
response.setStatus(HttpServletResponse.SC_OK); | ||
response.setContentType("application/json"); | ||
response.setCharacterEncoding("UTF-8"); | ||
response.setHeader("x-amz-request-id", "json-" + System.currentTimeMillis()); | ||
|
||
String jsonResponse = "{" | ||
+ "\"status\":\"success\"," | ||
+ "\"message\":\"Mock operation completed\"," | ||
+ "\"ResponseMetadata\":{" | ||
+ "\"RequestId\":\"mock-request-id\"" | ||
+ "}" | ||
+ "}"; | ||
|
||
try (PrintWriter writer = response.getWriter()) { | ||
writer.write(jsonResponse); | ||
writer.flush(); | ||
} | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumy responses this will make sure the Client will call the ResponseBody.getContent and test Nenchmarks how the client buffers