DB,Cache, and Redis application scenario analysis-Alibaba Cloud Developer Community

Recently, I made a product on Weibo. Database (mysql),Cache(memcache), and Redis are used for data storage. In fact, at the beginning of the architecture design, we prepared to use MongoDB. Due to the high learning cost, we finally gave up and adopted a relatively conservative solution. This microblog product has been in use for nearly a year, covering mobile phone clients (ios,android) and web (not long after its launch), and now it has almost 100 million users, the write operation of optical DB has also reached tens of thousands per day. Some time ago, a read/write splitting was performed. At present, the system is relatively stable. The following is a brief introduction to some data storage application scenarios of microblog products. DB DB is mainly used to store data that is not frequently modified, such as Weibo, comments, friend relationships, user information, and some Weibo categories. There are a lot of join table queries here, although some views are made in some places. Due to the complexity of the business, there are still many places where more than three tables are queried. As the data volume increases gradually, the next step is to consider Database Sharding and table sharding. Cache mainly caches frequently used data, such as newly posted microblogs, comments on the first page, login user information, and microblog classification. Currently, fine-grained caching is mainly implemented. Next, some business-level caching is performed. Redis is mainly used as a counter, such as the number of posts, the number of comments, and the number of reads. It is suitable for storing data that changes frequently and needs to be stored permanently, which is also different from cache. In addition, a redis backup is performed on the friend relationship after login. Redis also stores some temporary data, such as today's hottest Weibo and this week's hottest Weibo ID list. These three components complement each other. In fact, the DB stores some data that needs to be stored permanently but is not frequently modified. Cache provides fine-grained Cache for a single table and a business layer. Redis mainly stores some insignificant and frequently changed data.

How to contact me: [Wan Lihu] www.bravetiger.cn [QQ] 3396726884 (from 100 yuan for consulting questions, from 500 yuan for helping solve problems) [blog] http://www.cnblogs.com/kenshinobiy/
Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now