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

Issue #12266 - InvocationType improvements and cleanups. #12596

Open
wants to merge 21 commits into
base: jetty-12.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift click to select a range
1345a6f
Issue #12266 - InvocationType improvements and cleanups.
sbordet Nov 29, 2024
6ff2e58
Renamed HttpClient.getTransport() to getHttpClientTransport().
sbordet Nov 29, 2024
751c886
Fixed FCGI parsing: onResponseHeaders() was called multiple times in …
sbordet Nov 30, 2024
5352c05
Reverted theh renaming of `HttpClient.getTransport()`.
sbordet Dec 1, 2024
4d4c88a
Fixed race condition when notifying HTTP/2 `HeadersFrame`s.
sbordet Dec 2, 2024
a3b728e
Merged branch 'jetty-12.1.x' into 'fix/jetty-12.1.x/client-invocation…
sbordet Dec 2, 2024
fa7c4a4
Fixed IteratingCallback tests due to changes in toString().
sbordet Dec 2, 2024
78d8a66
Reverted "optimization" in `HttpReceiver.responseHeaders()`.
sbordet Dec 3, 2024
b0b60d1
Reverted another "optimization" in `HttpReceiver.responseHeaders()`.
sbordet Dec 3, 2024
3438462
Merged branch 'jetty-12.1.x' into 'fix/jetty-12.1.x/client-invocation…
sbordet Dec 8, 2024
f7788da
Merged branch 'jetty-12.1.x' into 'fix/jetty-12.1.x/client-invocation…
sbordet Dec 16, 2024
8e036dd
Merged branch 'jetty-12.1.x' into 'fix/jetty-12.1.x/client-invocation…
sbordet Dec 17, 2024
630d5c5
Fixed HTTP/2 serialization in HttpReceiverOverHTTP2.
sbordet Dec 20, 2024
7947030
Fixed tests.
sbordet Dec 20, 2024
dbc7da7
Fixed tests.
sbordet Dec 20, 2024
21d4dfc
Fixed tests.
sbordet Dec 23, 2024
2836d34
Merged branch 'jetty-12.1.x' into 'fix/jetty-12.1.x/client-invocation…
sbordet Dec 23, 2024
ae197ab
Fixed flaky tests.
sbordet Dec 24, 2024
d4da186
Fixed tests.
sbordet Dec 25, 2024
39d7823
Fixed tests.
sbordet Dec 26, 2024
6dbeb96
Fixed handling of HTTP upgrade in CoreClientUpgradeRequest.
sbordet Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed tests.
Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Dec 20, 2024
commit dbc7da78ccd4f71776c15a50af7104b46e35e13f
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 397,7 @@ public Runnable produce()

int filled = fill(getEndPoint(), networkBuffer.getByteBuffer(), compact);
if (LOG.isDebugEnabled())
LOG.debug("Filled {} bytes compacted {} in {}", filled, compact, networkBuffer);
LOG.debug("Filled {} bytes compacted {} {} in {}", filled, compact, networkBuffer, HTTP2Connection.this);

if (filled > 0)
{
Expand Down Expand Up @@ -439,10 439,11 @@ else if (filled == 0)
private RetainableByteBuffer.Mutable acquireBuffer()
{
RetainableByteBuffer.Mutable buffer = heldBuffer.getAndSet(null);
RetainableByteBuffer.Mutable held = buffer;
if (buffer == null)
buffer = bufferPool.acquire(bufferSize, isUseInputDirectByteBuffers()).asMutable();
if (LOG.isDebugEnabled())
LOG.debug("Acquired {}", buffer);
LOG.debug("Acquired {} {} in {}", held == null ? "new" : "held", buffer, HTTP2Connection.this);
return buffer;
}

Expand All @@ -451,7 452,7 @@ private void holdBuffer(RetainableByteBuffer.Mutable buffer)
if (heldBuffer.compareAndSet(null, buffer))
{
if (LOG.isDebugEnabled())
LOG.debug("Held {}", buffer);
LOG.debug("Held {} in {}", buffer, HTTP2Connection.this);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 25,9 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.IntStream;

import org.awaitility.Awaitility;
import org.eclipse.jetty.client.BytesRequestContent;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.client.Response;
import org.eclipse.jetty.client.Result;
Expand All @@ -40,14 42,14 @@
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.NanoTime;
import org.eclipse.jetty.util.thread.Scheduler;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class HttpClientLoadTest extends AbstractTest
Expand All @@ -68,24 70,26 @@ public void testIterative(TransportType transportType) throws Exception
client.setMaxConnectionsPerDestination(32768);
client.setMaxRequestsQueuedPerDestination(1024 * 1024);
client.setIdleTimeout(120000);
client.start();

// At least 25k requests to warmup properly (use -XX: PrintCompilation to verify JIT activity)
int runs = 1;
int iterations = 100;
for (int i = 0; i < runs; i)
try (HttpClient httpClient = client)
{
run(transportType, iterations);
}
httpClient.start();

// Re-run after warmup
iterations = 250;
for (int i = 0; i < runs; i)
{
run(transportType, iterations);
}
// At least 25k requests to warmup properly (use -XX: PrintCompilation to verify JIT activity)
int runs = 1;
int iterations = 100;
for (int i = 0; i < runs; i)
{
run(transportType, iterations);
}

assertThat("Leaks: " byteBufferPool.dumpLeaks(), byteBufferPool.getLeaks().size(), Matchers.is(0));
// Re-run after warmup
iterations = 250;
for (int i = 0; i < runs; i)
{
run(transportType, iterations);
}
}
Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> assertThat("Leaks: " byteBufferPool.dumpLeaks(), byteBufferPool.getLeaks().size(), is(0)));
}

@ParameterizedTest
Expand All @@ -101,15 105,17 @@ public void testConcurrent(TransportType transportType) throws Exception
client.setByteBufferPool(byteBufferPool);
client.setMaxConnectionsPerDestination(32768);
client.setMaxRequestsQueuedPerDestination(1024 * 1024);
client.start();
try (HttpClient httpClient = client)
{
httpClient.start();

int runs = 1;
int iterations = 128;
IntStream.range(0, 16).parallel().forEach(i ->
int runs = 1;
int iterations = 128;
IntStream.range(0, 16).parallel().forEach(i ->
IntStream.range(0, runs).forEach(j ->
run(transportType, iterations)));

assertThat("Connection Leaks: " byteBufferPool.getLeaks(), byteBufferPool.getLeaks().size(), Matchers.is(0));
run(transportType, iterations)));
}
Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> assertThat("Leaks: " byteBufferPool.dumpLeaks(), byteBufferPool.getLeaks().size(), is(0)));
}

private void run(TransportType transportType, int iterations)
Expand Down
Loading