aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-feed-client/src/test/java')
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
index fe62db9e0bb..4ef24713e9a 100644
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
+++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/HttpRequestStrategyTest.java
@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -36,17 +37,29 @@ class HttpRequestStrategyTest {
HttpRequest request = new HttpRequest("PUT", "/", null, null);
HttpResponse response = HttpResponse.of(200, "{}".getBytes(UTF_8));
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
- Cluster cluster = new BenchmarkingCluster((__, vessel) -> executor.schedule(() -> vessel.complete(response), 100, TimeUnit.MILLISECONDS));
+ Cluster cluster = new BenchmarkingCluster((__, vessel) -> executor.schedule(() -> vessel.complete(response), (int) (Math.random() * 2 * 10), TimeUnit.MILLISECONDS));
HttpRequestStrategy strategy = new HttpRequestStrategy(FeedClientBuilder.create(URI.create("https://dummy.com:123"))
- .setConnectionsPerEndpoint(1 << 12)
- .setMaxStreamPerConnection(1 << 4),
+ .setConnectionsPerEndpoint(1 << 4)
+ .setMaxStreamPerConnection(1 << 20),
cluster);
+ CountDownLatch latch = new CountDownLatch(1);
+ new Thread(() -> {
+ try {
+ while ( ! latch.await(1, TimeUnit.SECONDS)) {
+ System.err.println(cluster.stats().inflight());
+ System.err.println(strategy.throttler.targetInflight());
+ System.err.println();
+ }
+ }
+ catch (InterruptedException ignored) { }
+ }).start();
long startNanos = System.nanoTime();
for (int i = 0; i < documents; i++)
strategy.enqueue(DocumentId.of("ns", "type", Integer.toString(i)), request);
strategy.await();
+ latch.countDown();
executor.shutdown();
cluster.close();
OperationStats stats = cluster.stats();