Home  >  Article  >  Backend Development  >  How to check the number of connections in redis and simulate concurrent creation of redis connections in php

How to check the number of connections in redis and simulate concurrent creation of redis connections in php

高洛峰
高洛峰Original
2016-12-26 14:18:121641browse

max_redis.php

<?php
set_time_limit (0);
 
for($i=1;$i<=1050;$i++){
    exec("nohup php /var/www/html/big/link_redis.php > /dev/null &");
}

link_redis.php

<?php
set_time_limit (0);
$redis = new redis();
$redis->pconnect(&#39;localhost&#39;, 6379);
$redis->auth(&#39;php001&#39;);
sleep(100);
?>

redisView current Number of connections

[root@localhost ~]# cd /usr/local/redis-3.0.6
[root@localhost src]# src/redis-cli info | grep connected_clients
connected_clients: 27

The above method of checking the number of redis connections and php simulating concurrent creation of redis connections is all the content shared by the editor. I hope it can give you a reference, and I hope you will support the PHP Chinese website.

For more related articles on how to view the number of redis connections and how to simulate concurrent creation of redis connections in PHP, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn