private static final int PORT = 8989;
public static void main(String[] args) throws Exception {
Config config = new Config();
if (args.length > 0) {
Options options = CommandLineUtils.getOptions();
CommandLineParser parser = new PosixParser();
CommandLine cmd = parser.parse(options, args);
if (cmd.hasOption('h')) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("Benchmark [options]", options);
System.exit(1);
}
CommandLineUtils.parseCommandLine(cmd, config);
} else {
config.setKeepAlive(true);
config.setRequests(20000);
config.setThreads(25);
}
URL target = new URL("http", "localhost", PORT, "/rnd?c=2048");
config.setUrl(target);
Benchmark benchmark = new Benchmark();
benchmark.run(new JettyServer(PORT), config);
benchmark.run(new HttpCoreServer(PORT), config);
benchmark.run(new JettyNIOServer(PORT), config);