Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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);
/* 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
You can’t perform that action at this time.