测试环境

测试脚本

class MySimulation extends Simulation {
  val httpConf = http
    .baseUrl("http://192.168.1.244:1099")
    .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
    .acceptEncodingHeader("gzip, deflate")
    .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")

  val scn = scenario("Scenario Name")
    .exec(http("request_1").get("/index.html"))

  setUp(
    scn.inject(
      constantUsersPerSec(500) during(10 minutes)  // 500个并发运行10分钟
    ).protocols(httpConf)
  )
}

错误信息

Wrapped by: io.netty.channel.AbstractChannel$AnnotatedSocketException: Address already in use: no further information: /192.168.1.244:1099
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:616)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

google 到解决方案是端口不够链接,使用下面的命令增加端口配置

netsh int ipv4 set dynamic tcp start=1025 num=57975

但是修改了后,仍出现相同的错误,使用 netsh -an 查看端口使用情况,居然占用了 20000 多个端口。。。

是我哪里配置不对吗,求解决方案。thx


↙↙↙阅读原文可查看相关链接,并与作者交流