01 Distributed Cache Overview
Why use
Why use a distributed cache, a very simple thing you have current system does not apply to the performance of your portfolio would have to upgrade your system to improve system performance, improve several areas where, optimized code, database optimization, use static under data, only in stand-alone has no way to meet the business case will go to consider cluster is then distributed
Distributed means that you want the original system into multiple services, which involves calling and consistency of data between services. The future will become a stand-alone distributed, concurrent performance of the system has sufficient lifting but the pressure of big database up a large number of database I / O operations consume a large amount of resources. How to reduce the pressure on the database, read from the disk
Data into memory to reduce disk I / O operations is cached, the cache is assigned to multiple servers distributed cache.
Scenarios
01- page caching
After the return and render when we visit a website, the request is sent to the background, the background check from the database to data, resources consumed in the process of reading and rendering data, so it is necessary to enter the data read from the cache before look no further query cache rendering from the database and stored in the cache
02- State Cache
Problem solving session synchronization of distributed Web-deployed, state caching. Cache includes state data during Session session state and application scale, such data are generally difficult to restore, high availability requirements.
Parallel Processing 03-
Distributed computing, data sharing intermediate
04- Transactions
Coherence distributed transaction data in the cache and database
06- hot data
Amount concurrent system, data of high access frequency hotspot
Application Technology
07-Ehcache
Ehcache is open source Java distributed cache a widely used. Mainly for common caching, Java EE and lightweight containers. It has a memory and disk storage, the cache loader, the cache extensions, cache exception handler, a buffer gzip servlet filter support REST and SOAP api characteristics.
09-Memcached
10-Redis
Issues and Challenges
11- Data Consistency
In distributed systems, or due to network a variety of problems may lead to inconsistent data in the database and cache data
Reference: https: //blog.csdn.net/chenyiminnanjing/article/details/82763928
12- cache penetration
Cache penetrating query data in the cache does not exist, does not exist in the cache will query to the database, resulting in a pressure increase in the time to read the database data growth.
solution:
13- cache avalanche
Over time, lead to the disappearance of large amounts of cache data to increase traffic database