CN111258928A - High-performance two-stage cache device for scale website application - Google Patents

High-performance two-stage cache device for scale website application Download PDF

Info

Publication number
CN111258928A
CN111258928A CN202010029920.1A CN202010029920A CN111258928A CN 111258928 A CN111258928 A CN 111258928A CN 202010029920 A CN202010029920 A CN 202010029920A CN 111258928 A CN111258928 A CN 111258928A
Authority
CN
China
Prior art keywords
cache
redis
data
service
level cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010029920.1A
Other languages
Chinese (zh)
Inventor
王知明
李�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dahan Software Co Ltd
Original Assignee
Dahan Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dahan Software Co Ltd filed Critical Dahan Software Co Ltd
Priority to CN202010029920.1A priority Critical patent/CN111258928A/en
Publication of CN111258928A publication Critical patent/CN111258928A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0811Multiuser, multiprocessor or multiprocessing cache systems with multilevel cache hierarchies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a high-performance two-stage cache device for scale website application, which belongs to the technical field of cache devices and is used for reducing the probability of accessing a cache service redis; the system is used for ensuring the consistency of the redis service data and the primary cache data; the method is used for ensuring that the storage size occupied by the first-level cache is controllable. The invention reduces the service pressure of the cache service by using the first-level cache, and the application response speed is higher than that of the cache service which is completely used.

Description

High-performance two-stage cache device for scale website application
Technical Field
The invention relates to a cache device, in particular to a high-performance two-level cache device for large-scale website application, and belongs to the technical field of cache devices.
Background
With the increasing data volume of the application system and the increasing front-end access volume, more and more hot data can be stored to a cache service, so that an access request firstly reads the cache data instead of reading the database, the response speed is improved, and a local cache and a cache service are cached at present, wherein the local cache represents ehcache, and the cache service represents redis.
The local cache speed is fast but the memory size is limited due to the memory sharing with the application, and more storage space and performance cannot be obtained by using distributed deployment.
The cache service redis used as an independently deployed service, the application and the application use network communication, the reids storage space is limited by an operating system, and a plurality of redis can be deployed to form a cluster to provide better service under the situations of insufficient memory space and large concurrency. However, since the redis and the application use network communication, the access amount of the application is large, and the access amount of the redis is also large, and finally, the bottleneck is found to be transferred from the application to the redis. The caching service needs to be stable continuously, otherwise, once the cache service is down, all applications using the caching service are affected, and cache avalanche is caused.
Disclosure of Invention
The invention mainly aims to solve the problems that the service pressure of cache service is high, the application response speed is lower than that of completely using the cache service, the application cache occupied by local cache is not easy to control, and the inconsistency of first-level cache and cache service data in the prior art, and provides a high-performance two-level cache device for large-scale website application.
The purpose of the invention can be achieved by adopting the following technical scheme:
a high-performance two-level cache device for scale website application is used for reducing the probability of accessing a cache service redis; the system is used for ensuring the consistency of the redis service data and the primary cache data; the method is used for ensuring that the storage size occupied by the first-level cache is controllable.
Further, the method for reducing the probability of accessing the cache service redis comprises the following steps:
step 1: adding an application level cache before a cache service redis, recording as a first level cache, storing data acquired from the redis, accessing the first level cache when the application acquires the data, and directly returning the data to the application if the data exists;
step 2: and if the required data does not exist in the primary cache, continuing to call a secondary cache service redis, acquiring the data, storing the data into the primary cache, and returning the data to the application.
Further, the step of ensuring the consistency of the data of the redis service and the first-level cache data comprises the following steps:
step 1: when an application program triggers cache modification and deletion by using the device, firstly modifying the first-level cache, and modifying the redis cache after the first-level cache is successfully modified, and simultaneously, the device releases a key for modification and deletion by using a release function pub of the redis;
step 2: other applications in the cluster use a sub subscription function of the redis of the device to monitor and release modified and deleted keys, and update the local primary cache after receiving the keys;
and step 3: enabling a key event notification function of redis and starting key expiration listening notify-key-events "Ex";
and 4, step 4: the device monitors key expiration events of the redis, and deletes the value corresponding to the local first-level cache when receiving the expired key.
Further, ensuring that the size of the occupied storage of the first-level cache is controllable comprises the following steps:
step 1: controlling the size of the first-level cache by various parameters, including the limitation of the number of caches, the limitation of cache space and a cache elimination strategy;
step 2: and when any one of the number of the caches and the occupied memory space reaches a set threshold value, eliminating the cache with the least use according to the LRU strategy.
The invention has the beneficial technical effects that:
the high-performance two-level cache device for the scale website application provided by the invention has the advantages that the service pressure of the cache service is reduced by using the first-level cache, the application response speed is higher than that of the cache service which is completely used, the use amount of the first-level cache is controlled, the application cache occupied by the local cache is effectively controlled, and the consistency of the first-level cache and the cache service data is kept.
Drawings
FIG. 1 is a flow chart of a high performance two-level cache device operation caching method for large-scale web applications according to the present invention.
Detailed Description
The present invention will be described in further detail below in order to make the technical solutions of the present invention more clear and definite to those skilled in the art, but the embodiments of the present invention are not limited thereto.
The high-performance two-level cache device for the large-scale website application provided by the embodiment has the following specific operation method:
(1) the device realizes a subscription interface of the redis so as to realize monitoring;
(2) the application calls the external interface of the device to operate the cache;
(3) the device operates a first-level cache for the newly added, deleted and modified keys, operates the cache service after the successful operation, issues the operated Key and issues the modified, deleted and invalid keys;
(4) the application using the device monitors the key operation message from the cache service, so as to update the first-level cache;
(5) and the first-level cache controls the usage amount of the cache according to the setting, and when any one of the number of the caches and the cache capacity reaches the upper limit, the least usage principle is used for eliminating the infrequent keys to vacate the space.
In this embodiment, as shown in fig. 1, the service pressure of the cache service is reduced by using the first-level cache, the application response speed is higher than that of the cache service used completely, and the first-level cache is updated by monitoring the key operation message from the cache service.
The above description is only for the purpose of illustrating the present invention and is not intended to limit the scope of the present invention, and any person skilled in the art can substitute or change the technical solution of the present invention and its conception within the scope of the present invention.

