当前位置:网站首页>Redis usage scenario sharing (project practice)
Redis usage scenario sharing (project practice)
2022-06-22 18:38:00 【Chen Xi should work hard】
【 Chen Xi has to work hard 】:hello Hello, I'm Chen Xi , I'm glad you came to read , Nickname is the hope that you can constantly improve , Moving forward to good programmers !
The blog comes from the project and the summary of the problems encountered in programming , Occasionally there are books to share , I'll keep updating Java front end 、 backstage 、 database 、 Project cases and other related knowledge points summary , Thank you for your reading and attention , I hope my blog can help more people , Share and gain new knowledge , Make progress together !
We quarryers , The heart of a cathedral , May we go in our own love …
One 、 Application scenarios
Redis The use of is to ease the high and send MySQL The pressure !
quote Redis after , The first query MySQL, Store data synchronization in Redis in , Subsequent queries can directly query the cache
I share my B Application scenarios in end products !
For example, a merchant inquires about the sales volume of its own store , sales volumes , Customer unit price , Gross profit margin and other data !
- Base date data : Like today 2022-06-10 So the benchmark time is 2022-06-09( The day before )
- Underlying data logic : The underlying data is not simply queried , For example, sales volume involves function calculation , Gross profit margin is calculated in the business code
After querying the corresponding data, store it in Redis in , Follow up directly from Redis Take it
About Redis and MySQL Analysis of data consistency in this scenario
Real business scenarios : Before today's Day , For example, before eight o'clock , The sales data of the previous day will be synchronized to our database table , And it won't change ! At the same time, the deadline for sales data that can be queried today is the previous day ( Financial day ). So no matter how many times MySQL and Redis The data are the same !( because MySQL Business data will not change ); Introduce... Here Redis The interface speed is greatly optimized !
Two 、 Application effect
Original logic : service layer Encapsulation method 1,2,3 return result Cache database not used Present logic : service layer Check cache , There are direct returns in the cache ( Only the first time you need to query MySQL) Use the cache database
Graphic, : introduce Redis After caching, it is obvious that the execution logic of the corresponding interface is shortened , And greatly shorten
Real business sharing
What we're doing right now B End business , A one-time query may involve more than a dozen fields , Add the year-on-year and month on month calculations , The access request of an interface may be about 2-3S; If the cache database is used, it can be directly optimized to 0.1-0.2S;
B End products +C End products
What we're doing right now B The end product mainly means that the merchant can see the sales data , Focus on querying specific data , Businesses are more concerned about whether the data queried is correct , Therefore, there are many query fields in business , Interface access is slow , At present, the average number of first-time queries is 2-3S, But such a scenario is understandable for businesses !
- B End products , Also called To B(To Business) product , That is, enterprise level products for enterprises or specific user groups ;
- C End products , Also called To C(To Customer) product , That is, products for ordinary consumers .
- B Focus on function ,C Focus on experience .
3、 ... and 、 Related expansion
Share what you have sorted out before Redis Related knowledge , Welcome to punch in 、 communicate 、 communication !
- Read Redis Master slave architecture 、 Sentinel mode 、 colony
- Read Redis Persistence mechanism
- Redis Cache breakdown 、 Cache penetration 、 Cache avalanche principle and solution
- Redis Data type String Application scenarios of
- Redis Detailed explanation of basic interview knowledge
Thank you very much for reading here , If this article helps you , I hope I can leave your praise Focus on ️ Share Leaving a message. thanks!!!
May we go in our own love !
边栏推荐
- [small program project development -- Jingdong Mall] rotation chart of uni app development
- @“齐鲁多娇”幸运用户,山东5A景区喊你免费游园啦!
- Nuxt - Universal(SSR / SSG)/ Single Page App(渲染模式)
- Is it safe for Ping An Securities to open an account? What is its relationship with Ping An Bank?
- The Jenkins container failed to install the ruby runtime plug-in. Solve the error
- SaaS application development guide
- JSP learning (I) -- overview of JSP
- 同花顺软件是什么?网上开户安全么?
- Jenkins的安装与升级
- [tools] related use of PIP and CONDA
猜你喜欢
随机推荐
Database industry analysis: from the global IT industry trend to the development of domestic databases
Grafana 9 正式发布,更易用,更酷炫了!
Tasks and responsibilities of the test team and basic concepts of testing
c# sqlsugar,hisql,freesql orm框架全方位性能测试对比之sqlserver
Nuxt - 超详细环境搭建及创建项目整体流程(create-nuxt-app)
In May, 2022, China's game manufacturers and applications went to sea, with top 30 revenue in EMEA region
排序---
使用完整功能模仿设计法
How to do well in R & D efficiency measurement and index selection
Five practical tips for power Bi (complimentary books at the end of the article)
ADAU1452开发系统界面与代码数据之间的关系
Cookie加密3+RPC解法
docker: Error response from daemon: Conflict. The container name “/mysql“ is already in use by conta
游戏NFT市场:OpenSea最易被切下的蛋糕
Oculus学习笔记之控制器输入初步(一)
Introduction to rsps2022 finalist | Dr. Yang Bai
不断重修的计划与变化
SystemVerilog(十二)-$unit声明空间
详解openGauss多线程架构启动过程
AHA C language Chapter 6 God, a large string of numbers is approaching (lesson 26)






