replace custom pool implementation with apache's
This commit is contained in:
@@ -1,29 +1,21 @@
|
||||
package redis.clients.jedis.tests.benchmark;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.pool.impl.GenericObjectPool.Config;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||
import redis.clients.util.FixedResourcePool;
|
||||
|
||||
public class PoolBenchmark {
|
||||
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||
private static final int TOTAL_OPERATIONS = 100000;
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException,
|
||||
IOException, TimeoutException, InterruptedException {
|
||||
Logger logger = Logger.getLogger(FixedResourcePool.class.getName());
|
||||
logger.setLevel(Level.OFF);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Jedis j = new Jedis(hnp.host, hnp.port);
|
||||
j.connect();
|
||||
j.auth("foobared");
|
||||
@@ -37,12 +29,9 @@ public class PoolBenchmark {
|
||||
System.out.println(((1000 * 2 * TOTAL_OPERATIONS) / elapsed) + " ops");
|
||||
}
|
||||
|
||||
private static void withPool() throws InterruptedException {
|
||||
final JedisPool pool = new JedisPool(hnp.host, hnp.port, 2000,
|
||||
"foobared");
|
||||
pool.setResourcesNumber(50);
|
||||
pool.setDefaultPoolWait(1000000);
|
||||
pool.init();
|
||||
private static void withPool() throws Exception {
|
||||
final JedisPool pool = new JedisPool(new Config(), hnp.host, hnp.port,
|
||||
2000, "foobared");
|
||||
List<Thread> tds = new ArrayList<Thread>();
|
||||
|
||||
final AtomicInteger ind = new AtomicInteger();
|
||||
|
||||
Reference in New Issue
Block a user