WO2012139328A1 - 缓存服务器系统及其应用方法、缓存客户端、缓存服务端 - Google Patents

缓存服务器系统及其应用方法、缓存客户端、缓存服务端 Download PDF

Info

Publication number
WO2012139328A1
WO2012139328A1 PCT/CN2011/075964 CN2011075964W WO2012139328A1 WO 2012139328 A1 WO2012139328 A1 WO 2012139328A1 CN 2011075964 W CN2011075964 W CN 2011075964W WO 2012139328 A1 WO2012139328 A1 WO 2012139328A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
cache server
client
data
database
Prior art date
Application number
PCT/CN2011/075964
Other languages
English (en)
French (fr)
Inventor
戴林
吴丽梅
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012139328A1 publication Critical patent/WO2012139328A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/18Information format or content conversion, e.g. adaptation by the network of the transmitted or received information for the purpose of wireless delivery to users or terminals

Definitions

  • the present invention relates to the field of data storage, and in particular, to a cache server system and an application method thereof, a cache client, and a cache server. Background technique
  • the caching technology is more and more widely used, and a variety of caching technologies are in full bloom.
  • the distributed caching system can significantly solve the performance access bottleneck between the database server and the WEB server in the Internet application.
  • the master-slave structure In the existing distributed cache server system, the master-slave structure is used, that is, the master server establishes a data directory for storing data information stored from the server, and accepts the user's data request, and accesses the slave server according to the data directory.
  • the primary server also needs to manage the storage data on each slave server, considering load balancing. In this mode, on the one hand, the primary server is under great pressure, and the entire system cannot be used after the primary server is down. When the cached content reaches a certain order of magnitude, the data directory structure on the primary server is very large, and the query data directory is inefficient.
  • the master-slave server information needs to be configured in advance, the system update and expansion is extremely inconvenient when the entire master-slave cache system is running. Summary of the invention
  • the present invention provides a cache server system and an application method thereof, a cache client, and a cache server, so as to solve the problem that the existing distributed cache system is inconvenient when updating and expanding, and when the amount of data is large, The problem of inefficient servers.
  • the present invention provides a cache server system, including one or more cache clients, one or more cache servers, and an in-memory database server, where The cache client is configured to obtain all cache server information from the in-memory database server, establish a connection with the cache server, and generate and periodically maintain a link list;
  • An in-memory database server configured to establish and save a cache server information table, a data storage category and a cache server corresponding directory table, and after receiving the cache server information reported by the cache server, if the cache service is included in the database End information, then update the corresponding disk space data, otherwise the cache server information is inserted into the database;
  • the cache server is configured to report the cache server information to the in-memory database server, and complete management of the cache data block.
  • the cache server information includes: an ip address of the local end, a cache service port, and a current available disk space.
  • the obtaining the information of all the cache server from the in-memory database server, establishing a connection with the cache server, and generating the link list is specifically:
  • the cache client After the startup, the cache client periodically queries all the cache server information to the in-memory database server, and establishes a link list in the cache client according to all the cache server information returned by the cache database server, where each cache server is stored. Information, the cache client establishes a connection with the cache server, and stores the connection status in the link list;
  • the function of the cache client link list is: when there is a data request, the cache client classifies the data of the data request, and queries the database for the cache server stored in the category, and the database returns the cache server information to the cache. On the client side, the cache client needs to check the cache server information according to the link list, and the request is forwarded to the cache server, otherwise an error response is returned.
  • timing maintenance link list is specifically:
  • the cache client periodically obtains all cache server information from the database, and adds the newly added cache server information to the link list;
  • the cache client uses heartbeat messages to periodically detect the status of each cache server link and The link connection status update is written into the link list, and the link list is periodically updated, and the link list is used to cache the link check when the client processes the request.
  • the cache client is further configured to: after receiving the insertion request processing of the application, determine a data request category, and then query the in-memory database to query the data category and the cache server to store the corresponding directory table; and The link list check whether the cache server information returned by the database is valid, if it is valid, the insert request is immediately forwarded; if it is invalid, a valid link is found in the current link list, and the insert request is forwarded; and the forwarding application insertion is processed. After the request, the corresponding data category and the storage cache server information are sent to the database for update;
  • the in-memory database server is configured to determine whether the corresponding cache server information exists in the database. If the corresponding cache server information does not exist in the database, the cache server information with the largest disk free space is searched, and the cache client information is returned to the cache client. If the corresponding cache server information exists in the database, return the corresponding cache server information to the cache client;
  • the cache server is configured to insert a data block into the memory after receiving the insert request, and write the data block to a file and store the file in the disk; the specific manner is: establishing a data block hash list in the memory, and inserting the data block The data block is stored in the memory data block linked list, and is linked as a key value by the data block request, and the data block is written to the file and stored on the disk.
  • the cache server is further configured to manage an in-memory data block list by using a least recently used (LRU) algorithm to place a newly inserted or newly accessed data block in a linked list header, the entire linked list. Arranged in order of access time.
  • LRU least recently used
  • the writing the data block to the file and depositing the file into the disk is specifically:
  • the cache server encrypts the data request category, obtains a 32-bit ciphertext class code, and combines the ciphertext class code into a storage path, and writes the data block as a binary file and stores the data file in the storage path.
  • the 32-bit ciphertext class code is combined into a storage path
  • the 32-bit ciphertext password is a combination of Roman numerals and lowercase English numbers
  • the front of the 32-bit password The two are the first directory name
  • the third and fourth digits of the password are the second subdirectory name
  • the third subdirectory is named after the 32-bit password
  • the fourth layer is the binary file written by the data block
  • the cache client is configured to receive a query request of the application, determine a data request category, query the in-memory database for the data category and the cache server to store the corresponding directory table, and search the cache server information returned according to the database. Checking the current state of the cache server in the link list, and if the query request is forwarded to the cache server, waiting for the cache server to locate the data, the result is returned; otherwise, the failure response is returned;
  • the cache server is configured to perform location acquisition of the data block from the cache server memory according to the query request.
  • the obtaining of the data block from the cache server memory according to the query request is specifically:
  • the cache server searches for a hash table according to the key value of the query request, and after updating, returns the corresponding data block linked list, and returns the data to the cache client. If not found in the memory, the file block is named and stored according to the data block file. In the way, directly locate the data block, if there is data, then return the failure response.
  • the present invention further provides a cache client, wherein the cache client is configured to obtain all cache server information from an in-memory database server, establish a connection with the cache server, and generate and periodically maintain a link list.
  • the present invention further provides a cache server, wherein the cache server is configured to report the cache server information to the in-memory database server, and complete management of the cache data block.
  • the present invention also provides an application method of a distributed cache server system, including: the cache server reports the cache server information to the in-memory database server;
  • the in-memory database server establishes and saves the cache server information table and the data storage category and the cache server corresponding directory table, and after receiving the cache server information reported by the cache server, if the cache server information is included in the database, Then update the corresponding disk space data, Otherwise, the cache server information is inserted into the database;
  • the cache client obtains all cache server information from the in-memory database server, establishes a connection with the cache server, and generates and periodically maintains a link list.
  • the cache server information includes an ip address of the local end, a cache service port, and a current available disk space.
  • the cache client obtains all cache server information from the in-memory database server, and establishes a connection with the cache server, and generates a link list specifically:
  • the cache client After the startup, the cache client periodically queries all the cache server information to the in-memory database server, and establishes a link list in the cache client according to all the cache server information returned by the cache database server, where each cache server is stored. Information, the cache client establishes a connection with the cache server, and stores the connection status in the link list;
  • the function of the cache client link list is: when there is a data request, the cache client classifies the data of the data request, and queries the database for the cache server stored in the category, and the database returns the cache server information to the cache. On the client side, the cache client needs to check the cache server information according to the link list, and the request is forwarded to the cache server, otherwise an error response is returned.
  • the cache client periodically maintains a link list as follows: The cache client periodically obtains all cache server information from the database, and adds the added cache service information to the link list;
  • the cache client uses the heartbeat message to periodically detect the status of each cache server link, and writes the link connection status update to the link list, and periodically updates the link list, where the link list is used to cache the client processing request. Link verification.
  • the method further includes:
  • the cache client After receiving the insertion request processing of the application, the cache client determines the data request category, and then queries the in-memory database to query the data category and the cache server to store the corresponding directory table; The in-memory database server determines whether there is a corresponding cache server information in the database. If the corresponding cache server information does not exist in the database, the cache server information with the largest disk free space is searched and returned to the cache client; If the corresponding cache server information exists in the database, the corresponding cache server information is returned to the cache client.
  • the cache client checks whether the cache server information returned by the database is valid according to the link list, and if yes, immediately forwards the insert request; if invalid, finds a valid link in the current link list, and performs insert request forwarding; And processing the forwarding application insertion request, sending the corresponding data category and the storage cache server information to the database for updating;
  • the cache server After receiving the insertion request, the cache server inserts the data block into the memory, and writes the data block to the file and stores the data into the disk; the specific manner is: establishing a data block hash chain table in the memory, and storing the inserted data block In the in-memory block list, the data block is requested to be linked to the key value, and the data block is written to the file and stored on the disk.
  • the cache server encrypts the data request category, obtains a 32-bit ciphertext class code, and combines the ciphertext class code into a storage path, and writes the data block as a binary file and stores the data file in the storage path.
  • the 32-bit ciphertext class code is combined into a storage path
  • the 32-bit ciphertext password is a combination of Roman numerals and lowercase English numbers
  • the first two bits of the 32-bit password are the first layer directory.
  • the third and fourth digits of the password are the second-level subdirectory name
  • the third-level subdirectory is named after the 32-bit password
  • the fourth layer is the binary file written by the data block
  • the method further includes:
  • the cache client After receiving the query request of the application, the cache client determines the data request category, queries the in-memory database for the data category and the cache server to store the corresponding directory table, and finds the cache server information returned according to the database, in the link list. Check the current status of the cache server, If the query request is forwarded to the cache server, waiting for the cache server to locate the data block, the result is returned; otherwise, the failure response is returned;
  • the cache server obtains the location of the data block from the cache server memory according to the query request.
  • the cache server obtains the location of the data block from the cache server memory according to the query request, which is specifically:
  • the cache server searches for a hash table according to the key value of the query request, and after updating, returns the corresponding data block linked list, and returns the data to the cache client. If not found in the memory, the file block is named and stored according to the data block file. In the way, directly locate the data block, if there is data, then return the failure response.
  • the setting and use of the cache server system can be made simpler and more convenient, the access speed is faster, the system can be automatically expanded, and the update is automatically performed;
  • the client processes the application insertion and queries the data request, and only needs to perform a database operation once, and then performs a database update after the insertion, which can effectively reduce the database access pressure and improve the system access speed;
  • the directory structure is clear, and the cache server can directly hit each data block and each data block file, and the data access is fast and simple.
  • FIG. 1 is a system structural diagram of an embodiment of the present invention
  • FIG. 2 is a naming manner diagram of a cache server writing a data block to a file and storing it in a disk
  • FIG. 3 is a flowchart of an embodiment of the method of the present invention
  • FIG. 5 is a flow chart of data query of an embodiment of the method of the present invention. detailed description
  • FIG. 1 it is a system structure diagram of an embodiment of the present invention, which provides a distributed cache server system, including one or more cache clients, one or more cache servers, and an in-memory database server, where
  • a cache client configured to obtain cache server information from an in-memory database server, generate and periodically maintain a link list
  • the cache client belongs to the application side that needs to use the cache server system, and uses the Transmission Control Protocol/Internet Protocol (TCP/IP) to connect with the intranet network; the cache client starts from the memory. After obtaining all the cache server information, the database server actively establishes a connection with the cache server, and then periodically obtains the cache server information from the database to maintain the link with the cache server;
  • TCP/IP Transmission Control Protocol/Internet Protocol
  • An in-memory database server configured to create and save a cache server information table (including: cache server ip address, cache service port, disk free space, etc.) and a data storage category and a cache server corresponding directory table, after receiving the After caching the server information reported by the server, if there is in the database, the corresponding disk space data is updated, otherwise the data is inserted into the database;
  • a cache server information table including: cache server ip address, cache service port, disk free space, etc.
  • the cache server is configured to report the cache server information to the in-memory database server, and specifically: after starting, periodically send information such as the local IP address, the cache service port, and the local current available disk space to the in-memory database server.
  • the cache client is used to periodically send messages to the in-memory database after startup, and query all the delays. Storing the server information, generating a cache client link list, wherein the cache client obtains the cache server information from the database, and generates a link list by: according to all cache server information returned by the database, establishing a linked list on the client, The cache client is configured to establish a connection with the cache server, and the connection state is stored in the linked list; the function of the cache client link list is: when a data request arrives, the client classifies the requested data. After the database is queried to the cache server of the category, when the database returns the cache server information to the client, the client needs to check the cache server information according to the link list, and the request is forwarded to the peer. Otherwise an error response is returned.
  • the cache client initiates a connection establishment request to each cache server according to the information returned by the in-memory database server; periodically updates all the cache server information returned by the database, and the link establishment status to update the link list; wherein, the cache client timing is
  • the database obtains all cache server information, and adds the newly added cache server information to the linked list.
  • the cache client periodically backs up the current link list for later use.
  • the cache client uses the heartbeat message to periodically detect the status of each link of the cache server, and periodically updates the link list, where the cache client periodically updates the link.
  • the method of the linked list is as follows: The heartbeat message is sent periodically, the link connection status of each cache server is detected, and the link connection status update is written into the link list for the link check when the client processes the request.
  • the cache client receives the insertion request of the application for processing, specifically,
  • the cache client is used to determine the data request category, and then queries the in-memory database for the data category and the cache server to store the corresponding directory table.
  • Case 1 if not found in the database, the database cache server information table Find the cache server information with the largest disk free space and return it to the cache client.
  • Case 2 if found in the database, return the cache server information found to the client, and then the client checks the cache server returned by the database. Whether it is valid, if it is valid, it will forward the request immediately; if it is invalid, it will find a valid link in the current link list, request forwarding, and after processing the forwarding application insertion request, the corresponding data class will be Do not send the storage cache server information to the database for update;
  • the cache server after accepting the request, inserts the data into the memory, and writes the data block to the disk in a specific manner; the cache server processes the insert data request by: creating a data block hash in the memory (hash) linked list, the inserted data is first stored in the memory data block linked list, the data request link is the key value, and the data is written to the file and stored in the disk; the cache server manages the memory data block linked list by: using the most recent The least used (LRU, Least Recently Used) algorithm puts newly inserted or newly accessed data blocks in the head of the linked list, and the entire linked list is arranged in order of access time.
  • LRU least used
  • FIG. 2 it is a naming manner of the cache server writing the data block to the file and storing it on the disk. Specifically,
  • the cache server writes the data block to the disk by: encrypting the data request category, obtaining a 32-bit ciphertext class code, and then combining the ciphertext class code into a complete storage path, and writing the data block as a binary file. Under this path; specifically,
  • the cache server combines the absolute path using the encrypted 32-bit ciphertext class code according to the data category, in the following manner:
  • the 32-bit ciphertext password is a combination of Roman numerals and lowercase English numbers, and the first two digits of the 32-bit password are The first layer directory name, the third and fourth digits of the password are the second layer subdirectory name, the third layer subdirectory is named after the 32-bit password, and the fourth layer is the binary file written by the data block.
  • the data block file is named as follows: The data request link is encrypted, and the 32-bit ciphertext request link code is obtained, and the file is named according to the 32-bit password.
  • the cache client After the cache client establishes a connection with each cache server, it accepts the query request of the application for processing, specifically,
  • the cache client is configured to determine the data request category, and then query the in-memory database to query the data category and the cache server to store the corresponding directory table, and after searching, query the cache server information according to the database, and check the current cache server in the link list. State, if available, forward the request to the cache server, wait for the cache server to locate the data, and return the result; If there is a condition that is not met, the failure response is returned immediately.
  • the cache server is used for obtaining the data block from the cache server memory.
  • the hash table is directly searched, and the corresponding database linked list is updated, and the data is returned to the client, if not in the memory.
  • FIG. 3 it is a flowchart of an embodiment of the method of the present invention, which provides an application method of a distributed cache server system, including:
  • Step S301 the cache server reports the cache server information to the in-memory database server;
  • Step S302 the in-memory database server establishes and saves the cache server information table, the data storage category and the cache server corresponding directory table, and receives the cache service. After the server information is cached, if the cache server information is included in the database, the corresponding disk space data is updated, otherwise the cache server information is inserted into the database;
  • Step S303 The cache client obtains all cache server information from the in-memory database server, establishes a connection with the cache server, and generates and periodically maintains a link list.
  • the cache server information includes an IP address of the local end, a cache service port, and a current available disk space.
  • the cache client obtains all the cache server information from the in-memory database server, and establishes a connection with the cache server, and generates a link list specifically as follows:
  • the cache client After the startup, the cache client periodically queries all the cache server information to the in-memory database server, and establishes a link list in the cache client according to all the cache server information returned by the cache database server, where each cache server is stored. Information, the cache client establishes a connection with the cache server, and stores the connection status in the link list;
  • the function of the cache client link list is: when there is a data request, the cache client classifies the data of the data request, and queries the database for the cache server stored in the category, and the database returns the cache server information to the cache. For the client, the cache client needs to be based on the link Linked list, check the cache server information, meet the requirements to forward the request to the cache server, otherwise return an error response.
  • the cache client timing maintenance link list is specifically:
  • the cache client periodically obtains all cache server information from the database, and adds the newly added cache server information to the link list;
  • the cache client uses the heartbeat message to periodically detect the status of each cache server link, and writes the link connection status update to the link list, and periodically updates the link list, where the link list is used to cache the client processing request. Link verification.
  • the data insertion flowchart of the method embodiment of the present invention includes: Step S401: After receiving the insertion request processing of the application, the cache client determines the data request category, and then queries the in-memory database for the data category and The cache server stores the corresponding directory table. Step S402: The in-memory database server determines whether the corresponding cache server information exists in the database. If the corresponding cache server information does not exist in the database, the cache server with the largest disk free space is searched. The information is returned to the cache client; if the corresponding cache server information exists in the database, the corresponding cache server information is returned to the cache client;
  • Step S403 the cache client checks whether the cache server information returned by the database is valid according to the link list, and if yes, immediately forwards the insert request; if invalid, finds a valid link in the current link list, and inserts Request forwarding; and processing the forwarding application insertion request, sending the corresponding data category and the storage cache server information to the database for updating;
  • Step S404 after receiving the insertion request, the cache server inserts the data block into the memory, and writes the data block to the file and deposits it into the disk.
  • the specific way is as follows: Create a data block hash list in the memory, store the inserted data block in the memory data block linked list, link the data block request to the key value, and write the data block to the file and store it on the disk.
  • the cache server writes the data block to the file and deposits it into the disk as follows:
  • the cache server encrypts the data request category, obtains a 32-bit ciphertext class code, and combines the ciphertext class code into a storage path, and writes the data block as a binary file and stores the data file in the storage path.
  • the 32-bit ciphertext class code is combined into a storage path, which is specifically:
  • the 32-bit ciphertext password is a combination of Roman numerals and lowercase English numbers.
  • the first two digits of the 32-bit password are the first-level directory name
  • the third and fourth digits of the password are the second-level subdirectory name
  • the third layer is the binary file written by the data block;
  • the data query flowchart of the method embodiment of the present invention includes: Step S501: After the cache client receives the query request of the application, determines the data request category, and queries the in-memory database for the data category and the cache server storage. Corresponding to the directory table, after searching, according to the cache server information returned by the database, checking the current status of the cache server in the link list, and forwarding the query request to the cache server if available, waiting for the cache server data After the block positioning is found, the result is returned; otherwise, the failure response is returned;
  • Step S502 The cache server obtains the location acquisition of the data block from the cache server memory according to the query request.
  • the cache server obtains the location of the data block from the cache server memory according to the query request, which is specifically:
  • the cache server searches for a hash table according to the key value of the query request, and after updating, returns the corresponding data block linked list, and returns the data to the cache client. If not found in the memory, the file block is named and stored according to the data block file. In the way, directly locate the data block, if there is data, then return the failure response.

