小编Sen*_*mar的帖子

Netty 作为高性能 Http 服务器,每秒可处理约 2-3 百万个请求

我们正在尝试解决处理大量 Http POST 请求的问题,而在使用 Netty Server 时,我只能处理~50K requests/sec太低的请求。

我的问题是如何调整此服务器以确保处理> 1.5 million requests/second

Netty4 服务器

// Configure the server.
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
        ServerBootstrap b = new ServerBootstrap();
        b.option(ChannelOption.SO_BACKLOG, 1024);

        b.group(bossGroup, workerGroup)
         .channel(NioServerSocketChannel.class)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new HttpServerInitializer(sslCtx));

        Channel ch = b.bind(PORT).sync().channel();

        System.err.println("Open your web browser and navigate to " +
                (SSL? "https" : "http") + "://127.0.0.1:" + PORT + '/');

        ch.closeFuture().sync();
    } finally {
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
Run Code Online (Sandbox Code Playgroud)

初始化程序

    public …
Run Code Online (Sandbox Code Playgroud)

java client-server http netty

3
推荐指数
1
解决办法
2928
查看次数

标签 统计

client-server ×1

http ×1

java ×1

netty ×1