CN112463379A - Management method and system of virtual cache server, electronic equipment and storage medium - Google Patents

Management method and system of virtual cache server, electronic equipment and storage medium Download PDF

Info

Publication number
CN112463379A
CN112463379A CN202011357481.3A CN202011357481A CN112463379A CN 112463379 A CN112463379 A CN 112463379A CN 202011357481 A CN202011357481 A CN 202011357481A CN 112463379 A CN112463379 A CN 112463379A
Authority
CN
China
Prior art keywords
server
hash
virtual cache
data
cache server
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
CN202011357481.3A
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.)
Beijing Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology 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 Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN202011357481.3A priority Critical patent/CN112463379A/en
Publication of CN112463379A publication Critical patent/CN112463379A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (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 application discloses a management method of a virtual cache server, which comprises the steps of receiving a server extension instruction, virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers; selecting a server hash value bound with each extended virtual cache server; calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached; determining a hash value of a target server closest to the hash value of the data according to the hash binding information, and setting a virtual cache server corresponding to the hash value of the target server as a target virtual cache server; and storing the data to be cached by utilizing the target virtual cache server. The method and the device can reduce the influence of the expansion server on the cache hit rate of the original server. The application also discloses a management system of the virtual cache server, an electronic device and a storage medium, and the management system, the electronic device and the storage medium have the beneficial effects.

Description

Management method and system of virtual cache server, electronic equipment and storage medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a method and a system for managing a virtual cache server, an electronic device, and a storage medium.
Background
When a large number of users access a certain website at the same time, the web page may have prompt information that the website service is unavailable or the web page service is busy, which is a manifestation of poor website expansion capability. The large front end is called "large", which can be understood as a large number of users and a large number of accesses at the user level, and can be understood as a complex function and a large number of products at the functional level. It can be understood at a technical level that the operation of a web site requires a large number of servers.
In the development process of the website, the most important means is to adopt a server cluster, and the processing capacity of the cluster is enhanced by continuously adding servers into the cluster, which is an expansion strategy of the website. Two common extension strategies are available at present, wherein functions are separately deployed and the same function is deployed on a plurality of servers to provide services. The existing server cluster expansion mode is to expand the cache server cluster when the website access amount is small, and then gradually preheat the cache by a request simulation method, so that the data in the cache server is redistributed. However, the server expansion scheme has requirements on service scenarios, and cannot reduce the influence of the expansion server operation on the cache hit rate.
Therefore, how to reduce the influence of the extended server on the cache hit rate of the original server is a technical problem that needs to be solved by those skilled in the art at present.
Disclosure of Invention
The application aims to provide a management method and a management system of a virtual cache server, an electronic device and a storage medium, which can reduce the influence of an extended server on the cache hit rate of an original server.
In order to solve the above technical problem, the present application provides a management method for a virtual cache server, where the management method for the virtual cache server includes:
receiving a server extension instruction, and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers;
selecting a server hash value bound with each extended virtual cache server in a consistent hash ring so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one;
if a data caching instruction is received, calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached;
determining a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information, and setting an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
and storing the data to be cached by utilizing the target virtual cache server.
Optionally, after setting the extended virtual cache server or the initial virtual cache server corresponding to the hash value of the target server as the target virtual cache server, the method further includes:
recording the mapping relation between the key value and the hash value of the target server, taking the mapping relation and the data to be cached as training samples, and inputting the training samples into an ant colony algorithm to obtain a mapping relation table so as to use the mapping relation table to query a virtual cache server for storing data; the mapping relation table comprises the mapping relation between the key value of the data to be cached and the virtual cache server.
Optionally, after the training samples are input into the ant colony algorithm to obtain the mapping relationship table, the method further includes:
and if a new data caching instruction is received, inquiring a virtual caching server corresponding to the key value of the new data to be cached according to the mapping relation table, and storing the new data to be cached by using the virtual caching server corresponding to the key value of the new data to be cached.
Optionally, before receiving the server extension instruction, the method further includes:
determining an initial physical cache server, and virtualizing the initial physical cache server into M initial virtual cache servers;
constructing the consistency hash ring through a binary search tree, and selecting M hash values in the consistency hash ring as server hash values;
and establishing a binding relationship between each initial virtual cache server and the hash value of the server, and generating the hash binding information.
Optionally, after generating the hash binding information, the method further includes:
and determining the mapping relation between the key value of the data to be cached and the initial virtual cache server based on the ant colony algorithm, and executing data storage operation by using the mapping relation between the key value of the data to be cached and the initial virtual cache server.
Optionally, selecting M hash values in the consistent hash ring as server hash values includes:
selecting M hash values in the consistent hash ring as server hash values according to constraint conditions; and the constraint condition is that the distance between any two server hash values on the consistency hash ring is greater than a preset value.
Optionally, determining, according to the hash binding information, a hash value of the target server on the consistent hash ring that is closest to the data hash value includes:
and inquiring a target server hash value closest to the data hash value on the consistent hash ring according to the hash binding information in a clockwise direction or a counterclockwise direction.
The present application further provides a management system of a virtual cache server, the system including:
the server determining module is used for receiving a server extension instruction and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers;
a hash value binding module, configured to select, in the consistent hash ring, a server hash value bound to each extended virtual cache server, so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one;
the data hash value calculation module is used for calculating a data hash value corresponding to the data to be cached according to a key value of the data to be cached if a data caching instruction is received;
a server query module, configured to determine, according to the hash binding information, a target server hash value closest to the data hash value on the consistent hash ring, and set an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
and the data storage module is used for storing the data to be cached by utilizing the target virtual cache server.
The present application further provides a storage medium having a computer program stored thereon, where the computer program when executed implements the steps executed by the management method of the virtual cache server.
The application also provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the execution of the management method of the virtual cache server when calling the computer program in the memory.
The application provides a management method of a virtual cache server, which comprises the following steps: receiving a server extension instruction, and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers; selecting a server hash value bound with each extended virtual cache server in a consistent hash ring so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one; if a data caching instruction is received, calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached; determining a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information, and setting an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server; and storing the data to be cached by utilizing the target virtual cache server.
The method comprises the steps of virtualizing an extended physical cache server into N extended virtual cache servers after receiving a server extension instruction, selecting a server hash value bound with each extended virtual cache server in a consistent hash ring, and further obtaining the binding relationship between each extended virtual cache server and an initial virtual cache server and the server hash value. After a data caching instruction is received, the data hash value corresponding to the data to be cached is calculated according to the key value of the data to be cached, and then the server hash value closest to the data hash value (namely the absolute value of the hash difference is minimum) is selected in the consistency hash ring to serve as the target server hash value, so that the data to be cached is stored by using the extended virtual cache server or the initial virtual cache server corresponding to the target server hash value. In the process, the virtual cache server for storing the data to be cached is selected according to the distance between the data hash value and the server hash value, so that the influence of the expansion server on the cache hit rate of the original server can be reduced. The application also provides a management system of the virtual cache server, an electronic device and a storage medium, which have the beneficial effects and are not repeated herein.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a management method of a virtual cache server according to an embodiment of the present disclosure;
fig. 2 is a flowchart of an expansion method based on a cache server according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a consistent hash ring provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a management system of a virtual cache server according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a flowchart of a management method of a virtual cache server according to an embodiment of the present disclosure.
The specific steps may include:
s101: receiving a server extension instruction, and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers;
before receiving the server expansion instruction, any number of initial virtual cache servers in the cluster can perform the operation of the data caching task. Specifically, the initial virtual cache server may perform data caching based on a consistent hash ring, and the implementation process is as follows: determining an initial physical cache server, and virtualizing the initial physical cache server into M initial virtual cache servers; constructing the consistency hash ring through a binary search tree, and selecting M hash values in the consistency hash ring as server hash values; and establishing a binding relationship between each initial virtual cache server and the hash value of the server, and generating the hash binding information. If a data caching instruction is received, calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached; and determining a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information, and setting an initial virtual cache server corresponding to the target server hash value as a target virtual cache server so as to store the data to be cached by using the target virtual cache server. Furthermore, the mapping relationship between the key value and the hash value of the server determined within a preset time period (for example, one hour) can be recorded, and the data hitting the cache server within the time period is provided to the ant colony algorithm as a sample to obtain a mapping relationship table, so that the mapping relationship table is used for selecting the corresponding virtual cache server to perform data storage operation.
After receiving the server extension instruction, a new physical cache server needs to be added within the cluster. Specifically, the corresponding extended physical cache server may be determined according to the server extension instruction, and the extended physical cache server may be virtualized as N extended virtual cache servers.
S102: selecting a server hash value bound with each extended virtual cache server in a consistent hash ring so as to update hash binding information;
the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one. The operation of binding the server hash value to the preset virtual cache server may exist before the step, so that the hash value which is not bound to the preset virtual cache server in the step may be used as the server hash value to be bound to the extended virtual cache server, so that each virtual cache server (including the extended virtual cache server and the preset virtual cache server) has the only corresponding server hash value.
As a possible implementation manner, in this step, a server hash value bound to each extended virtual cache server may be selected in the consistent hash ring according to the IP address of the extended virtual cache server. Specifically, a hash value corresponding to the IP address of the extended virtual cache server may be calculated, and a hash value closest to the hash corresponding to the IP address is selected as the server hash value in the consistency hash ring.
The hash can map a group of keywords onto a limited address interval according to a set hash function h (key) and a collision processing method, and take the image of the keyword in the address interval as a storage location recorded in a table, wherein the table is called a hash table or hash, and the obtained storage location is called a hash address or hash address. As a linear data structure, a hash table is one of which lookup speed is relatively fast compared to a table, a queue, and the like.
S103: if a data caching instruction is received, calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached;
after receiving the DATA caching instruction, the DATA caching instruction may be analyzed to determine the DATA to be cached, and then the key value of the DATA to be cached is determined, for example, the DATA to be cached is < 'JINAN', DATA >, and the key value is 'JINAN'. In this step, the hash calculation may be performed on the key value of the data to be cached to obtain a data hash value.
S104: determining a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information, and setting an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
the method comprises the steps that on the basis that a data hash value corresponding to data to be cached is determined, a hash value which is closest to the data hash value on a consistency hash ring can be inquired according to hash binding information, the hash value is used as a hash value of a target server, and an extended virtual cache server or an initial virtual cache server corresponding to the hash value of the target server can be set as the target virtual cache server.
As a possible implementation, the hash value of the target server closest to the data hash value may be queried in the following manner: and inquiring a target server hash value closest to the data hash value on the consistent hash ring according to the hash binding information in a clockwise direction or a counterclockwise direction.
S105: and storing the data to be cached by utilizing the target virtual cache server.
Wherein, every time a new data caching instruction is received, the related operations from S103 to S105 can be executed, and a corresponding virtual cache server is set for each data caching instruction.
In this embodiment, after receiving a server expansion instruction, an expansion physical cache server is virtualized into N expansion virtual cache servers, and a server hash value bound to each expansion virtual cache server is selected in a consistent hash ring, so as to obtain a binding relationship between each expansion virtual cache server and an initial virtual cache server and the server hash value. After receiving the data caching instruction, the embodiment calculates the data hash value corresponding to the data to be cached according to the key value of the data to be cached, and then selects the server hash value closest to the data hash value (i.e., the absolute value of the hash difference is the minimum) in the consistent hash ring as the target server hash value, so as to store the data to be cached by using the extended virtual cache server or the initial virtual cache server corresponding to the target server hash value. In the process, the virtual cache server for storing the data to be cached is selected according to the distance between the data hash value and the server hash value, so that the influence of the expansion server on the cache hit rate of the original server can be reduced.
As a further introduction to the embodiment corresponding to fig. 1, after the extended virtual cache server or the initial virtual cache server corresponding to the hash value of the target server is set as the target virtual cache server, a mapping relationship between the key value and the hash value of the target server may also be recorded, the mapping relationship and the data to be cached are used as training samples, and the training samples are input into an ant colony algorithm to obtain a mapping relationship table, so as to query the virtual cache server for storing data by using the mapping relationship table; the mapping relation table comprises the mapping relation between the key value of the data to be cached and the virtual cache server. After the mapping relation table is obtained, if a new data caching request is received, the virtual caching server can be searched without using a consistent hash ring, and the virtual caching server for storing data can be directly determined according to the mapping relation table. Specifically, after the training sample is input into the ant colony algorithm to obtain the mapping relationship table, if a new data caching instruction is received, the virtual cache server corresponding to the key value of the new data to be cached may be queried according to the mapping relationship table, and the virtual cache server corresponding to the key value of the new data to be cached is used to store the new data to be cached.
As a further introduction to the corresponding embodiment of fig. 1, before receiving the server extension instruction, the following operations are further included: determining an initial physical cache server, and virtualizing the initial physical cache server into M initial virtual cache servers; constructing the consistency hash ring through a binary search tree, and selecting M hash values in the consistency hash ring as server hash values; and establishing a binding relationship between each initial virtual cache server and the hash value of the server, and generating the hash binding information.
Further, after the hash binding information is generated, a mapping relationship between the key value of the data to be cached and the initial virtual cache server may be determined based on an ant colony algorithm, and a data storage operation may be performed by using the mapping relationship between the key value of the data to be cached and the initial virtual cache server.
Further, the above embodiment may select M hash values from the consistent hash ring by: selecting M hash values in the consistent hash ring as server hash values according to constraint conditions; and the constraint condition is that the distance between any two server hash values on the consistency hash ring is greater than a preset value. As a possible implementation manner, M hash values distributed uniformly can be selected in the consistency hash ring as the server hash values.
The flow described in the above embodiment is explained below by an embodiment in practical use. Referring to fig. 2, fig. 2 is a flowchart of an expansion method based on a cache server according to an embodiment of the present disclosure, where the embodiment shown in fig. 2 uses an ant colony algorithm and a consistent hash algorithm to implement load balancing in a process of expanding the server and improve a hit rate of a distributed cache in a process of expanding the server. The process of this embodiment may include: constructing a hash ring; putting the virtual physical node into a hash ring; obtaining the shortest path for key access cache through an ant colony algorithm; and placing the new virtual physical node into a hash ring, and calculating by using the ant colony algorithm again to obtain a mapping relation.
Specifically, this embodiment implements a 2 by binary search tree32The consistency hash ring connects the rightmost leaf node and the leftmost node of the binary tree.Virtualizing 20 times of virtual cache servers by the existing physical cache servers according to a ratio of one to twenty, and then allocating a hash value to each virtual machine. And calculating the hash value of the key value of the data to be cached according to the key value, and clockwise searching the virtual cache server node closest to the hash value on the hash ring. Referring to fig. 3, fig. 3 is a schematic structural diagram of a consistent hash ring according to an embodiment of the present application, where fig. 3 includes hash values corresponding to four virtual cache servers, i.e., a node0, a node1, a node2, and a node3, and a virtual cache server node closest to the hash value in the clockwise direction is a node 1. And recording the mapping relation between the key value and the hash value within a preset time (such as one hour), and providing the data hitting the cache server within the time as a sample for the ant colony algorithm to obtain a mapping relation table. When new nodes are added, virtual cache servers with ten times of virtual physical nodes are placed in a hash ring, ten virtual nodes are placed in the ring, ten adjacent virtual nodes can be affected uniformly, and the virtual nodes correspond to the ten physical servers, so that load balancing can be achieved. And after the nodes are newly added, the ant colony algorithm is called again to iterate to form a new mapping relation table, so that the hit rate of the shortest path of the key value is improved. The ant colony algorithm is a probabilistic algorithm for finding an optimized path.
The embodiment provides an expansion method based on a cache server, which includes the steps of firstly constructing a Hash ring, placing cache server nodes on the Hash ring according to Hash values of node names, then calculating key values of data needing caching to obtain the Hash values of the cache server nodes, then clockwise searching the cache server nodes which are closest to the key values on the Hash ring, and finishing Hash mapping search from the key values to the servers. The basic idea of the present embodiment is as follows: virtualizing each physical server into a set of virtual cache servers; constructing an integer hash ring; putting the hash value of the virtual server on a hash ring; when capacity expansion is needed, newly added servers are virtualized into a group of servers to be added into the hash ring; key finds out virtual server node on ring; obtaining physical server information according to the virtual server nodes; forming a topological association relation between a common key and a cached server based on an ant colony algorithm; and after new nodes are added, forming an updated topological relation based on the ant colony algorithm at intervals. The embodiment enables the newly added server not to influence the correct hit rate of most cache servers by improving the routing algorithm, and meanwhile, the hit rate of the server in the expansion process is improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a management system of a virtual cache server according to an embodiment of the present disclosure;
the system may include:
the server determining module 100 is configured to receive a server expansion instruction, and virtualize an expansion physical cache server corresponding to the server expansion instruction into N expansion virtual cache servers;
a hash value binding module 200, configured to select, in the consistent hash ring, a server hash value bound to each extended virtual cache server, so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one;
the data hash value calculation module 300 is configured to, if a data caching instruction is received, calculate a data hash value corresponding to data to be cached according to a key value of the data to be cached;
a server query module 400, configured to determine, according to the hash binding information, a target server hash value closest to the data hash value on the consistent hash ring, and set an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
a data storage module 500, configured to store the data to be cached by using the target virtual cache server.
In this embodiment, after receiving a server expansion instruction, an expansion physical cache server is virtualized into N expansion virtual cache servers, and a server hash value bound to each expansion virtual cache server is selected in a consistent hash ring, so as to obtain a binding relationship between each expansion virtual cache server and an initial virtual cache server and the server hash value. After receiving the data caching instruction, the embodiment calculates the data hash value corresponding to the data to be cached according to the key value of the data to be cached, and then selects the server hash value closest to the data hash value (i.e., the absolute value of the hash difference is the minimum) in the consistent hash ring as the target server hash value, so as to store the data to be cached by using the extended virtual cache server or the initial virtual cache server corresponding to the target server hash value. In the process, the virtual cache server for storing the data to be cached is selected according to the distance between the data hash value and the server hash value, so that the influence of the expansion server on the cache hit rate of the original server can be reduced.
Further, the method also comprises the following steps:
a mapping relation table generating module, configured to record a mapping relation between the key value and the hash value of the target server after setting an extended virtual cache server or an initial virtual cache server corresponding to the hash value of the target server as the target virtual cache server, use the mapping relation and the data to be cached as training samples, and input the training samples into an ant colony algorithm to obtain a mapping relation table, so as to query a virtual cache server for storing data by using the mapping relation table; the mapping relation table comprises the mapping relation between the key value of the data to be cached and the virtual cache server.
Further, the method also comprises the following steps:
and the caching module is used for inquiring a virtual caching server corresponding to the key value of the new data to be cached according to the mapping relation table if a new data caching instruction is received after the training sample is input into the ant colony algorithm to obtain the mapping relation table, and storing the new data to be cached by using the virtual caching server corresponding to the key value of the new data to be cached.
Further, the method also comprises the following steps:
the system comprises an initial setting module, a virtual cache module and a cache module, wherein the initial setting module is used for determining an initial physical cache server and virtualizing the initial physical cache server into M initial virtual cache servers before receiving a server expansion instruction; the system is also used for constructing the consistency hash ring through a binary search tree, and selecting M hash values in the consistency hash ring as server hash values; and the system is further used for establishing a binding relationship between each initial virtual cache server and the server hash value, and generating the hash binding information.
Further, the method also comprises the following steps:
and the initial virtual cache server storage module is used for determining the mapping relation between the key value of the data to be cached and the initial virtual cache server based on an ant colony algorithm after the hash binding information is generated, and executing data storage operation by using the mapping relation between the key value of the data to be cached and the initial virtual cache server.
Further, the process that the initial setting module selects M hash values in the consistent hash ring as the hash values of the server includes: selecting M hash values in the consistent hash ring as server hash values according to constraint conditions; and the constraint condition is that the distance between any two server hash values on the consistency hash ring is greater than a preset value.
Further, the server query module comprises:
and the hash query unit is used for querying a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information in a clockwise direction or a counterclockwise direction.
Since the embodiment of the system part corresponds to the embodiment of the method part, the embodiment of the system part is described with reference to the embodiment of the method part, and is not repeated here.
The present application also provides a storage medium having a computer program stored thereon, which when executed, may implement the steps provided by the above-described embodiments. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The application further provides an electronic device, which may include a memory and a processor, where the memory stores a computer program, and the processor may implement the steps provided by the foregoing embodiments when calling the computer program in the memory. Of course, the electronic device may also include various network interfaces, power supplies, and the like.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A management method for a virtual cache server is characterized by comprising the following steps:
receiving a server extension instruction, and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers;
selecting a server hash value bound with each extended virtual cache server in a consistent hash ring so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one;
if a data caching instruction is received, calculating a data hash value corresponding to the data to be cached according to the key value of the data to be cached;
determining a target server hash value closest to the data hash value on the consistency hash ring according to the hash binding information, and setting an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
and storing the data to be cached by utilizing the target virtual cache server.
2. The method for managing a virtual cache server according to claim 1, wherein after setting an extended virtual cache server or an initial virtual cache server corresponding to the hash value of the target server as the target virtual cache server, the method further comprises:
recording the mapping relation between the key value and the hash value of the target server, taking the mapping relation and the data to be cached as training samples, and inputting the training samples into an ant colony algorithm to obtain a mapping relation table so as to use the mapping relation table to query a virtual cache server for storing data; the mapping relation table comprises the mapping relation between the key value of the data to be cached and the virtual cache server.
3. The method for managing the virtual cache server according to claim 2, wherein after inputting the training samples into the ant colony algorithm to obtain the mapping relationship table, the method further comprises:
and if a new data caching instruction is received, inquiring a virtual caching server corresponding to the key value of the new data to be cached according to the mapping relation table, and storing the new data to be cached by using the virtual caching server corresponding to the key value of the new data to be cached.
4. The method for managing a virtual cache server according to claim 1, further comprising, before receiving the server expansion instruction:
determining an initial physical cache server, and virtualizing the initial physical cache server into M initial virtual cache servers;
constructing the consistency hash ring through a binary search tree, and selecting M hash values in the consistency hash ring as server hash values;
and establishing a binding relationship between each initial virtual cache server and the hash value of the server, and generating the hash binding information.
5. The method for managing a virtual cache server according to claim 4, further comprising, after generating the hash binding information:
and determining the mapping relation between the key value of the data to be cached and the initial virtual cache server based on the ant colony algorithm, and executing data storage operation by using the mapping relation between the key value of the data to be cached and the initial virtual cache server.
6. The method for managing a virtual cache server according to claim 4, wherein the selecting M hash values in the consistent hash ring as the server hash values comprises:
selecting M hash values in the consistent hash ring as server hash values according to constraint conditions; and the constraint condition is that the distance between any two server hash values on the consistency hash ring is greater than a preset value.
7. The method for managing the virtual cache server according to any one of claims 1 to 6, wherein determining, according to the hash binding information, a hash value of a target server on the consistent hash ring that is closest to the data hash value comprises:
and inquiring a target server hash value closest to the data hash value on the consistent hash ring according to the hash binding information in a clockwise direction or a counterclockwise direction.
8. A management system for a virtual cache server, comprising:
the server determining module is used for receiving a server extension instruction and virtualizing an extended physical cache server corresponding to the server extension instruction into N extended virtual cache servers;
a hash value binding module, configured to select, in the consistent hash ring, a server hash value bound to each extended virtual cache server, so as to update hash binding information; the hash binding information comprises a binding relationship between each extended virtual cache server and a server hash value and a binding relationship between each initial virtual cache server and a server hash value, and the server hash values correspond to the virtual cache servers one to one;
the data hash value calculation module is used for calculating a data hash value corresponding to the data to be cached according to a key value of the data to be cached if a data caching instruction is received;
a server query module, configured to determine, according to the hash binding information, a target server hash value closest to the data hash value on the consistent hash ring, and set an extended virtual cache server or an initial virtual cache server corresponding to the target server hash value as a target virtual cache server;
and the data storage module is used for storing the data to be cached by utilizing the target virtual cache server.
9. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the management method of the virtual cache server according to any one of claims 1 to 7 when calling the computer program in the memory.
10. A storage medium having stored thereon computer-executable instructions which, when loaded and executed by a processor, carry out the steps of a method of managing a virtual cache server as claimed in any one of claims 1 to 7.
CN202011357481.3A 2020-11-27 2020-11-27 Management method and system of virtual cache server, electronic equipment and storage medium Pending CN112463379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011357481.3A CN112463379A (en) 2020-11-27 2020-11-27 Management method and system of virtual cache server, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011357481.3A CN112463379A (en) 2020-11-27 2020-11-27 Management method and system of virtual cache server, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112463379A true CN112463379A (en) 2021-03-09

Family

ID=74809054

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011357481.3A Pending CN112463379A (en) 2020-11-27 2020-11-27 Management method and system of virtual cache server, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112463379A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113704308A (en) * 2021-09-02 2021-11-26 中国联合网络通信集团有限公司 Data caching method, device, server and recharging system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113704308A (en) * 2021-09-02 2021-11-26 中国联合网络通信集团有限公司 Data caching method, device, server and recharging system
CN113704308B (en) * 2021-09-02 2024-03-12 中国联合网络通信集团有限公司 Data caching method, device, server and recharging system

Similar Documents

Publication Publication Date Title
CN110287197B (en) Data storage method, migration method and device
US8495013B2 (en) Distributed storage system and method for storing objects based on locations
EP3777025A1 (en) Blockchain-based cross-chain data operation method and apparatus
CN104809129B (en) A kind of distributed data storage method, device and system
CN113132443B (en) Resource acquisition method and device and node equipment in CDN (content delivery network)
CN110321325B (en) File index node searching method, terminal, server, system and storage medium
CN104216724B (en) A kind of method and system of web application interface upgrade
CN105224609A (en) Index query method and device
CN112100185B (en) Indexing system and method for block chain data balance load
JP2008305225A (en) Control computer, computer system, and access control method
CN103294610A (en) Reusable content addressable stores
CN104956341A (en) Data migration method, device and processor
CN109101635B (en) Data processing method and device based on Redis Hash structure
CN106534268A (en) Data sharing method and apparatus
CN109451089A (en) A kind of access method, device, computer equipment and computer storage medium
CN113127420A (en) Metadata request processing method, device, equipment and medium
CN112463379A (en) Management method and system of virtual cache server, electronic equipment and storage medium
CN106843769B (en) A kind of interface data caching method, device and calculate equipment
JP5692757B2 (en) Server, method and system for providing node information of P2P network
CN114840487A (en) Metadata management method and device for distributed file system
KR102503958B1 (en) Apparatus for placing query in distributed networks environment and method thereof
CN113934377A (en) Metadata cluster deployment method, device, equipment and readable storage medium
EP3995972A1 (en) Metadata processing method and apparatus, and computer-readable storage medium
JP5776403B2 (en) Region search method, region search program, and information processing apparatus
CN112637327B (en) Data processing method, device 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