Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4180049
  • 博文数量: 291
  • 博客积分: 8003
  • 博客等级: 大校
  • 技术积分: 4275
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-30 18:28
文章分类

全部博文(291)

文章存档

2017年(1)

2013年(47)

2012年(115)

2011年(121)

2010年(7)

分类: Mysql/postgreSQL

2010-12-13 12:41:49

1.测试环境

服务器:
CPU:2GHZ,内存:4G,物理机
系统:centos 5 32位
网络:100Mbps 局域网
客户端:
CPU:2GHZ,内存:4G
系统:centos 5 32位
数据量:1000万条记录
mysql版本:5.1.51-log

测试方法:把mysql挂到DNS软件后面,用bind的测试工具querypref测试

测试时,启动五个DNS软件进程,每个进程里开一个mysql的长连接,每次请求不关闭连接

2.测试结果
2.1mysql
2.1.1 1000万在同一张表测试


CREATE TABLE `rr` (
  `beginip` int(10) unsigned DEFAULT NULL,
  `endip` int(10) unsigned DEFAULT NULL,
  `zone` varchar(256) DEFAULT NULL,
  `rrtype` tinyint(4) DEFAULT NULL,
  `data` varchar(256) DEFAULT NULL,
  `ttl` int(10) unsigned DEFAULT NULL,
  INDEX `zone_index` (`zone`) USING BTREE,
  INDEX `ipset_index` (`beginip`,`endip`) USING BTREE,
  INDEX `rrtype_index` (`rrtype`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

sql语句:
select data,ttl from rr where domain=;
//不使用缓存
SET GLOBAL query_cache_size=0;
加索引: INDEX `zone_index` (`zone`) USING BTREE,
INDEX `ipset_index` (`beginip`,`endip`) USING BTREE,
INDEX `rrtype_index` (`rrtype`) USING BTREE
打开缓存:1.4万qps(query per second) ,单次请求时间为1~3ms
不缓存: 21qps,单次请求时间为88ms
服务器一分钟负载:2~3

发现在查询时,去更新某一条记录时,那几分钟单次请求时间为900ms,估计mysql在重新建缓存和索引导致

2.1.2 1000张表,1万条数据测试 


CREATE TABLE www_a_com_ (
beginip int(10) unsigned DEFAULT NULL,
endip int(10) unsigned DEFAULT NULL,
rrtype tinyint(4) DEFAULT NULL,
data varchar(256) DEFAULT NULL,
ttl int(10) unsigned DEFAULT NULL,
INDEX ipset_index (beginip,endip) USING BTREE,
INDEX rrtype_index (rrtype) USING BTREE
);


sql语句:select data,ttl from www_a_com_ where and beginip<=3232238968 and endip>=3232238968 and rrtype=1;
//使用缓存
SET GLOBAL key_buffer_size=200*1024*1024;
SET GLOBAL table_cache=1200;
SET GLOBAL thread_cache_size=60;
SET GLOBAL query_cache_size=200*1024*1024;
SET GLOBAL query_cache_limit=200*1024*1024;
SET GLOBAL table_definition_cache=1200;
SET GLOBAL thread_cache_size=60;
SET GLOBAL myisam_data_pointer_size=60;
SET GLOBAL delayed_queue_size=2000;
SET GLOBAL preload_buffer_size=65536;

加索引: INDEX `ipset_index` (`beginip`,`endip`) USING BTREE,
INDEX `rrtype_index` (`rrtype`) USING BTREE

打开缓存:1.5万qps,单次请求时间为1~3ms

不缓存: 3000qps,单次请求时间为6~7ms

服务器一分钟负载:2~4

测试时,发现在进程里启动10个连接和1一个连接的测试数据相差不大。

阅读(1931) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇: fastdb的缺陷

给主人留下些什么吧!~~