首页 技术 正文
技术 2022年11月21日
0 收藏 362 点赞 3,458 浏览 688 个字

性能调优案例分享:Mysql的cpu过高

 

问题:
一个系统,Mysql数据库,数据量变大之后。mysql的cpu占用率很高,一个测试端访问服务器时mysql的cpu占用率为15% ,6个测试端连服务器的时候mysql cpu占用率为50%~60% 。
ps 1: 每个测试端所做事情就是插入记录,不过插入前会先查询一下是否已经有相同的记录,有的话就更新原有记录,没有就直接插入。

ps 2: CPU–Pentium Dual E1240 @ 1.60GHZ
内存–2G
OS–Windows 2003
调优思路:

采用replace into代替select、insert into会提高性能。

如果是innodb,建议配置参数要做优化。
InnoDB引擎在缺省参数配置下性能较差。
推荐InnoDB的配置(1G内存情况,主要运行mysql服务器):
innodb_buffer_pool_size = 600M
innodb_additional_mem_pool_size = 64M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
#innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
innodb_file_per_table
其中innodb_flush_log_at_trx_commit和innodb_file_per_table对I/O性能影响最大。
备注:my-large.cnf等文件只是优化myisam引擎的参数

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,020
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,772
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,850