Interface processing logic: Get weather forecast information, 1500 City weather: The first time the program processing, will first determine whether the Redis key exists, if there is, directly return the corresponding data; if there is no key, read the MySQL corresponding table data, cache the data to Redis, and return the data If the second time in the access to the same data, go directly redis get the corresponding data. Compare the MySQL and Redis processing performance of the business:
Break off Redis service, do not go redis, go MySQL fetch data, 1000 concurrent pressure test 5 minutes Result:
avg=2.86s,tps=312, as shown in figure:
Start Redis service, get Redis data, walk Redis cache, 1000 concurrent 5 minutes result of pressure test:
Avg=0.4s,tps=2033, as shown in figure:
Conclusion: Similarly, the same business configuration and the pressure test scheme, go redis cache, improve performance, TPS from 312 to 2033,
Avg dropped from 2.86S to 0.4S
Other: Get the exchange rate interface, the same conclusion, as shown in figure: