java - 多tcp 连接 插入数据到mysql,cpu使用过高
大家讲道理
大家讲道理 2017-04-18 09:41:13
0
1
415

netty 写的异步tcp服务器,测试建立3000个tcp连接,每秒向服务器发送一次数据,服务器收到数据后解析,插入到mysql。 现在发现cpu的占用率过高,该如何优化? 是否需要添加redis缓存层,缓存数据库的数据,做队列然后插入? (ps: 查看mysql线程池发现很多mysql连接在sleep。 通过spring org.apache.commons.dbcp.BasicDataSource 配置的线程池 )

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
PHPzhong

If the data size of the written data does not exceed 10KB, use Redis MQ directly. Let it reduce concurrent requests to the database.
If the data size is relatively large and the data volume is larger, use RabbitMQ.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template