use of io.netty.incubator.channel.uring.IOUringEventLoopGroup in project aerospike-client-java by aerospike.
the class Main method runBenchmarks.
public void runBenchmarks() throws Exception {
if (this.asyncEnabled) {
EventPolicy eventPolicy = new EventPolicy();
if (args.readPolicy.socketTimeout > 0 && args.readPolicy.socketTimeout < eventPolicy.minTimeout) {
eventPolicy.minTimeout = args.readPolicy.socketTimeout;
}
if (args.writePolicy.socketTimeout > 0 && args.writePolicy.socketTimeout < eventPolicy.minTimeout) {
eventPolicy.minTimeout = args.writePolicy.socketTimeout;
}
switch(this.eventLoopType) {
default:
case DIRECT_NIO:
{
eventLoops = new NioEventLoops(eventPolicy, this.eventLoopSize);
break;
}
case NETTY_NIO:
{
EventLoopGroup group = new NioEventLoopGroup(this.eventLoopSize);
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}
case NETTY_EPOLL:
{
EventLoopGroup group = new EpollEventLoopGroup(this.eventLoopSize);
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}
case NETTY_KQUEUE:
{
EventLoopGroup group = new KQueueEventLoopGroup(this.eventLoopSize);
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}
case NETTY_IOURING:
{
EventLoopGroup group = new IOUringEventLoopGroup(this.eventLoopSize);
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}
}
try {
clientPolicy.eventLoops = eventLoops;
if (clientPolicy.asyncMaxConnsPerNode < this.asyncMaxCommands) {
clientPolicy.asyncMaxConnsPerNode = this.asyncMaxCommands;
}
AerospikeClient client = new AerospikeClient(clientPolicy, hosts);
try {
if (initialize) {
doAsyncInserts(client);
} else {
doAsyncRWTest(client);
}
} finally {
client.close();
}
} finally {
eventLoops.close();
}
} else {
AerospikeClient client = new AerospikeClient(clientPolicy, hosts);
try {
if (initialize) {
doInserts(client);
} else {
doRWTest(client);
}
} finally {
client.close();
}
}
}
use of io.netty.incubator.channel.uring.IOUringEventLoopGroup in project aerospike-client-java by aerospike.
the class AsyncExample method runExamples.
/**
* Connect and run one or more asynchronous client examples.
*/
public static void runExamples(Console console, Parameters params, List<String> examples) throws Exception {
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = params.maxCommandsInProcess;
eventPolicy.maxCommandsInQueue = params.maxCommandsInQueue;
EventLoops eventLoops;
switch(params.eventLoopType) {
default:
case DIRECT_NIO:
{
eventLoops = new NioEventLoops(eventPolicy, 1);
break;
}
case NETTY_NIO:
{
EventLoopGroup group = new NioEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}
case NETTY_EPOLL:
{
EventLoopGroup group = new EpollEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}
case NETTY_KQUEUE:
{
EventLoopGroup group = new KQueueEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}
case NETTY_IOURING:
{
EventLoopGroup group = new IOUringEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}
}
try {
ClientPolicy policy = new ClientPolicy();
policy.eventLoops = eventLoops;
policy.user = params.user;
policy.password = params.password;
policy.authMode = params.authMode;
policy.tlsPolicy = params.tlsPolicy;
params.policy = policy.readPolicyDefault;
params.writePolicy = policy.writePolicyDefault;
Host[] hosts = Host.parseHosts(params.host, params.port);
AerospikeClient client = new AerospikeClient(policy, hosts);
try {
EventLoop eventLoop = eventLoops.get(0);
params.setServerSpecific(client);
for (String exampleName : examples) {
runExample(exampleName, client, eventLoop, params, console);
}
} finally {
client.close();
}
} finally {
eventLoops.close();
}
}
use of io.netty.incubator.channel.uring.IOUringEventLoopGroup in project aerospike-client-java by aerospike.
the class SuiteAsync method init.
@BeforeClass
public static void init() {
System.out.println("Begin AerospikeClient");
Args args = Args.Instance;
EventPolicy eventPolicy = new EventPolicy();
switch(args.eventLoopType) {
default:
case DIRECT_NIO:
{
eventLoops = new NioEventLoops(eventPolicy, 1);
break;
}
case NETTY_NIO:
{
EventLoopGroup group = new NioEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}
case NETTY_EPOLL:
{
EventLoopGroup group = new EpollEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}
case NETTY_KQUEUE:
{
EventLoopGroup group = new KQueueEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}
case NETTY_IOURING:
{
EventLoopGroup group = new IOUringEventLoopGroup(1);
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}
}
try {
ClientPolicy policy = new ClientPolicy();
policy.eventLoops = eventLoops;
policy.user = args.user;
policy.password = args.password;
policy.authMode = args.authMode;
policy.tlsPolicy = args.tlsPolicy;
Host[] hosts = Host.parseHosts(args.host, args.port);
eventLoop = eventLoops.get(0);
client = new AerospikeClient(policy, hosts);
try {
args.setServerSpecific(client);
} catch (RuntimeException re) {
client.close();
throw re;
}
} catch (Exception e) {
eventLoops.close();
throw e;
}
}
Aggregations