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

高洛峰
Release: 2023-03-04 10:20:02
Original
1649 people have browsed it

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 &");
}
Copy after login

link_redis.php

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template