Abstract

本发明提供了一种缓存服务器系统,包括:缓存客户端,用于从内存数据库服务器中获取所有缓存服务端信息,与缓存服务端建立连接,生成并定时维护链路链表;一内存数据库服务器,用于建立并保存缓存服务端信息表以及数据存储类别与缓存服务端对应目录表,以及处理收到缓存服务端上报的缓存服务端信息;缓存服务端,用于向内存数据库服务器上报所述缓存服务端信息,并完成缓存数据块的管理。本发明还提供了一种分布式缓存服务器系统的应用方法、缓存客户端、缓存服务端。采用本发明的技术方案,可以使缓存服务器系统的设置和使用更加简洁方便,访问速度更快,系统可以自动扩展,以及自动进行更新。

Description

緩存服务器系统及其应用方法、 緩存客户端、 緩存服务端 技术领域
本发明涉及数据存储领域, 尤其涉及一种緩存服务器系统及其应用方 法、 緩存客户端、 緩存服务端。 背景技术
随着互联网技术及 WEB应用的发展, 緩存技术运用越来越广泛, 多种 緩存技术百花齐放, 其中分布式緩存系统在互联网应用中, 可以明显解决 数据库服务器和 WEB服务器之间的性能访问瓶颈。
在现有的分布式緩存服务器系统中, 多釆用主从结构, 即主服务器建 立数据目录用于存储从服务器存储的数据信息, 并接受用户的数据请求, 根据数据目录去访问从服务器, 同时, 主服务器还需要管理各个从服务器 上的存储数据, 考虑负载均衡。 这种模式下, 一方面, 主服务器存在很大 压力, 且主服务器宕机后整个系统无法使用, 当緩存的内容达到一定数量 级时, 主服务器上数据目录结构非常大, 查询数据目录效率很低; 另一方 面, 由于主从服务器信息都需要提前配置好, 整个主从緩存系统在运行时, 系统更新和扩容极不方便。 发明内容
有鉴于此, 本发明提供了一种緩存服务器系统及其应用方法、 緩存客 户端、 緩存服务端, 以解决现有分布式緩存系统在运行时, 更新扩容极不 方便, 以及数据量大时主服务器效率低下的问题。
为解决上述问题, 本发明提供了一种緩存服务器系统, 包括一个或多 个緩存客户端、 一个或多个緩存服务端以及一内存数据库服务器, 其中, 緩存客户端, 用于从内存数据库服务器中获取所有緩存服务端信息, 与緩存服务端建立连接, 生成并定时维护链路链表;
内存数据库服务器, 用于建立并保存緩存服务端信息表以及数据存储 类别与緩存服务端对应目录表, 以及在收到所述緩存服务端上报的緩存服 务端信息后, 若数据库中含有该緩存服务端信息, 则更新对应的磁盘空间 数据, 否则将该緩存服务端信息插入数据库;
緩存服务端, 用于向内存数据库服务器上报所述緩存服务端信息, 并 完成緩存数据块的管理。
上述的系统, 其中, 所述緩存服务端信息包括: 本端的 ip地址、 緩存 服务端口、 当前可用磁盘空间。
上述的系统, 其中, 所述从内存数据库服务器中获取所有緩存服务端 信息, 与緩存服务端建立连接, 生成链路链表具体为:
所述緩存客户端在启动后, 定时向内存数据库服务器查询所有緩存服 务端信息, 根据所述緩存数据库服务器返回的所有緩存服务端信息, 在緩 存客户端建立链路链表, 其中存储各緩存服务端的信息, 緩存客户端与緩 存服务端建立连接, 并将连接状态存入链路链表;
其中, 緩存客户端链路链表的作用在于, 当有数据请求时, 緩存客户 端将所述数据请求的数据分类后, 向数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给緩存客户端时, 緩存客户端需要根据该链路 链表, 核查该緩存服务端信息, 符合要求才将请求转发至緩存服务端, 否 则返回错误响应。
上述的系统, 其中, 所述定时维护链路链表具体为:
緩存客户端定时从数据库获取所有緩存服务端信息, 将新增的緩存服 务端信息加入链路链表; 以及
緩存客户端使用心跳消息定时检测与各緩存服务端链路的状态, 并将 链路连接情况更新写入链路链表, 定时更新链路链表, 所述链路链表用于 緩存客户端处理请求时的链路核查。
优选地, 所述緩存客户端, 还用于在收到应用程序的插入请求处理后, 判定数据请求类别, 然后向内存数据库查询数据类别与緩存服务端存储对 应目录表; 以及用于根据所述链路链表核查数据库返回的緩存服务端信息 是否有效, 若有效则立即转发插入请求; 若无效则在当前链路链表中找到 有效的链路, 进行插入请求转发; 以及用于处理转发应用程序插入请求后, 将对应的数据类别和存储緩存服务端信息发送至数据库, 进行更新;
所述内存数据库服务器, 用于判断所述数据库中是否存在对应的緩存 服务端信息, 若数据库中不存在对应的緩存服务端信息, 则查找磁盘可用 空间最大的緩存服务端信息, 返回给緩存客户端; 若数据库中存在对应的 緩存服务端信息, 则将所述对应的緩存服务端信息返回緩存客户端;
所述緩存服务端, 用于接收插入请求后, 将数据块插入到内存中, 并 将所述数据块写入文件存入磁盘; 具体方式为, 在内存中建立数据块 hash 链表, 将插入的数据块存放在内存数据块链表中, 以数据块请求链接为 key 值, 同时将数据块写入文件存放在磁盘。
上述的系统, 其中, 所述緩存服务端, 还用于管理内存数据块链表, 具体方式为使用最近最少使用 (LRU ) 算法, 将新插入或者新访问的数据 块放在链表头部, 整个链表按照访问时间先后顺序排列。
优选地, 所述将数据块写入文件存入磁盘具体为:
緩存服务端对数据请求类别进行加密, 获得 32位密文类别码, 再按照 所述密文类别码组合成存储路径, 将所述数据块写为二进制文件存放在所 述存储路径下。
上述的系统, 其中, 所述 32位密文类别码组合成存储路径具体为: 32位密文密码是由罗马数字和小写英文数字组合而成, 32位密码的前 两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第三层子目录 以该 32位密码为名, 第四层则为数据块写入的二进制文件;
优选地, 所述緩存客户端, 用于接收应用程序的查询请求后, 判定数 据请求类别, 向内存数据库查询数据类别与緩存服务端存储对应目录表, 查找到后根据数据库返回的緩存服务端信息, 在链路链表中核查该緩存服 务端当前的状态, 若可用将所述查询请求转发到所述緩存服务端, 等待緩 存服务端数据块定位查找后, 将结果返回; 否则返回失败响应;
緩存服务端, 用于根据所述查询请求从緩存服务端内存中进行数据块 的定位获取。
上述的系统, 其中, 所述根据所述查询请求从緩存服务端内存中进行 数据块的定位获取具体为:
所述緩存服务端根据查询请求的 key值, 查找 hash表, 找到后将对应 数据块链表更新, 并将数据返回緩存客户端, 若未在内存中找到, 则根据 所述数据块文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
本发明还提供了一种緩存客户端, 所述緩存客户端用于从内存数据库 服务器中获取所有緩存服务端信息, 与緩存服务端建立连接, 生成并定时 维护链路链表。
本发明还提供了一种緩存服务端, 所述緩存服务端, 用于向内存数据 库服务器上报所述緩存服务端信息, 并完成緩存数据块的管理。
本发明还提供了一种分布式緩存服务器系统的应用方法, 包括, 緩存服务端向内存数据库服务器上报緩存服务端信息;
内存数据库服务器建立并保存緩存服务端信息表以及数据存储类别与 緩存服务端对应目录表, 以及在收到所述緩存服务端上报的緩存服务端信 息后, 若数据库中含有该緩存服务端信息, 则更新对应的磁盘空间数据, 否则将该緩存服务端信息插入数据库;
緩存客户端从内存数据库服务器中获取所有緩存服务端信息, 与緩存 服务端建立连接, 生成并定时维护链路链表。
上述的方法, 其中, 所述緩存服务端信息包括本端的 ip地址、 緩存服 务端口和当前可用磁盘空间。
上述的方法, 其中, 所述緩存客户端从内存数据库服务器中获取所有 緩存服务端信息, 与緩存服务端建立连接, 生成链路链表具体为:
所述緩存客户端在启动后, 定时向内存数据库服务器查询所有緩存服 务端信息, 根据所述緩存数据库服务器返回的所有緩存服务端信息, 在緩 存客户端建立链路链表, 其中存储各緩存服务端的信息, 緩存客户端与緩 存服务端建立连接, 并将连接状态存入链路链表;
其中, 緩存客户端链路链表的作用在于, 当有数据请求时, 緩存客户 端将所述数据请求的数据分类后, 向数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给緩存客户端时, 緩存客户端需要根据该链路 链表, 核查该緩存服务端信息, 符合要求才将请求转发至緩存服务端, 否 则返回错误响应。
上述的方法, 其中, 所述緩存客户端定时维护链路链表具体为: 緩存客户端定时从数据库获取所有緩存服务端信息, 将新增的緩存服 务端信息加入链路链表; 以及
緩存客户端使用心跳消息定时检测与各緩存服务端链路的状态, 并将 链路连接情况更新写入链路链表, 定时更新链路链表, 所述链路链表用于 緩存客户端处理请求时的链路核查。
上述的方法, 其中, 所述方法还包括:
所述緩存客户端在收到应用程序的插入请求处理后, 判定数据请求类 别, 然后向内存数据库查询数据类别与緩存服务端存储对应目录表; 所述内存数据库服务器判断所述数据库中是否存在对应的緩存服务端 信息, 若数据库中不存在对应的緩存服务端信息, 则查找磁盘可用空间最 大的緩存服务端信息, 返回给緩存客户端; 若数据库中存在对应的緩存服 务端信息, 则将所述对应的緩存服务端信息返回緩存客户端;
所述緩存客户端根据所述链路链表核查数据库返回的緩存服务端信息 是否有效, 若有效则立即转发插入请求; 若无效则在当前链路链表中找到 有效的链路, 进行插入请求转发; 以及处理转发应用程序插入请求后, 将 对应的数据类别和存储緩存服务端信息发送至数据库, 进行更新;
所述緩存服务端接收插入请求后, 将数据块插入到内存中, 并将所述 数据块写入文件存入磁盘; 具体方式为, 在内存中建立数据块 hash链表, 将插入的数据块存放在内存数据块链表中, 以数据块请求链接为 key值, 同时将数据块写入文件存放在磁盘。
上述的方法, 其中, 所述緩存服务端将数据块写入文件存入磁盘具体 为:
緩存服务端对数据请求类别进行加密, 获得 32位密文类别码, 再按照 所述密文类别码组合成存储路径, 将所述数据块写为二进制文件存放在所 述存储路径下。
上述的方法, 其中, 所述 32位密文类别码组合成存储路径具体为: 32位密文密码是由罗马数字和小写英文数字组合而成, 32位密码的前 两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第三层子目录 以该 32位密码为名, 第四层则为数据块写入的二进制文件;
上述的方法, 其中, 所述方法还包括:
所述緩存客户端接收应用程序的查询请求后, 判定数据请求类别, 向 内存数据库查询数据类别与緩存服务端存储对应目录表, 查找到后根据数 据库返回的緩存服务端信息, 在链路链表中核查该緩存服务端当前的状态, 若可用将所述查询请求转发到所述緩存服务端, 等待緩存服务端数据块定 位查找后, 将结果返回; 否则返回失败响应;
緩存服务端根据所述查询请求从緩存服务端内存中进行数据块的定位 获取。
上述的方法, 其中, 所述緩存服务端根据所述查询请求从緩存服务端 内存中进行数据块的定位获取具体为:
所述緩存服务端根据查询请求的 key值, 查找 hash表, 找到后将对应 数据块链表更新, 并将数据返回緩存客户端, 若未在内存中找到, 则根据 所述数据块文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
釆用本发明的技术方案, 可以使緩存服务器系统的设置和使用更加简 洁方便, 访问速度更快, 系统可以自动扩展, 以及自动进行更新;
釆用本发明的优选方案, 客户端处理应用程序的插入、 查询数据请求, 只需要进行一次数据库操作, 插入完毕再进行一次数据库更新, 可以有效 减少数据库访问压力, 提高系统访问速度;
釆用本发明的优选方案, 通过上述构建存储路径以及文件名的方法, 目录结构清晰, 緩存服务端可以直接命中各个数据块以及各个数据块文件, 数据访问快速而简便。 附图说明
图 1是本发明实施例系统结构图;
图 2是緩存服务端将数据块写入文件存入磁盘的命名方式图; 图 3是本发明方法实施例流程图;
图 4是本发明方法实施例的数据插入流程图;
图 5是本发明方法实施例的数据查询流程图。 具体实施方式
为了使本发明所要解决的技术问题、 技术方案及有益效果更加清楚、 明白, 以下结合附图和实施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用于限定本发明。
如图 1 所示, 是本发明实施例系统结构图, 提供一种分布式緩存服务 器系统, 包括一个或多个緩存客户端、 一个或多个緩存服务端以及一内存 数据库服务器, 其中,
緩存客户端, 用于从内存数据库服务器中获取緩存服务端信息, 生成 并定时维护链路链表;
具体地, 緩存客户端属于需要使用緩存服务器系统的应用程序侧, 使 用传输控制协议 /因特网互联协议 ( TCP/IP , Transmission Control Protocol/Internet Protocol )与内网网络连接; 緩存客户端启动时从内存数据 库服务器中获取所有緩存服务端信息后, 主动与緩存服务端建立连接, 之 后定时从数据库获取緩存服务端信息, 维持与緩存服务端的链路;
内存数据库服务器, 用于建立并保存緩存服务端信息表(包括: 緩存 服务端 ip地址、 緩存服务端口、 磁盘可用空间等信息) 以及数据存储类别 与緩存服务端对应目录表, 在收到所述緩存服务端上报的緩存服务端信息 后, 如果数据库中有, 则更新对应的磁盘空间数据, 否则将数据插入数据 库;
緩存服务端, 用于向内存数据库服务器上报本緩存服务端信息, 具体 是: 在启动后, 定时将本端的 ip地址、 緩存服务端口、 本地当前可用磁盘 空间等信息, 发送给内存数据库服务器。
上述系统中, 緩存客户端启动后, 用于进行自动连接和链路维护, 具 体包括:
緩存客户端用于在启动后, 定时向内存数据库发送消息, 查询所有緩 存服务端信息, 生成緩存客户端链路链表, 其中緩存客户端从数据库获取 緩存服务端信息, 并生成链路链表的方式是: 根据数据库返回的所有緩存 服务端信息, 在客户端建立链表, 其中存储各緩存服务端的信息, 緩存客 户端主动与緩存服务端建立连接, 并将连接状态存入链表; 緩存客户端链 路链表的作用在于, 当有数据请求到来, 客户端将请求的数据分类后, 向 数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给客户 端时, 客户端需要根据该链路链表, 核查该緩存服务端信息, 符合要求才 将请求转发至对端, 否则返回错误响应。
緩存客户端根据内存数据库服务器返回的信息, 主动向各个緩存服务 端发起建立连接请求; 将数据库返回的所有緩存服务端信息, 及链路建立 情况定时更新链路链表; 其中, 緩存客户端定时从数据库获取所有緩存服 务端信息, 将新增的緩存服务端信息加入链表,
緩存客户端定时备份当前的链路链表, 以备后续使用; 緩存客户端使 用心跳消息定时检测与各条緩存服务端链路的状态, 定时更新链路链表, 其中, 緩存客户端定时更新链路链表的方式为: 定时发送心跳消息, 检测 各个緩存服务端的链路连接情况, 并将链路连接情况更新写入链路链表, 用于客户端处理请求时的链路核查。
緩存客户端接收应用程序的插入请求进行处理, 具体包括,
緩存客户端, 用于判定数据请求类别, 然后向内存数据库查询数据类 别与緩存服务端存储对应目录表, 有以下两种情况: 情况一, 如数据库中 未找到, 则在数据库緩存服务端信息表中, 查找磁盘可用空间最大的緩存 服务端信息, 返回给緩存客户端; 情况二, 如数据库中找到, 则将找到的 緩存服务端信息返回给客户端, 而后客户端核查数据库返回的緩存服务端 是否有效, 若有效则立即转发请求; 若无效则在当前链路链表中找到有效 的链路, 进行请求转发, 处理转发应用程序插入请求后, 将对应的数据类 别和存储緩存服务端信息发送至数据库, 进行更新;
緩存服务端, 用于接受请求后, 将数据插入到内存中, 并将数据块按 照特定方式写入文件存入磁盘; 緩存服务端处理插入数据请求的方式为: 在内存中建立数据块哈希(hash )链表, 将插入的数据先存放在内存数据块 链表中, 以数据请求链接为 key值, 同时将数据写入文件存放在磁盘; 緩 存服务端管理内存数据块链表的方式为: 使用最近最少使用 (LRU, Least Recently Used )算法, 将新插入或者新访问的数据块放在链表头部, 整个链 表按照访问时间先后顺序排列。
如图 2所示, 是緩存服务端将数据块写入文件存入磁盘的命名方式图, 具体地,
緩存服务端将数据块写入磁盘的方式为: 对数据请求类别进行加密, 获得 32位密文类别码, 再按照此密文类别码组合成完整的存储路径, 将数 据块写为二进制文件存放在此路径下; 具体地,
緩存服务端根据数据类别, 使用加密后的 32位密文类别码组合绝对路 径, 其方式为: 32位密文密码是由罗马数字和小写英文数字组合而成, 32 位密码的前两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第 三层子目录以该 32位密码为名, 第四层则为数据块写入的二进制文件。
数据块文件命名方式为: 将数据请求链接进行加密, 获得 32位密文请 求链接码, 按照此 32位密码命名该文件。
緩存客户端与各緩存服务端建立连接后, 接受应用程序的查询请求进 行处理, 具体为,
緩存客户端, 用于判定数据请求类别, 然后向内存数据库查询数据类 别与緩存服务端存储对应目录表, 查找到后根据数据库返回的緩存服务端 信息, 在链路链表中核查该緩存服务端当前的状态, 若可用再将请求转发 到该緩存服务端, 等待緩存服务端数据定位查找后, 将结果返回; 若以上 有条件不满足, 则立即返回失败响应。
緩存服务端, 用于从緩存服务端内存中进行数据块的定位获取, 根据 查询请求的 key值, 直接查找 hash表, 找到后将对应数据库链表更新, 并 将数据返回客户端, 如未在内存中找到, 则根据上述文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
如图 3 所示, 是本发明方法实施例流程图, 提供了一种分布式緩存服 务器系统的应用方法, 包括:
步骤 S301 , 緩存服务端向内存数据库服务器上报緩存服务端信息; 步骤 S302, 内存数据库服务器建立并保存緩存服务端信息表以及数据 存储类别与緩存服务端对应目录表, 以及在收到所述緩存服务端上报的緩 存服务端信息后, 若数据库中含有该緩存服务端信息, 则更新对应的磁盘 空间数据, 否则将该緩存服务端信息插入数据库;
步骤 S303 , 緩存客户端从内存数据库服务器中获取所有緩存服务端信 息, 与緩存服务端建立连接, 生成并定时维护链路链表。
上述方法中, 所述緩存服务端信息包括本端的 ip地址、 緩存服务端口 和当前可用磁盘空间。
上述方法中, 緩存客户端从内存数据库服务器中获取所有緩存服务端 信息, 与緩存服务端建立连接, 生成链路链表具体为:
所述緩存客户端在启动后, 定时向内存数据库服务器查询所有緩存服 务端信息, 根据所述緩存数据库服务器返回的所有緩存服务端信息, 在緩 存客户端建立链路链表, 其中存储各緩存服务端的信息, 緩存客户端与緩 存服务端建立连接, 并将连接状态存入链路链表;
其中, 緩存客户端链路链表的作用在于, 当有数据请求时, 緩存客户 端将所述数据请求的数据分类后, 向数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给緩存客户端时, 緩存客户端需要根据该链路 链表, 核查该緩存服务端信息, 符合要求才将请求转发至緩存服务端, 否 则返回错误响应。
上述方法中, 緩存客户端定时维护链路链表具体为:
緩存客户端定时从数据库获取所有緩存服务端信息, 将新增的緩存服 务端信息加入链路链表; 以及
緩存客户端使用心跳消息定时检测与各緩存服务端链路的状态, 并将 链路连接情况更新写入链路链表, 定时更新链路链表, 所述链路链表用于 緩存客户端处理请求时的链路核查。
如图 4所示, 是本发明方法实施例的数据插入流程图, 包括: 步骤 S401 , 緩存客户端在收到应用程序的插入请求处理后, 判定数据 请求类别, 然后向内存数据库查询数据类别与緩存服务端存储对应目录表; 步骤 S402, 内存数据库服务器判断所述数据库中是否存在对应的緩存 服务端信息, 若数据库中不存在对应的緩存服务端信息, 则查找磁盘可用 空间最大的緩存服务端信息, 返回给緩存客户端; 若数据库中存在对应的 緩存服务端信息, 则将所述对应的緩存服务端信息返回緩存客户端;
步骤 S403 , 所述緩存客户端根据所述链路链表核查数据库返回的緩存 服务端信息是否有效, 若有效则立即转发插入请求; 若无效则在当前链路 链表中找到有效的链路, 进行插入请求转发; 以及处理转发应用程序插入 请求后, 将对应的数据类别和存储緩存服务端信息发送至数据库, 进行更 新;
步骤 S404, 緩存服务端接收插入请求后, 将数据块插入到内存中, 并 将所述数据块写入文件存入磁盘。 具体方式为: 在内存中建立数据块 hash 链表, 将插入的数据块存放在内存数据块链表中, 以数据块请求链接为 key 值, 同时将数据块写入文件存放在磁盘。
上述方法中, 緩存服务端将数据块写入文件存入磁盘具体为: 緩存服务端对数据请求类别进行加密, 获得 32位密文类别码, 再按照 所述密文类别码组合成存储路径, 将所述数据块写为二进制文件存放在所 述存储路径下。
上述方法中, 所述 32位密文类别码组合成存储路径具体为:
32位密文密码是由罗马数字和小写英文数字组合而成, 32位密码的前 两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第三层子目录 以该 32位密码为名, 第四层则为数据块写入的二进制文件;
如图 5所示, 是本发明方法实施例的数据查询流程图, 包括: 步骤 S501 , 緩存客户端接收应用程序的查询请求后, 判定数据请求类 别, 向内存数据库查询数据类别与緩存服务端存储对应目录表, 查找到后 根据数据库返回的緩存服务端信息, 在链路链表中核查该緩存服务端当前 的状态, 若可用将所述查询请求转发到所述緩存服务端, 等待緩存服务端 数据块定位查找后, 将结果返回; 否则返回失败响应;
步骤 S502 , 緩存服务端根据所述查询请求从緩存服务端内存中进行数 据块的定位获取。
上述方法中, 所述緩存服务端根据所述查询请求从緩存服务端内存中 进行数据块的定位获取具体为:
所述緩存服务端根据查询请求的 key值, 查找 hash表, 找到后将对应 数据块链表更新, 并将数据返回緩存客户端, 若未在内存中找到, 则根据 所述数据块文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
上述说明示出并描述了本发明的一个优选实施例, 但如前所述, 应当 理解本发明并非局限于本文所披露的形式, 不应看作是对其他实施例的排 除, 而可用于各种其他组合、 修改和环境, 并能够在本文所述发明构想范 围内, 通过上述教导或相关领域的技术或知识进行改动。 而本领域人员所 进行的改动和变化不脱离本发明的精神和范围, 则都应在本发明所附权利 要求的保护范围内。

