Application of memcached in high load concurrent Web sites (ii)---application scenarios

Source: Internet
Author: User
Tags memcached range

Before writing this article, I have also deliberately made some exchanges with my former colleagues, thanks to Sina Xiangdong, Kingsoft Zhangyan and Yahoo Luke. In addition, there are a number of online friends to my last section of the article published a lot of constructive comments, here together thanks.

The most attractive part of memcached is its distribution. Distributed computing, distributed storage, and both, are basically divided into three different ways for Internet applications to be used. Memcached is a kind of distributed storage. Most of our common distributed storage is to build a disk array of n devices (server or individual storage), while memcached is designed to build a high-speed memory pool. More generally speaking: distributed computing is to assemble N CPU into a CPU, distributed slow storage is the n hard disk assembled into a large hard drive, Memcached is the n block of memory assembled into a large memory.

A friend asked: "That is not very expensive AH." My answer is in the affirmative. If your site size only 32 servers, I think you do not have to consider such a scheme, and so your site after the big, and then refer to this information. Generally are relatively large internet companies in order to pursue a better user experience, only to carry out this investment, for them, the user experience first, money is small case.

and a friend. Q: Some DBMS provide memory table functions, such as MySQL memory table, can replace memcached. But I would suggest that you are: the MySQL memory table does play the same role, but its limitations are also many, often can not let you arbitrary, so suggest you not detours.

Second, the application scene of memcached

2.1 Range of applications

Memcached products or related technology applications, we have mentioned in the previous some. In fact, its application is very common, the application as a wide range of areas: such as SNS Web sites, blog types of websites, BBS class sites and IM background services.

Application of 2.2 SNS website

LiveJournal.com is a project that started in the 99 on campus, a bit like the Chinese school net. A few students are purely out of love to do such a website, mainly to achieve the following functions: SNS, blog, BBS and RSS and so on. LiveJournal started with a lot of open source software, and now it has spawned a lot of open source software. SNS site, now everywhere, the scale of the larger like happy, school, 51, their pages often need to refer to a large number of user information, friend information and article information, so across the table or cross library operations will be quite a lot. If all these functions directly manipulate the database, it will obviously result in significant loss of efficiency and system load. Memcached in such a scene will play a huge role, it uses large memory to all these unchanged data cache, when the data changes to notify cache expiration, so that the application layer can basically solve most of the problems, only a small part of the request through the application layer, used to the database.

Application of 2.3 Blog and BBS website

Like blog.sina.com.cn, which has a huge flow of blog systems, it needs some small data that is frequently read and written. One of the most typical applications, we usually become "digital services", such as the blog needs real-time display of user clicks and reading number, BBS need to record the number of online users, and so on. These small data processing is very cumbersome, you no matter how to design the database, it is difficult to avoid across the table or across the library. Some friends will say that you can add redundant fields in the database to solve such problems, but in fact, this is not consistent with the database design paradigm rules, and it is difficult to achieve data consistency, which can lead to more complex problems. And because of the dispersed development of the product line, the data is difficult to achieve a complete unified planning. Memcached in such a scenario will be the small data cache, regular persistence on it, query operations have been running in memory. Here, some friends will think of some other questions: "Memcached server downtime, how to guarantee the data consistent with the database." I will say to you: "Your question is very good, we will give the corresponding solution in the later chapters." In addition, this small data is not a critical data, even if there are occasional errors, there is not much problem. Blog, BBS system is not strict enterprise-class system, if you are for the banking business to provide solutions, memcached is not suitable.

Application of 2.4 IM server

Some time ago, some articles introduced memcached in the Jabber application. Write tired, drink saliva, the reader himself to find information it, have time, help me to fill it, hehe.

We cite a few examples to illustrate that memcached's scenario, which seems to be confined to small data services, is not a buffer for larger data? That is by no means, memcached can be used to store data in a variety of formats, including images, videos, files, and the results of database retrieval, and so on, but also in the production environment to run, but for large data to use buffer, a bit too wasteful, the same amount of memory can not save a few So it will obviously reduce the hit rate.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.