首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

小弟我测出的单并发情况上memcache插入速度好慢啊200/S,小弟我向一个innodb表中插入速度,都比这快啊为什么

2012-12-17 
我测出的单并发情况下memcache插入速度好慢啊,200/S,我向一个innodb表中插入速度,都比这快啊,为什么我测出

我测出的单并发情况下memcache插入速度好慢啊,200/S,我向一个innodb表中插入速度,都比这快啊,为什么
我测出的单并发情况下memcache插入速度好慢啊,200/S,我向一个innodb表中插入速度,都比这快啊,为什么

我向一个innodb表中插入速度,都比这快啊,为什么

jfy_test2.php
<?php
$memcache = memcache_pconnect('localhost', 11212);

if ($memcache) {
  $memcache->set(uniqid(), "String to store in memcached,String to store in memcached");
  echo "OK,Apache进程号". getmypid();
}
else {
  echo "Connection to memcached failed";
}
?>

ab -n 1000 -c 1 http://192.168.2.56:8084/phptest/jfy_test2.php

Server Software:        Apache/2.2.19
Server Hostname:        192.168.2.56
Server Port:            8084

Document Path:          /phptest/jfy_test2.php
Document Length:        20 bytes

Concurrency Level:      1
Time taken for tests:   3.998 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      193000 bytes
HTML transferred:       20000 bytes
Requests per second:    250.14 [#/sec] (mean)


jfy_test.php
<?php
  $dblnk = mysql_pconnect('localhost:3308', 'root', 'cpyf');
  mysql_select_db('test', $dblnk);
  uniqid();
  mysql_query("insert into test7 values ('1111111111','1111111111','1111111111','1111111111','1111111111')", $dblnk);
  echo "OK,Apache进程号". getmypid();
?>

ab -n 1000 -c 1 http://192.168.2.56:8084/phptest/jfy_test.php

Server Software:        Apache/2.2.19
Server Hostname:        192.168.2.56
Server Port:            8084

Document Path:          /phptest/jfy_test.php
Document Length:        20 bytes

Concurrency Level:      1
Time taken for tests:   4.132 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      193000 bytes
HTML transferred:       20000 bytes
Requests per second:    242.03 [#/sec] (mean)


[解决办法]
两个不同层面的东西 有什么可比性呢
[解决办法]

引用:
两个不同层面的东西 有什么可比性呢


用缓存是为了加快速度啊,所以我想测试出速度和性能


[解决办法]
原来是php的uniqid(),这个函数好时



直接循环1000次,要4S

热点排行