Claims

权利要求书
1、 一种緩存服务器系统, 其特征在于, 包括一个或多个緩存客户端、 一个或多个緩存服务端以及一内存数据库服务器, 其中,
緩存客户端, 用于从内存数据库服务器中获取所有緩存服务端信息, 与緩存服务端建立连接, 生成并定时维护链路链表;
内存数据库服务器, 用于建立并保存緩存服务端信息表以及数据存储 类别与緩存服务端对应目录表, 以及在收到所述緩存服务端上报的緩存服 务端信息后, 若数据库中含有该緩存服务端信息, 则更新对应的磁盘空间 数据, 否则将该緩存服务端信息插入数据库;
緩存服务端, 用于向内存数据库服务器上报所述緩存服务端信息, 并 完成緩存数据块的管理。
2、 根据权利要求 1所述的系统, 其特征在于, 所述緩存服务端信息包 括本端的 ip地址、 緩存服务端口和当前可用磁盘空间。
3、 根据权利要求 1或 2所述的系统, 其特征在于, 所述从内存数据库 服务器中获取所有緩存服务端信息, 与緩存服务端建立连接, 生成链路链 表具体为:
所述緩存客户端在启动后, 定时向内存数据库服务器查询所有緩存服 务端信息, 根据所述緩存数据库服务器返回的所有緩存服务端信息, 在緩 存客户端建立链路链表, 其中存储各緩存服务端的信息, 緩存客户端与緩 存服务端建立连接, 并将连接状态存入链路链表;
其中, 緩存客户端链路链表的作用在于, 当有数据请求时, 緩存客户 端将所述数据请求的数据分类后, 向数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给緩存客户端时, 緩存客户端需要根据该链路 链表, 核查该緩存服务端信息, 符合要求才将请求转发至緩存服务端, 否 则返回错误响应。
4、 根据权利要求 3所述的系统, 其特征在于, 所述定时维护链路链表 具体为:
緩存客户端定时从数据库获取所有緩存服务端信息, 将新增的緩存服 务端信息加入链路链表; 以及
緩存客户端使用心跳消息定时检测与各緩存服务端链路的状态, 并将 链路连接情况更新写入链路链表, 定时更新链路链表, 所述链路链表用于 緩存客户端处理请求时的链路核查。
5、 根据权利要求 1或 2所述的系统, 其特征在于,
所述緩存客户端, 还用于在收到应用程序的插入请求处理后, 判定数 据请求类别, 然后向内存数据库查询数据类别与緩存服务端存储对应目录 表; 以及用于根据所述链路链表核查数据库返回的緩存服务端信息是否有 效, 若有效则立即转发插入请求; 若无效则在当前链路链表中找到有效的 链路, 进行插入请求转发; 以及用于处理转发应用程序插入请求后, 将对 应的数据类别和存储緩存服务端信息发送至数据库, 进行更新;
所述内存数据库服务器, 用于判断所述数据库中是否存在对应的緩存 服务端信息, 若数据库中不存在对应的緩存服务端信息, 则查找磁盘可用 空间最大的緩存服务端信息, 返回给緩存客户端; 若数据库中存在对应的 緩存服务端信息, 则将所述对应的緩存服务端信息返回緩存客户端;
所述緩存服务端, 用于接收插入请求后, 将数据块插入到内存中, 并 将所述数据块写入文件存入磁盘; 具体方式为, 在内存中建立数据块哈希 ( hash )链表, 将插入的数据块存放在内存数据块链表中, 以数据块请求链 接为 key值, 同时将数据块写入文件存放在磁盘。
6、 根据权利要求 5所述的系统, 其特征在于,
所述緩存服务端, 还用于管理内存数据块链表, 具体方式为使用最近 最少使用 (LRU ) 算法, 将新插入或者新访问的数据块放在链表头部, 整 个链表按照访问时间先后顺序排列。
7、 根据权利要求 5所述的系统, 其特征在于, 所述将数据块写入文件 存入磁盘具体为:
緩存服务端对数据请求类别进行加密, 获得 32位密文类别码, 按照所 述密文类别码组合成存储路径, 将所述数据块写为二进制文件存放在所述 存储路径下。
8、 根据权利要求 7所述的系统, 其特征在于, 所述 32位密文类别码 组合成存储路径具体为:
32位密文密码是由罗马数字和小写英文数字组合而成, 32位密码的前 两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第三层子目录 以该 32位密码为名, 第四层则为数据块写入的二进制文件。
9、 根据权利要求 1或 2所述的系统, 其特征在于,
所述緩存客户端, 用于接收应用程序的查询请求后, 判定数据请求类 别, 向内存数据库查询数据类别与緩存服务端存储对应目录表, 查找到后 根据数据库返回的緩存服务端信息, 在链路链表中核查该緩存服务端当前 的状态, 若可用将所述查询请求转发到所述緩存服务端, 等待緩存服务端 数据块定位查找后, 将结果返回; 否则返回失败响应;
緩存服务端, 用于根据所述查询请求从緩存服务端内存中进行数据块 的定位获取。
10、 根据权利要求 9所述的系统, 其特征在于, 所述根据所述查询请 求从緩存服务端内存中进行数据块的定位获取具体为:
所述緩存服务端根据查询请求的 key值, 查找 hash表, 找到后将对应 数据块链表更新, 并将数据返回緩存客户端, 若未在内存中找到, 则根据 所述数据块文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
11、 一种緩存客户端, 其特征在于,
所述緩存客户端用于从内存数据库服务器中获取所有緩存服务端信 息, 与緩存服务端建立连接, 生成并定时维护链路链表。
12、 一种緩存服务端, 其特征在于,
所述緩存服务端, 用于向内存数据库服务器上报所述緩存服务端信息 , 并完成緩存数据块的管理。
13、 一种分布式緩存服务器系统的应用方法, 其特征在于, 包括, 緩存服务端向内存数据库服务器上报緩存服务端信息;
内存数据库服务器建立并保存緩存服务端信息表以及数据存储类别与 緩存服务端对应目录表, 以及在收到所述緩存服务端上报的緩存服务端信 息后, 若数据库中含有该緩存服务端信息, 则更新对应的磁盘空间数据, 否则将该緩存服务端信息插入数据库;
緩存客户端从内存数据库服务器中获取所有緩存服务端信息, 与緩存 服务端建立连接, 生成并定时维护链路链表。
14、 根据权利要求 13所述的方法, 其特征在于, 所述緩存服务端信息 包括本端的 ip地址、 緩存服务端口和当前可用磁盘空间。
15、 根据权利要求 13或 14所述的方法, 其特征在于, 所述緩存客户 端从内存数据库服务器中获取所有緩存服务端信息, 与緩存服务端建立连 接, 生成链路链表具体为:
所述緩存客户端在启动后, 定时向内存数据库服务器查询所有緩存服 务端信息, 根据所述緩存数据库服务器返回的所有緩存服务端信息, 在緩 存客户端建立链路链表, 其中存储各緩存服务端的信息, 緩存客户端与緩 存服务端建立连接, 并将连接状态存入链路链表;
其中, 緩存客户端链路链表的作用在于, 当有数据请求时, 緩存客户 端将所述数据请求的数据分类后, 向数据库查询该类别存放的緩存服务端, 数据库返回緩存服务端信息给緩存客户端时, 緩存客户端需要根据该链路 链表, 核查该緩存服务端信息, 符合要求才将请求转发至緩存服务端, 否 则返回错误响应。
16、 根据权利要求 15所述的方法, 其特征在于, 所述緩存客户端定时 维护链路链表具体为:
緩存客户端定时从数据库获取所有緩存服务端信息, 将新增的緩存服 务端信息加入链路链表; 以及
緩存客户端使用心跳消息定时检测与各緩存服务端链路的状态, 并将 链路连接情况更新写入链路链表, 定时更新链路链表, 所述链路链表用于 緩存客户端处理请求时的链路核查。
17、 根据权利要求 13或 14所述的方法, 其特征在于, 所述方法还包 括:
所述緩存客户端在收到应用程序的插入请求处理后, 判定数据请求类 别, 然后向内存数据库查询数据类别与緩存服务端存储对应目录表;
所述内存数据库服务器判断所述数据库中是否存在对应的緩存服务端 信息, 若数据库中不存在对应的緩存服务端信息, 则查找磁盘可用空间最 大的緩存服务端信息, 返回给緩存客户端; 若数据库中存在对应的緩存服 务端信息, 则将所述对应的緩存服务端信息返回緩存客户端;
所述緩存客户端根据所述链路链表核查数据库返回的緩存服务端信息 是否有效, 若有效则立即转发插入请求; 若无效则在当前链路链表中找到 有效的链路, 进行插入请求转发; 以及用于处理转发应用程序插入请求后, 将对应的数据类别和存储緩存服务端信息发送至数据库, 进行更新;
所述緩存服务端接收插入请求后, 将数据块插入到内存中, 并将所述 数据块写入文件存入磁盘; 具体方式为, 在内存中建立数据块 hash链表, 将插入的数据块存放在内存数据块链表中, 以数据块请求链接为 key值, 同时将数据块写入文件存放在磁盘。
18、 根据权利要求 17所述的方法, 其特征在于, 所述緩存服务端将数 据块写入文件存入磁盘具体为:
緩存服务端对数据请求类别进行加密, 获得 32位密文类别码, 再按照 所述密文类别码组合成存储路径, 将所述数据块写为二进制文件存放在所 述存储路径下。
19、 根据权利要求 18所述的方法, 其特征在于, 所述 32位密文类别 码组合成存储路径具体为:
32位密文密码是由罗马数字和小写英文数字组合而成, 32位密码的前 两位为第一层目录名, 密码的第 3、 4位为第二层子目录名, 第三层子目录 以该 32位密码为名, 第四层则为数据块写入的二进制文件。
20、 根据权利要求 13或 14所述的方法, 其特征在于, 所述方法还包 括: 所述緩存客户端接收应用程序的查询请求后, 判定数据请求类别, 向 内存数据库查询数据类别与緩存服务端存储对应目录表, 查找到后根据数 据库返回的緩存服务端信息, 在链路链表中核查该緩存服务端当前的状态, 若可用将所述查询请求转发到所述緩存服务端, 等待緩存服务端数据块定 位查找后, 将结果返回; 否则返回失败响应;
緩存服务端根据所述查询请求从緩存服务端内存中进行数据块的定位 获取。
21、 根据权利要求 20所述的方法, 其特征在于, 所述緩存服务端根据 所述查询请求从緩存服务端内存中进行数据块的定位获取具体为:
所述緩存服务端根据查询请求的 key值, 查找 hash表, 找到后将对应 数据块链表更新, 并将数据返回緩存客户端, 若未在内存中找到, 则根据 所述数据块文件命名和存储方式, 直接定位到该数据块, 有则返回数据, 无则返回失败响应。
PCT/CN2011/075964 2011-04-14 2011-06-20 缓存服务器系统及其应用方法、缓存客户端、缓存服务端 WO2012139328A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110093902.0 2011-04-14
CN201110093902.0A CN102739720B (zh) 2011-04-14 2011-04-14 分布式缓存服务器系统及其应用方法、缓存客户端

