压测netty框架,返回少量java.net.ConnectException:Connection timed out,优化代码
来源:互联网 发布:vscode typings文件 编辑:程序博客网 时间:2024/06/05 22:05
xx项目需要做性能测试,开发端主要是netty框架,500并发TPS能达到7000+,但是返回少量
Connection timed out,原因有可能是代码有问题,也有可能仅是客户端主动关闭了连接,导致服务端的写失败,linux服务器本身无法处理如此大量请求,监控到客户端并未有大量CLOSE_WAIT状态,不过大量timewait状态,服务器端linxu内核已做各项参数优化。
优化:一是限流,二是让服务端在写数据之前判断一下channel是否已关闭。采用方法一,压力端脚本采用限流,处理正常(若压测脚本做分流限制,不符合生产大批量并发场景)。故采用方法二,让服务端在写数据之前判断一下channel是否已关闭,本次优化方案主要采用优化代码:
1. if (!channel.isConnected()) {
2. if (logger.isWarnEnabled()) {
3. logger.warn("Failed to write any response because the channel is not connected any more. Maybe the client has closed the connection? ");
4. }
5. return;
6. }
阅读全文
0 0
- 压测netty框架,返回少量java.net.ConnectException:Connection timed out,优化代码
- java.net.ConnectException: Connection timed out: connect
- java.net.ConnectException: Connection timed out: connect
- java.net.connectexception:connection timed out
- connection.getOutputStream() 报java.net.ConnectException: Connection timed out: connect
- java.net.connectexception connection timed out connect 加载配置
- 让人无语的java.net.ConnectException: Connection timed out: connect
- java.net.ConnectException: Connection timed out: connect 错误
- Caused by: java.net.ConnectException: Connection timed out: connect
- java.net.ConnectException: Connection timed out: connect--解决方案
- ERROR:java.net.ConnectException: Connection timed out: connect
- 异常:java.net.ConnectException: Connection timed out: no further information
- java.net.ConnectException: Connection timed out: connect 错误
- 异常:java.net.ConnectException: Connection timed out: no further information
- java.net.ConnectException: Connection timed out: connect原因及解决 java设置代理http请求
- SOAPUI Exception:ERROR:java.net.ConnectException: Connection timed out: connect Solution
- 到主机 的 TCP/IP 连接失败 java.net.ConnectException: Connection timed out
- hadoop的"mapred.ReduceTask: java.net.ConnectException: Connection timed out"问题解决
- paxos算法的分析与研究
- LeetCode-022 Generate Parentheses
- Dijkstra算法--邻接表存储+堆优化
- 几款抄板软件的比较
- 使用vue-cli没有'dev-server.js'以及'dev-client.js'文件
- 压测netty框架,返回少量java.net.ConnectException:Connection timed out,优化代码
- 学python(01)——一个小白关于递归的理解
- rancher下的kubernetes之二:安装rancher和kubernetes
- JAVA的特点
- Android数据库Sqlite的基本用法及升级策略
- 红黑树
- 用栈实现表达式的求值(iOS计算器的实现)
- 《Effective Java》读后感(一)
- 状态机(二):Verilog状态机实现