Written at the beginning
Accidentally , the blogger took advantage of Alibaba Cloud's activities and renewed the Redis service for 3 years (expiration time: 2021-05-03, I wonder if the blog is still alive at that time?)
Although only a small 256MB capacity, but it is enough for the current website traffic.
After the forum accelerated last time, about 50MB+ of the cache was used up, which is obviously a bit of a waste.
A few days ago, the blog also posted a condom (HTTPS), which improved the force and pretended to be a little bit. It is said that adding S will affect the speed of the website, obviously this is beyond doubt. Although I got on Alibaba Cloud Smart CDN very early, it obviously can't stop me from pursuing the limit of speed.
Suddenly, I wanted to pretend again.
Relevant Environment
Operating System : Linux centos 6.5
Web Server: nginx/1.10.3
Blog Program: Typecho
Cache Service: Alibaba Cloud Redis
Cache Plug-in: TpCache
Installation Plug-in
TpCache is a cache plug-in developed to reduce the concurrency pressure of websites, and supports Memcache, Redis, Mysql Three drives.
Download address: TpCache
background settings
Download - unzip - rename to TpCache - background enable, as shown in the figure:
Here, it should be noted that the plugin itself does not support password access. Since Alibaba Cloud's Redis service requires password access, I simply modified the typecho_redis.class.php file (part of the code):
copy code
public function init($option)
{
try{
$this->redis = new Redis();
$this->redis->connect($this->host, $this->port);
$this->redis->auth('redis password');
}catch (Exception $e){
echo $e->getMessage();
}
}
Since the blog supports https, I chose to enable SSL support.
Component support
Since Alibaba Cloud's Redis service is used, you only need to configure phpredis and enable the redis extension.
Redis configuration reference: Alibaba Cloud Redis Accelerates Discuz Forum Access
Cache Update Mechanism Comments
from the native comment system
Background article or page update
Restart redis
cache expiration
Test analysis
ab (apache benchmark) - a test tool that comes with apache, which generally puts pressure on apache The test is called an AB test.
We can simulate 10 concurrent users sending 100 requests to a page.
Copy code
ab -c 10 -n 100 https://blog.52itstyle.com/archives/186/
Here, we just take a few parameters for comparison. Copy
the code before turning on the Redis cache //The duration of the entire test Time taken for tests: 23.176 seconds //One of the indicators that everyone is most concerned about, it is equivalent to the number of transactions per second in LR, and the mean in the parentheses indicates that this is an average Value Requests per second: 4.31 [#/sec] (mean) //The second indicator that everyone cares about the most is equivalent to the average transaction response time in LR. The mean in parentheses indicates that this is an average Time per request: 2317.623 [ms] (mean) //The average traffic on the network per second can help to rule out whether there is a problem that the response time is prolonged due to excessive network traffic Transfer rate: 139.82 [Kbytes/sec] received //The response of all requests in the whole scene Condition percentage of the requests served within a certain time (ms) 50% 1071 66% 1304 75% 1693 80% 1874 90% 2705 95% 4462 98% 14752 99% 15347
100% 15347 (longest request)
After the Redis cache is turned on,
copy the code
//The duration of the entire test
Time taken for tests: 15.917 seconds
//One of the indicators that everyone cares about most, which is equivalent to the number of transactions per second in LR, followed by parentheses The mean indicates that this is an average
Requests per second: 6.28 [#/sec] (mean)
//The second indicator that everyone cares about most, is equivalent to the average transaction response time in LR, and the mean in parentheses later indicates that this is a Average
Time per request: 1591.713 [ms] (mean)
//The average traffic on the network per second can help to rule out whether there is a problem that the response time is prolonged due to excessive network traffic
Transfer rate: 203.40 [Kbytes/sec] received
//
Percentage of the requests served within a certain time (ms) 50
% 1263
66% 1491
75% 1816
80% 1987
90% 2507
95% 3917
98% 4049
99% 4658
100% 4658 (longest request)
test analysis, simply comparing the above parameters, the effect is quite significant.
Recommended reading: https://bbs.aliyun.com/read/314696.html
Recommended purchase: https://www.aliyun.com/product/kvstore
Alibaba Cloud Redis accelerates Typecho blog access
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326229769&siteId=291194637
Ranking