// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.benchmark;
import com.yahoo.jdisc.application.BindingRepository;
import com.yahoo.jdisc.application.BindingSet;
import com.yahoo.jdisc.application.UriPattern;
import org.junit.Test;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/**
* @author Simon Thoresen Hult
*/
public class BindingMatchingTestCase {
private static final int NUM_CANDIDATES = 1024;
private static final int NUM_MATCHES = 100;
private static final int MIN_THREADS = 1;
private static final int MAX_THREADS = 64;
private static final Random random = new Random();
private static final ExecutorService executor = Executors.newFixedThreadPool(MAX_THREADS);
@Test
public void runThroughtputMeasurements() throws Exception {
System.err.format("%15s%15s%15s%15s%15s%15s%15s%15s\n",
"No. of Bindings", "1 thread", "2 thread", "4 thread", "8 thread", "16 thread", "32 thread", "64 thread");
for (int numBindings : Arrays.asList(1, 10, 25, 50, 100, 250)) {
BindingRepository