Publications (1)

Publication Number Publication Date
WO2012139328A1 true WO2012139328A1 (zh) 2012-10-18

Family

ID=46994499

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/075964 WO2012139328A1 (zh) 2011-04-14 2011-06-20 缓存服务器系统及其应用方法、缓存客户端、缓存服务端

Country Status (2)

Country Link
CN (1) CN102739720B (zh)
WO (1) WO2012139328A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9876873B1 (en) 2015-10-21 2018-01-23 Perfect Sense, Inc. Caching techniques
CN110232044A (zh) * 2019-06-17 2019-09-13 山东浪潮通软信息科技有限公司 一种大数据汇总调度服务的实现系统及方法
CN110825986A (zh) * 2019-11-05 2020-02-21 上海携程商务有限公司 客户端请求数据的方法、系统、存储介质和电子设备
CN112383415A (zh) * 2020-10-30 2021-02-19 上海蜜度信息技术有限公司 服务端标示方法及设备
CN115633005A (zh) * 2022-10-26 2023-01-20 云度新能源汽车有限公司 一种实时高并发连接处理方法及其处理系统

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853727B (zh) * 2012-11-29 2018-07-31 深圳中兴力维技术有限公司 提高大数据量查询性能的方法及系统
CN103118099B (zh) * 2013-01-25 2016-03-02 福建升腾资讯有限公司 基于散列算法的图形图像缓存方法
CN104461929B (zh) * 2013-09-23 2018-03-23 中国银联股份有限公司 基于拦截器的分布式数据缓存方法
CN105426371A (zh) * 2014-09-17 2016-03-23 上海三明泰格信息技术有限公司 数据库系统
CN106649408B (zh) * 2015-11-04 2020-10-13 中国移动通信集团重庆有限公司 一种大数据检索方法和装置
CN107038174B (zh) * 2016-02-04 2020-11-24 北京京东尚科信息技术有限公司 用于数据系统的数据同步方法和装置
CN106331147B (zh) * 2016-09-09 2019-09-06 深圳市彬讯科技有限公司 一种redis分布式调用方法
CN106506613B (zh) * 2016-10-31 2018-04-13 大唐高鸿信安(浙江)信息科技有限公司 分布式key‑value存储系统的数据存储位置加密方法
CN106934001A (zh) * 2017-03-03 2017-07-07 广州天源迪科信息技术有限公司 分布式快速清单查询系统及方法
CN107087232B (zh) * 2017-04-07 2020-03-27 优地网络有限公司 用户的实时状态检测方法及系统
CN107133183B (zh) * 2017-04-11 2020-06-30 深圳市联云港科技有限公司 一种基于tcmu虚拟块设备的缓存数据访问方法及系统
CN107071059B (zh) * 2017-05-25 2018-10-02 腾讯科技(深圳)有限公司 分布式缓存服务实现方法、装置、终端、服务器及系统
CN107797859B (zh) * 2017-11-16 2021-08-20 山东浪潮云服务信息科技有限公司 一种定时任务的调度方法及一种调度服务器
CN108009250B (zh) * 2017-12-01 2021-09-07 武汉斗鱼网络科技有限公司 一种多分类赛事数据缓存建立、查询方法及装置
CN110022257B (zh) * 2018-01-08 2023-04-07 北京京东尚科信息技术有限公司 分布式消息系统
CN110298677B (zh) * 2018-03-22 2021-08-13 中移(苏州)软件技术有限公司 一种云计算资源计费的方法、装置、电子设备和存储介质
CN109086380B (zh) * 2018-07-25 2022-09-16 光大环境科技(中国)有限公司 对历史数据进行压缩存储的方法及系统
CN110535977B (zh) * 2019-09-29 2022-04-01 深圳市网心科技有限公司 文件分发方法及装置、计算机装置及存储介质
CN111858664B (zh) * 2020-06-23 2023-01-10 苏州浪潮智能科技有限公司 一种基于bmc的数据持久化方法及系统
CN114938393B (zh) * 2022-05-06 2024-04-19 中富通集团股份有限公司 一种机房数据交互方法及系统和存储介质
CN116360711B (zh) * 2023-06-02 2023-08-11 杭州沃趣科技股份有限公司 一种分布式存储处理方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308513A (zh) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 分布式系统中缓存数据的同步配置方法与装置
CN101493826A (zh) * 2008-12-23 2009-07-29 中兴通讯股份有限公司 基于web应用的数据库系统及其数据管理方法
CN101562543A (zh) * 2009-05-25 2009-10-21 阿里巴巴集团控股有限公司 一种缓存数据的处理方法、处理系统和装置
CN102006330A (zh) * 2010-12-01 2011-04-06 北京瑞信在线系统技术有限公司 分布式缓存系统、数据的缓存方法及缓存数据的查询方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308513A (zh) * 2008-06-27 2008-11-19 福建星网锐捷网络有限公司 分布式系统中缓存数据的同步配置方法与装置
CN101493826A (zh) * 2008-12-23 2009-07-29 中兴通讯股份有限公司 基于web应用的数据库系统及其数据管理方法
CN101562543A (zh) * 2009-05-25 2009-10-21 阿里巴巴集团控股有限公司 一种缓存数据的处理方法、处理系统和装置
CN102006330A (zh) * 2010-12-01 2011-04-06 北京瑞信在线系统技术有限公司 分布式缓存系统、数据的缓存方法及缓存数据的查询方法

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9876873B1 (en) 2015-10-21 2018-01-23 Perfect Sense, Inc. Caching techniques
CN110232044A (zh) * 2019-06-17 2019-09-13 山东浪潮通软信息科技有限公司 一种大数据汇总调度服务的实现系统及方法
CN110232044B (zh) * 2019-06-17 2023-03-28 浪潮通用软件有限公司 一种大数据汇总调度服务的实现系统及方法
CN110825986A (zh) * 2019-11-05 2020-02-21 上海携程商务有限公司 客户端请求数据的方法、系统、存储介质和电子设备
CN110825986B (zh) * 2019-11-05 2023-03-21 上海携程商务有限公司 客户端请求数据的方法、系统、存储介质和电子设备
CN112383415A (zh) * 2020-10-30 2021-02-19 上海蜜度信息技术有限公司 服务端标示方法及设备
CN115633005A (zh) * 2022-10-26 2023-01-20 云度新能源汽车有限公司 一种实时高并发连接处理方法及其处理系统

