测试kestrel的队列(二)
1.安装kestrel队列服务,见(一)
2.php的扩展memcached的安装
wget http://pecl.php.net/get/memcached-1.0.2.tgz
tar zxvf memcached-1.0.2.tgz
cd memcached-1.0.2
/usr/local/php/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-libmemcached-dir=/usr/local/libmemcached
./configure -prefix=/usr/local/phpmemcached -with-memcached
make && make install
vi /usr/local/php/lib/php.ini
extension=memcache.so
3.通过php memcached 扩展链接添加和取kestrel队列
<?php
$mem = new Memcache;
$mem->addServer("127.0.0.1", '22133');
$mem->set('queueTest','aaaa');
$mem->set('queueTest','xxxx');
$mem->set('queueTest','xxxx333');
print $mem->get('queueTest' )."=get\n";
print $mem->get('queueTest' )."=get\n";
print $mem->get('queueTest' )."=get\n";
$mem->close();
?>
测试队列结果
# php testQueue.php
aaaa=get
xxxx=get
xxxx333=get
4.测试其他:
<?php
$mem = new Memcache;
$mem->addServer("127.0.0.1", '22133');
$stats = $mem->getStats ( );
print_r($stats);
$mem->close();
?>
# php testOther.php
Array
(
[uptime] => 102079
[time] => 1378462285
[version] => 2.2.0
[curr_items] => 0
[total_items] => 41
[bytes] => 0
[reserved_memory_ratio] => 0.352
[curr_connections] => 1
[total_connections] => 133
[cmd_get] => 47
[cmd_set] => 41
[cmd_peek] => 0
[get_hits] => 39
[get_misses] => 8
[bytes_read] => 3199
[bytes_written] => 14377
[queue_creates] => 7
[queue_deletes] => 2
[queue_expires] => 0
[queue_fuck_items] => 0
[queue_fuck_bytes] => 0
[queue_fuck_total_items] => 9
[queue_fuck_logsize] => 252
[queue_fuck_expired_items] => 0
[queue_fuck_mem_items] => 0
[queue_fuck_mem_bytes] => 0
[queue_fuck_age] => 0
[queue_fuck_discarded] => 0
[queue_fuck_waiters] => 0
[queue_fuck_open_transactions] => 0
[queue_fuck_total_flushes] => 0
[queue_uptime_items] => 0
[queue_uptime_bytes] => 0
[queue_uptime_total_items] => 0
[queue_uptime_logsize] => 0
[queue_uptime_expired_items] => 0
[queue_uptime_mem_items] => 0
[queue_uptime_mem_bytes] => 0
[queue_uptime_age] => 0
[queue_uptime_discarded] => 0
[queue_uptime_waiters] => 0
[queue_uptime_open_transactions] => 0
[queue_uptime_total_flushes] => 0
[queue_queueTest_items] => 0
[queue_queueTest_bytes] => 0
[queue_queueTest_total_items] => 5
[queue_queueTest_logsize] => 136
[queue_queueTest_expired_items] => 0
[queue_queueTest_mem_items] => 0
[queue_queueTest_mem_bytes] => 0
[queue_queueTest_age] => 0
[queue_queueTest_discarded] => 0
[queue_queueTest_waiters] => 0
[queue_queueTest_open_transactions] => 0
[queue_queueTest_total_flushes] => 0
[queue_hx_items] => 0
[queue_hx_bytes] => 0
[queue_hx_total_items] => 3
[queue_hx_logsize] => 83
[queue_hx_expired_items] => 0
[queue_hx_mem_items] => 0
[queue_hx_mem_bytes] => 0
[queue_hx_age] => 0
[queue_hx_discarded] => 0
[queue_hx_waiters] => 0
[queue_hx_open_transactions] => 0
[queue_hx_total_flushes] => 0
[queue_aaa_items] => 0
[queue_aaa_bytes] => 0
[queue_aaa_total_items] => 0
[queue_aaa_logsize] => 0
[queue_aaa_expired_items] => 0
[queue_aaa_mem_items] => 0
[queue_aaa_mem_bytes] => 0
[queue_aaa_age] => 0
[queue_aaa_discarded] => 0
[queue_aaa_waiters] => 0
[queue_aaa_open_transactions] => 0
[queue_aaa_total_flushes] => 0
)