Claims (4)

1. A high-performance two-level cache device for scale website application is characterized in that the cache device is used for reducing the probability of accessing a cache service redis; the system is used for ensuring the consistency of the redis service data and the primary cache data; the method is used for ensuring that the storage size occupied by the first-level cache is controllable.
2. A high performance two-level caching apparatus for scaled website applications as recited in claim 1, wherein reducing the probability of access to the caching service redis comprises the steps of:
step 1: adding an application level cache before a cache service redis, recording as a first level cache, storing data acquired from the redis, accessing the first level cache when the application acquires the data, and directly returning the data to the application if the data exists;
step 2: and if the required data does not exist in the primary cache, continuing to call a secondary cache service redis, acquiring the data, storing the data into the primary cache, and returning the data to the application.
3. The apparatus of claim 1, wherein the step of ensuring consistency between data of the redis service and the first-level cache data comprises the steps of:
step 1: when an application program triggers cache modification and deletion by using the device, firstly modifying the first-level cache, and modifying the redis cache after the first-level cache is successfully modified, and simultaneously, the device releases a key for modification and deletion by using a release function pub of the redis;
step 2: other applications in the cluster use a sub subscription function of the redis of the device to monitor and release modified and deleted keys, and update the local primary cache after receiving the keys;
and step 3: enabling a key event notification function of redis and starting key expiration listening notify-key-events "Ex";
and 4, step 4: the device monitors key expiration events of the redis, and deletes the value corresponding to the local first-level cache when receiving the expired key.
4. The apparatus of claim 1, wherein the step of ensuring that the size of the first-level cache occupied by the high-performance two-level cache is controllable comprises the following steps:
step 1: controlling the size of the first-level cache by various parameters, including the limitation of the number of caches, the limitation of cache space and a cache elimination strategy;
step 2: and when any one of the number of the caches and the occupied memory space reaches a set threshold value, eliminating the cache with the least use according to the LRU strategy.
CN202010029920.1A 2020-01-13 2020-01-13 High-performance two-stage cache device for scale website application Pending CN111258928A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010029920.1A CN111258928A (en) 2020-01-13 2020-01-13 High-performance two-stage cache device for scale website application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010029920.1A CN111258928A (en) 2020-01-13 2020-01-13 High-performance two-stage cache device for scale website application

