Java 在Undertow服务器中增加线程

Java 在Undertow服务器中增加线程,java,redhat,amazon-elb,undertow,Java,Redhat,Amazon Elb,Undertow,我正在使用Undertow,我的目标是使用aws实例获得最大吞吐量 我面临的问题是: 当我使用一个线程数为1000的实例时,我的吞吐量为9900。 当我使用两个线程=1000(每个)的实例时,我获得了9800的吞吐量 我认为其中一种方法是在创建服务器时增加线程数 这是我得到的错误: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invo

我正在使用Undertow,我的目标是使用aws实例获得最大吞吐量

我面临的问题是:

当我使用一个线程数为1000的实例时,我的吞吐量为9900。 当我使用两个线程=1000(每个)的实例时,我获得了9800的吞吐量

我认为其中一种方法是在创建服务器时增加线程数

这是我得到的错误:

        java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
            at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.RuntimeException: java.io.IOException: Too many open files
            at io.undertow.Undertow.start(Undertow.java:141)
            at testProject.testArtifact.ServerConnection.createServer(ServerConnection.java:63)
            at testProject.testArtifact.App.main(App.java:20)
            ... 6 more
        Caused by: java.io.IOException: Too many open files
            at sun.nio.ch.IOUtil.makePipe(Native Method)
            at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65)
            at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
            at org.xnio.nio.NioXnio$DefaultSelectorCreator.open(NioXnio.java:245)
            at org.xnio.nio.NioXnioWorker.<init>(NioXnioWorker.java:93)
            at org.xnio.nio.NioXnio.createWorker(NioXnio.java:203)
            at org.xnio.Xnio.createWorker(Xnio.java:437)
            at org.xnio.Xnio.createWorker(Xnio.java:424)
            at io.undertow.Undertow.start(Undertow.java:84)
            ... 8 more
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 1.938 s
        [INFO] Finished at: 2014-10-24T17:31:59+00:00
        [INFO] Final Memory: 9M/142M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project testArtifact: An exception occured while executing the Java class. null: InvocationTargetException: java.io.IOException: Too many open files -> [Help 1]
        org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project testArtifact: An exception occured while executing the Java class. null
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
        Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
            at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:345)
            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
            ... 19 more
        Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
            at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.RuntimeException: java.io.IOException: Too many open files
            at io.undertow.Undertow.start(Undertow.java:141)
            at testProject.testArtifact.ServerConnection.createServer(ServerConnection.java:63)
            at testProject.testArtifact.App.main(App.java:20)
            ... 6 more
        Caused by: java.io.IOException: Too many open files
            at sun.nio.ch.IOUtil.makePipe(Native Method)
            at sun.nio.ch.EPollSelectorImpl.<init>(EPollSelectorImpl.java:65)
            at sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
            at org.xnio.nio.NioXnio$DefaultSelectorCreator.open(NioXnio.java:245)
            at org.xnio.nio.NioXnioWorker.<init>(NioXnioWorker.java:93)
            at org.xnio.nio.NioXnio.createWorker(NioXnio.java:203)
            at org.xnio.Xnio.createWorker(Xnio.java:437)
            at org.xnio.Xnio.createWorker(Xnio.java:424)
            at io.undertow.Undertow.start(Undertow.java:84)
            ... 8 more
        [ERROR]
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
java.lang.reflect.InvocationTargetException
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:606)
位于org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
运行(Thread.java:745)
原因:java.lang.RuntimeException:java.io.IOException:打开的文件太多
在io.undertow.undertow.start处(undertow.java:141)
位于testProject.testArtifact.ServerConnection.createServer(ServerConnection.java:63)
位于testProject.testArtifact.App.main(App.java:20)
... 还有6个
原因:java.io.IOException:打开的文件太多
位于sun.nio.ch.IOUtil.makePipe(本机方法)
在sun.nio.ch.EPollSelectorImpl。(EPollSelectorImpl.java:65)
位于sun.nio.ch.EPollSelectorProvider.openSelector(EPollSelectorProvider.java:36)
在org.xnio.nio.NioXnio$DefaultSelectorCreator.open上(NioXnio.java:245)
位于org.xnio.nio.nioxniowerer(nioxniowerr.java:93)
位于org.xnio.nio.NioXnio.createWorker(NioXnio.java:203)
位于org.xnio.xnio.createWorker(xnio.java:437)
位于org.xnio.xnio.createWorker(xnio.java:424)
在io.undertow.undertow.start(undertow.java:84)
... 8个以上
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:1.938秒
[信息]完成时间:2014-10-24T17:31:59+00:00
[信息]最终内存:9M/142M
[信息]------------------------------------------------------------------------
[错误]无法在project testArtifact上执行目标org.codehaus.mojo:exec maven plugin:1.3.2:java(默认cli):执行java类时发生异常。null:InvocationTargetException:java.io.IOException:打开的文件太多->[帮助1]
org.apache.maven.lifecycle.LifecycleExecutionException:未能在project Test上执行目标org.codehaus.mojo:exec maven插件:1.3.2:java(默认cli):执行java类时发生异常。无效的
位于org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
位于org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
位于org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
位于org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
位于org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
位于org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
位于org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
位于org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
位于org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
位于org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
位于org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:606)
位于org.codehaus.plexus.classworlds.launcher.launcher.launchEnhanced(launcher.java:289)
位于org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:229)
位于org.codehaus.plexus.classworlds.launcher.launcher.mainWithExitCode(launcher.java:415)
位于org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:356)
原因:org.apache.maven.plugin.MojoExecutionException:执行Java类时发生异常。无效的
位于org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:345)
位于org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
位于org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 还有19个
原因:java.lang.reflect.InvocationTargetException
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
位于java.lang.reflect.Method.invoke(Method.java:606)
位于org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
运行(Thread.java:745)
原因:java.lang.RuntimeException:java.io.IOException:打开的文件太多
在io.undertow.undertow.start处(undertow.java:141)
位于testProject.testArtifact.ServerConnection.createServer(ServerConnection.java:63)
在testProject.test