Last active
July 30, 2018 02:29
-
-
Save php-cpm/ac7fd10c84894320e364e7e54ccc93b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first benchmark is redis | |
<?php | |
$redis = new Redis(); | |
$redis->connect('127.0.0.1', 6379); | |
for ($i = 0; $i < 100; $i++) { | |
$start = microtime(true); | |
for ($j = 0; $j < 10000; $j++) { | |
$key = sprintf("key:%05d", $j); | |
$redis->pipeline(); | |
/* GET or SET */ | |
if (rand() % 2 == 0) { | |
$redis->set($key, rand()); | |
} else { | |
$redis->get($key); | |
} | |
} | |
$time = microtime(true)-$start; | |
printf("%6d req/sec\n", $j/$time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use strace to analise sys call
sudo dtruss -c php redis.php
predis
predis calls more
recvfrom
sendto
so it's a little slower than othersphp-ext-redis
php-ext-memcached
php connect to redis using a lot of
poll
when memcached using recvform coderecvfrom(0x4, 0x7FC86509E2B8, 0x2004) = -1 Err#35
which meansResource deadlock avoided
php-ext-apcu
apcu memory operation calling
madvise
,munmap
, etc.