Also Published As

Publication number Publication date
CN102739720B (zh) 2015-01-28
CN102739720A (zh) 2012-10-17

Similar Documents

Publication Publication Date Title
WO2012139328A1 (zh) 缓存服务器系统及其应用方法、缓存客户端、缓存服务端
CN102117309B (zh) 一种数据缓存系统和数据查询方法
AU2005312895B2 (en) Bidirectional data transfer optimization and content control for networks
US9405781B2 (en) Virtual multi-cluster clouds
US7440977B2 (en) Recovery method using extendible hashing-based cluster logs in shared-nothing spatial database cluster
US7734820B1 (en) Adaptive caching for a distributed file sharing system
US9304966B2 (en) Providing local access to managed content
US7653668B1 (en) Fault tolerant multi-stage data replication with relaxed coherency guarantees
US7831735B1 (en) Coherency of replicas for a distributed file sharing system
US20030126199A1 (en) Peer-to-peer namespace directory and discovery
CN111274310A (zh) 一种分布式数据缓存方法及系统
JP2002335269A (ja) ピアツーピア名前解決プロトコル(pnrp)およびそれと共に使用するためのマルチレベルキャッシュ
US9367261B2 (en) Computer system, data management method and data management program
TW200835265A (en) Address resolution request mirroring
US9367560B1 (en) Method, system and apparatus for synchronizing changes in a directory service
WO2011150830A1 (zh) 获取内容的方法、节点及内容网络
JPH10301880A (ja) スケーラブルネットワークオブジェクトキャッシュ
WO2015090243A1 (zh) Ip管理方法、客户端以及服务器
WO2013091167A1 (zh) 日志存储方法及系统
WO2013010432A1 (zh) 一种对等网络中数据存储和查询的方法、节点及系统
WO2010025653A1 (zh) 搜索信息的方法、系统、装置及垂直搜索引擎注册的方法
WO2009143738A1 (zh) 一种分布式网络的管理方法、内容查询方法、系统及装置
US7433928B1 (en) System pre-allocating data object replicas for a distributed file sharing system
WO2013091343A1 (zh) 一种内容获取方法、装置及网络系统
Yu et al. Granary: A sharing oriented distributed storage system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11863349

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11863349

Country of ref document: EP

Kind code of ref document: A1