Last active
July 30, 2018 02:29
-
-
Save php-cpm/ac7fd10c84894320e364e7e54ccc93b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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); | |
| } |
Author
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.phppredis
predis calls more
recvfromsendtoso it's a little slower than othersphp-ext-redis
php-ext-memcached
php connect to redis using a lot of
pollwhen memcached using recvform coderecvfrom(0x4, 0x7FC86509E2B8, 0x2004) = -1 Err#35which meansResource deadlock avoidedphp-ext-apcu
apcu memory operation calling
madvise,munmap, etc.