Publications (1)

Publication Number Publication Date
CN111258928A true CN111258928A (en) 2020-06-09

Family

ID=70953997

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010029920.1A Pending CN111258928A (en) 2020-01-13 2020-01-13 High-performance two-stage cache device for scale website application

Country Status (1)

Country Link
CN (1) CN111258928A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858669A (en) * 2020-07-03 2020-10-30 上海众言网络科技有限公司 Method and device for second-level caching of data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6799251B1 (en) * 2000-08-29 2004-09-28 Oracle International Corporation Performance-based caching
CN109669960A (en) * 2018-12-25 2019-04-23 钛马信息网络技术有限公司 The system and method for caching snowslide is avoided by multi-level buffer in micro services
CN109710639A (en) * 2018-11-26 2019-05-03 厦门市美亚柏科信息股份有限公司 A kind of search method based on pair buffers, device and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6799251B1 (en) * 2000-08-29 2004-09-28 Oracle International Corporation Performance-based caching
CN109710639A (en) * 2018-11-26 2019-05-03 厦门市美亚柏科信息股份有限公司 A kind of search method based on pair buffers, device and storage medium
CN109669960A (en) * 2018-12-25 2019-04-23 钛马信息网络技术有限公司 The system and method for caching snowslide is avoided by multi-level buffer in micro services

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
段春梅;: "云计算分布式缓存技术在海量数据处理平台中的应用", no. 01 *
王宏志: "《大数据管理系统原理与技术》", 机械工业出版社, pages: 205 - 209 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858669A (en) * 2020-07-03 2020-10-30 上海众言网络科技有限公司 Method and device for second-level caching of data

Similar Documents

Publication Publication Date Title
US10133679B2 (en) Read cache management method and apparatus based on solid state drive
KR100451211B1 (en) System and method for maintaining consistency of transaction cache in mobile computing environments
CN111159066A (en) Dynamically-adjusted cache data management and elimination method
CN112260876A (en) Dynamic gateway route configuration method, platform, computer equipment and storage medium
US20080133830A1 (en) Efficient utilization of cache servers in mobile communication system
US20090327621A1 (en) Virtual memory compaction and compression using collaboration between a virtual memory manager and a memory manager
CN111125247A (en) Method, device, equipment and storage medium for caching redis client
CN106844740A (en) Data pre-head method based on memory object caching system
US20190370187A1 (en) Cache Replacement Method, Apparatus, and System
WO2011131066A1 (en) Internet of things system and buffer control method thereof
CN108614847B (en) Data caching method and system
CN105512129A (en) Method and device for mass data retrieval, and method and device for storing mass data
CN109376125A (en) A kind of metadata storing method, device, equipment and computer readable storage medium
CN104202424A (en) Method for extending cache by software architecture
CN106599152A (en) Data caching method and system
CN101217449B (en) A remote call management procedure
CN111966719A (en) Method for refreshing local data cache of distributed consumer credit system in real time
CN111258928A (en) High-performance two-stage cache device for scale website application
US9489305B2 (en) System and method for managing bandwidth and power consumption through data filtering
CN116595014B (en) Storage system, method and device for read receipt and readable storage medium
CN110990483B (en) Data access and control method and system for cache nodes in distributed cache
CN110413689B (en) Multi-node data synchronization method and device for memory database
CN107577618B (en) Three-path balanced cache elimination method and device
CN112650694B (en) Data reading method and device, cache proxy server and storage medium
CN109739516B (en) Cloud cache operation method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination