php執行redis測試

2022-06-12 20:15:12 字數 1189 閱讀 1738

在今天將官方的redis教程看完之後,想自己來乙個測試。

按照官方給出的**:

1

<?php2//

連線本地的 redis 服務

3$redis = new

redis();

4$redis->connect('127.0.0.1', 6379);

5echo "connection to server sucessfully";6//

檢視服務是否執行

7echo "server is running: "+ $redis->ping();

8 ?>

執行的時候,報錯:

a non-numeric value encountered

將$redis->ping()輸出的時候,發現返回的是false;

折騰一陣子之後,發現不是這個問題。

然後就將錯誤的資訊輸出:

1

$redis = new

redis();

2$redis->connect('127.0.0.1', 6379);

3echo "connection to server sucessfully";4//

檢視服務是否執行

5try

catch (exception

$e)

發現出錯的資訊輸出為:

maximum execution time of 30 seconds exceeded

採用第二種方法:

1

$redis = new

redis();

2set_time_limit(0);

3$redis->connect('127.0.0.1', 6379);

4echo "connection to server sucessfully";5//

檢視服務是否執行

6try

catch (exception

$e)

發現這個時候的報錯為:

error on connection

然後再檢視一些資料,發現可能是記憶體的問題:

然後關掉本地的redis伺服器,重新啟動,輸出成功!

ps:以上兩篇博文沒有在得到博主的允許下引用,如果有異議,希望可以聯絡本人,本人及時修改。

謝謝!多多指導!

redis效能測試

redis 效能測試 1 測試機器 1顆4核 intel r xeon tm cpu 3.00ghz cpu 2g記憶體 測試前伺服器負載為 2 測試方式 php模組安裝redis下的php插入,提取測試。3 string 測試 測試 redis new redis redis connect 12...

Redis 效能測試

redis 效能測試是通過同時執行多個命令實現的。redis 效能測試的基本命令如下 redis benchmark option option value 以下例項同時執行 10000 個請求來檢測效能 redis benchmark n 10000 ping inline 141043.72 r...

redis 安裝測試

安裝redis,2 解壓 tar xvzf redis 2.4.15.tar.gz3 安裝 make4 測試 make testyou need tclsh8.5 in order to run the redis test解決方法,安裝tcl。sudo apt get install tcl8.5...