当前位置: 代码迷 >> 高性能WEB开发 >> 小弟我测出的单并发情况下memcache插入速度好慢啊200/S,小弟我向一个innodb表中插入速度,都比这快啊为什么
  详细解决方案

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

热度:426   发布时间:2012-04-22 18:34:46.0
我测出的单并发情况下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)



------解决方案--------------------
都是本地吗?