A data migration method based on a distributed lock and a related device
Patent Information
- Application Number
- CN202310627399.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-30
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2043-05-30
AI Technical Summary
也就是说,该传统迁移方案方案只要服务使用设备接收到新的路由信息,就会执行服务数据的迁移操作,容易造成服务数据在多个服务节点之间进行反复迁移,导致服务器负载不稳定,极大地提高服务迁移的延时
[0022] In this embodiment, after receiving an access request from a service-using device, the first service node acquires first lock information based on the access request. The first lock information includes a first oscillation protection time. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The first service node compares the current running time with the first oscillation protection time, and if the current running time is not less than the first oscillation protection time, receives service data sent by the storage service node. Subsequently, the first service node sends an access response message corresponding to the access request to the service-using device, the access response message including the service data. The access response message instructs the service-using device to perform an access operation on the service data. By adding a first oscillation protection time to the first lock information, the first service node only needs to determine that the distributed lock should be held by the first service node at the current running time if it determines that the current running time is not less than the first oscillation protection time. Then, by using the service data returned by the storage service node, it can respond to the service-using device. In other words, in this embodiment of the application, when new routing information is received, there is no need to directly perform data migration processing. Instead, the new service node (i.e., the first service node) needs to interact with the storage service node to complete the data migration operation after determining that the current running time is not less than the first oscillation protection time. This reduces the number of times service data is migrated between service nodes, which not only improves the stability of server load but also reduces the latency of service migration.
Smart Images

Figure CN119065583B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a data migration method and related apparatus based on distributed locks. Background Technology
[0002] With the development of gaming technology, cloud-based services have become an inevitable trend for game projects. In a cloud-native environment, two factors necessitate minimizing the number of data migrations during scaling up or down. First, due to the characteristics of the cloud-native environment, service scaling up or down is automatic based on factors such as resource utilization. Scaling up or down can occur at any time, therefore, each scaling up or down should minimize its impact on the server and the player experience. Second, services are typically implemented in a stateful manner, and the cost of loading and writing service data is relatively high. Frequent migrations can cause fluctuations in server load; therefore, to achieve seamless scaling up or down, the number of service data migrations should be minimized.
[0003] In traditional data migration schemes, service-using devices typically receive new routing information when a service is scaled up or down. Based on this new routing information, they migrate service data from the original service nodes to the nodes corresponding to the new routing information. In other words, this traditional migration scheme performs the service data migration operation as soon as the service-using device receives new routing information. This can easily lead to repeated migrations of service data between multiple service nodes, causing server load instability and significantly increasing service migration latency. Summary of the Invention
[0004] This application provides a data migration method and related apparatus based on distributed locks, which can reduce the number of data migrations between service nodes, thereby improving the stability of server load and reducing service migration latency.
[0005] In a first aspect, embodiments of this application provide a data migration method based on a distributed lock. The method includes: a first service node acquiring an access request sent by a service-using device, and acquiring first lock information based on the access request. The access request is used to request access to service data, and the first lock information includes a first oscillation protection time, which indicates the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information. The first service node receives service data sent by a storage service node when its current running time is not less than the first oscillation protection time. The first service node sends an access response message corresponding to the access request to the service-using device. The access response message includes service data and instructs the service-using device to perform an access operation on the service data.
[0006] Secondly, embodiments of this application provide another data migration method based on a distributed lock. In this method, a storage service node receives a data migration request sent by a first service node. The data migration request is sent by the first service node when its current running time is not less than a first oscillation protection time in the first lock information. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The storage service node migrates service data from the second service node to the first service node based on the data migration request. The storage service node sends a data response message corresponding to the data migration request to the first service node. The data response message includes the service data.
[0007] Thirdly, embodiments of this application provide another data migration method based on distributed locks. In this method, a service-using device obtains a node list and a first event from a cluster management device. The node list includes at least two service nodes, and the first event indicates that a first service node needs to perform a scaling-up or scaling-down operation. The at least two service nodes include the first service node. The service-using device sends an access request to the first service node based on the first event. The access request requests access to service data. The service-using device receives an access response message from the first service node corresponding to the access request. The access response message includes the service data. The service-using device performs an access operation on the service data based on the access response message.
[0008] Fourthly, embodiments of this application provide a first service node. The first service node includes an acquisition unit and a sending unit. Exemplarily, the first service node further includes a processing unit. The acquisition unit is configured to acquire an access request sent by a service-using device, the access request being used to request access to service data. The acquisition unit is configured to acquire first lock information based on the access request, the first lock information including a first oscillation protection time, the first oscillation protection time being used to indicate the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The acquisition unit is configured to receive service data sent by a storage service node when the current running time is not less than the first oscillation protection time. The sending unit is configured to send an access response message corresponding to the access request to the service-using device, the access response message including service data, the access response message being used to instruct the service-using device to perform an access operation on the service data.
[0009] In some optional implementations, the sending unit is further configured to send a data migration request to the storage service node before receiving service data sent by the storage service node. The data migration request instructs the storage service node to migrate service data from the second service node to the first service node. The obtaining unit is configured to receive a data response message corresponding to the data migration request sent by the storage service node. The data response message includes service data.
[0010] In some alternative embodiments, the sending unit is further configured to send a first message to the storage service node before acquiring the first lock information based on the access request, and after acquiring the access request when the first lock information is not stored in the local database of the first service node. The first message is used to instruct the storage service node to send the first lock information to the first service node. The acquiring unit is configured to receive the first lock information sent by the storage service node.
[0011] In some alternative implementations, the first lock information also includes the node identifier of the second service node; the processing unit is used to forward the access request to the second service node corresponding to the node identifier when the current running time is less than the first oscillation protection time.
[0012] In some alternative implementations, the sending unit is further configured to send a service scaling-up request or a service scaling-down request to the cluster management device before obtaining the access request sent by the service-using device.
[0013] Fifthly, embodiments of this application provide a storage service node. This storage service node includes a receiving module, a processing module, and a sending module. The receiving module is used to receive a data migration request sent by a first service node. The data migration request is sent by the first service node when its current running time is not less than a first oscillation protection time in the first lock information. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The processing module is used to migrate service data from the second service node to the first service node based on the data migration request. The sending module is used to send a data response message corresponding to the data migration request to the first service node. The data response message includes the service data.
[0014] In some optional implementations, the processing module is further configured to, before migrating service data from the second service node to the first service node based on a data migration request, compare the current running time with a first expiration time in the first lock information, provided that the current running time is not less than a first oscillation protection time. The first expiration time indicates the longest valid period of the distributed lock when the second service node accesses the service data, and the first expiration time is greater than the first oscillation protection time. The processing module is also configured to migrate service data from the second service node to the first service node based on the data migration request when the current running time is less than the first expiration time.
[0015] In some alternative implementations, the processing module is further configured to: update the first lock information based on the second lock information when the current running time is not less than the first expiration time; the second lock information includes the node identifier of the first service node, the second oscillation protection time, and the second expiration time, wherein the second oscillation protection time is used to indicate the effective protection time of the distributed lock when the first service node accesses service data while holding the second lock information, and the second expiration time is used to indicate the longest effective time of the distributed lock when the first service node accesses service data.
[0016] Sixthly, embodiments of this application provide a service usage device. This service usage device includes a receiving unit, a sending unit, and a processing unit. The receiving unit is configured to obtain a node list and a first event from a cluster management device. The node list includes at least two service nodes, and the first event indicates that a first service node needs to perform a scaling-up or scaling-down operation. The at least two service nodes include the first service node. The sending unit is configured to send an access request to the first service node based on the first event. The access request requests access to service data. The receiving unit is configured to receive an access response message corresponding to the access request sent by the first service node. The access response message includes service data. The processing unit is configured to perform an access operation on the service data based on the access response message.
[0017] In some alternative implementations, the processing unit is further configured to: before sending an access request to the first service node based on the first event, process the node identifier, node list and routing rules of the first service node based on a preset routing model, calculate the node address corresponding to the first event, and the node address is the address of the first service node, so as to determine the first service node.
[0018] A seventh aspect of this application provides a data migration device, including: a memory, an input / output (I / O) interface, and a processor. The memory is used to store program instructions. The processor is used to execute the program instructions in the memory to perform the method corresponding to the embodiment of the first aspect described above; or, to perform the method corresponding to the embodiment of the second aspect described above; or to perform the method corresponding to the embodiment of the third aspect described above.
[0019] An eighth aspect of this application provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method corresponding to the implementation of the first aspect; or, perform the method corresponding to the implementation of the second aspect; or perform the method corresponding to the implementation of the third aspect.
[0020] The ninth aspect of this application provides a computer program product containing instructions that, when run on a computer or processor, causes the computer or processor to execute the method corresponding to the implementation of the first aspect; or, execute the method corresponding to the implementation of the second aspect; or execute the method corresponding to the implementation of the third aspect.
[0021] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0022] In this embodiment, after receiving an access request from a service-using device, the first service node acquires first lock information based on the access request. The first lock information includes a first oscillation protection time. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The first service node compares the current running time with the first oscillation protection time, and if the current running time is not less than the first oscillation protection time, receives service data sent by the storage service node. Subsequently, the first service node sends an access response message corresponding to the access request to the service-using device, the access response message including the service data. The access response message instructs the service-using device to perform an access operation on the service data. By adding a first oscillation protection time to the first lock information, the first service node only needs to determine that the distributed lock should be held by the first service node at the current running time if it determines that the current running time is not less than the first oscillation protection time. Then, by using the service data returned by the storage service node, it can respond to the service-using device. In other words, in this embodiment of the application, when new routing information is received, there is no need to directly perform data migration processing. Instead, the new service node (i.e., the first service node) needs to interact with the storage service node to complete the data migration operation after determining that the current running time is not less than the first oscillation protection time. This reduces the number of times service data is migrated between service nodes, which not only improves the stability of server load but also reduces the latency of service migration. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A schematic diagram of the system architecture provided in an embodiment of this application is shown;
[0025] Figure 2 A flowchart of a data migration method based on a distributed lock provided in an embodiment of this application is shown;
[0026] Figure 3 This document illustrates a flowchart of the first service node processing access requests in an embodiment of this application.
[0027] Figure 4 This paper illustrates the overall process of a data migration method based on a distributed lock, as provided in an embodiment of this application.
[0028] Figure 5 This illustration shows a flowchart of the data migration request processed by the storage service node in an embodiment of this application.
[0029] Figure 6 This paper shows a schematic diagram of the structure of the first service node provided in an embodiment of this application;
[0030] Figure 7 This paper illustrates a schematic diagram of the structure of a storage service node provided in an embodiment of this application.
[0031] Figure 8 A schematic diagram of the structure of the device used for the service provided in the embodiments of this application is shown;
[0032] Figure 9 A schematic diagram of the hardware structure of the data migration device provided in the embodiments of this application is shown. Detailed Implementation
[0033] This application provides a data migration method and related apparatus based on distributed locks, which can reduce the number of data migrations between service nodes, thereby improving the stability of server load and reducing service migration latency.
[0034] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0036] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that implementations of the application described herein can be implemented, for example, in sequences other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0037] In traditional data migration schemes, service data migration is performed as soon as the service device receives new routing information. This can easily cause service data to be repeatedly migrated between multiple service nodes, leading to unstable server load and significantly increasing service migration latency.
[0038] To address the aforementioned technical issues, this application provides a data migration method based on distributed locks. This method eliminates the need for repeated data migration between service nodes, reducing the frequency of data migration, improving server load stability, and lowering service migration latency. For example, this distributed lock-based data migration method can be applied to virtual game scenarios, business transmission scenarios, or other data migration scenarios, and specific applications are not limited thereto.
[0039] For example, the data migration method based on distributed locks provided in this application can be applied to... Figure 1 In the system architecture shown. For example... Figure 1 As shown, the system architecture includes at least service-using devices, cluster management devices, storage service nodes, and at least two service nodes. The at least two service nodes can include service node 1 to service node N, where N ≥ 2 and N is an integer.
[0040] When the first service node (e.g., service node 1) generates a service expansion or contraction request, it can send the corresponding request to the cluster management device. Upon receiving the request, the cluster management device updates its node list. The service user device retrieves the node list from the cluster management device, calculates the node address of the first service node corresponding to the expansion or contraction request, and then sends an access request to the first service node corresponding to that address.
[0041] Upon receiving an access request, the first service node acquires the first lock information based on the request. This first lock information includes a first oscillation protection time, which indicates the effective protection period of the distributed lock when the second service node accesses service data while the second service node holds the first lock information. The first service node compares its current running time with the first oscillation protection time. If the current running time is not less than the first oscillation protection time, the first service node sends a data migration request to the storage service node to facilitate the retrieval of the corresponding service data.
[0042] It should be noted that the first service node and the second service node mentioned above can be any two different service nodes. For example, the first service node can be service node 1, the second service node can be service node 2, etc., and this application does not limit the specific service node. Each service node mentioned can include, but is not limited to, terminal devices, servers, etc. The described storage service node can also include, but is not limited to, backend servers or other data storage devices. The described cluster management device can include, but is not limited to, terminal devices, servers, or other management devices, and this application does not limit the specific cluster management device.
[0043] Furthermore, the aforementioned terminal devices may include, but are not limited to, smartphones, desktop computers, laptops, tablets, smart speakers, in-vehicle devices, smartwatches, wearable smart devices, smart voice interaction devices, smart home appliances, and aircraft. Servers may be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. This application does not impose specific limitations. Additionally, the mentioned terminal devices and servers may be directly or indirectly connected via wired or wireless communication, which is also not specifically limited in this application.
[0044] The data migration method based on distributed locks mentioned above can also be applied to fields such as cloud technology. Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on cloud computing business models. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0045] Cloud computing, as mentioned, is a computing model that distributes computing tasks across a resource pool composed of a large number of computers, enabling various application systems to obtain computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable, readily available, on-demand, expandable, and pay-as-you-go. As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called an Infrastructure as a Service (IaaS) platform) is established. Various types of virtual resources are deployed within this pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices. Logically, a Platform as a Service (PaaS) layer can be deployed on top of the IaaS layer, and a Software as a Service (SaaS) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be directly deployed on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS consists of various business software, such as web portals and bulk SMS senders. Generally, SaaS and PaaS are upper layers compared to IaaS.
[0046] The data migration method based on distributed locks provided in the embodiments of this application will be described below with reference to the accompanying drawings. Figure 2 A flowchart illustrating a data migration method based on distributed locks provided in an embodiment of this application is shown. Figure 2 As shown, this data migration method may include the following steps:
[0047] 201. The service uses the device to obtain the node list and the first event from the cluster management device. The node list includes at least two service nodes, and the first event is used to indicate that the first service node needs to perform a scaling up or scaling down operation. The at least two service nodes include the first service node.
[0048] In this example, when service scaling is required, the service node can send a service scaling request to the cluster management device. Alternatively, when service scaling is required, the service node can send a service scaling request to the cluster management device. Upon receiving a service scaling request, the cluster management device can generate a corresponding first event. This first event indicates whether the corresponding service node needs to perform a scaling operation or a scaling operation. For example, the first event may include a scaling event or a scaling event.
[0049] After generating the first event, the cluster management device also updates the stored node list based on that first event. The node list reveals which service nodes support service scaling up and down. For example, taking service node 1 as the first service node, if service node 1 sends a service scaling request to the cluster management device, the device, after generating the corresponding first event, can add the node information of service node 1 from that first event to the node list. It should be noted that the node list includes at least two service nodes. These at least two service nodes include the first service node and the second service node.
[0050] In some examples, before performing subsequent step 202, the service-using device can further process the node identifier, node list, and routing rules of the first service node based on a preset routing model to calculate the node address corresponding to the first event. The described node address is the address of the first service node. This node address allows for accurate location of the first service node from among N service nodes.
[0051] 202. The service-using device sends an access request to the first service node based on the first event. The access request is used to access service data.
[0052] In this example, when a service-using device requests service data, it can request the node list and the first event from the cluster management device via messages or other means. After receiving the node list and the first event from the cluster management device, the service-using device can send an access request to the first service node based on the first event. It should be noted that the described access request is used to request access to service data. The access request mentioned may include, but is not limited to, remote procedure call (RPC) requests, etc., but is not limited in this embodiment.
[0053] For example, the service data mentioned may include, but is not limited to, game service data in virtual game scenarios, business service data in business transmission scenarios, etc., and is not limited in this application embodiment.
[0054] 203. The first service node obtains the first lock information based on the access request. The first lock information includes the first oscillation protection time. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information.
[0055] In this example, a distributed lock is understood as a method used in a distributed system to synchronize access to shared resources. When sharing resources, a distributed lock acts as a mutual exclusion mechanism, ensuring that service data remains consistent when migrated to different service nodes.
[0056] Traditional lock information only includes the node information of the service node to which the distributed lock currently belongs and the lock's expiration time. When migrating data using traditional lock information, as long as new routing information is received within the distributed lock's expiration time, the lock ownership is directly processed between service nodes to facilitate the migration of service data. However, this traditional approach easily leads to repeated migrations, causing server load instability and significantly increasing service migration latency. Therefore, in this embodiment, a new field, the oscillation protection time, is added to the lock information. The oscillation protection time clarifies the effective protection period of the distributed lock when a service node holds the lock information and accesses service data. In other words, the oscillation protection time ensures that the distributed lock will not be occupied by other service nodes within this protection period, thus preventing service data from being migrated to other service nodes. Data migration only occurs when the current runtime is not less than the oscillation protection time, reducing the number of service data migrations and enhancing server load stability. It is worth noting that the oscillation protection time of the distributed lock is less than its expiration time.
[0057] Based on this, after receiving an access request, the first service node can acquire the first lock information based on the access request. The first lock information includes a first oscillation protection time. For example, the first lock information also includes a first expiration time and the node identifier of the second service node. The first oscillation protection time is less than the first expiration time. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node holds the first lock information and accesses the service data. The first expiration time indicates the longest effective time of the distributed lock when the second service node accesses the service data.
[0058] For example, the first service node can store the association between the service identifier and the lock information. The service identifier is used to identify the specific service data that needs to be accessed. Regarding the method by which the first service node obtains the first lock information, it can first query its local database to see if the first lock information is cached, based on the service identifier in the access request and the association between the service identifier and the lock information. If the query finds that the first service node's local database caches the first lock information, then the first service node executes the subsequent step 204. Conversely, if the first service node finds that its local database does not cache the first lock information, it can request the storage service node to provide the first lock information. As an illustrative description, the first service node can send a first message to the storage service node when its local database does not store the first lock information, so that the storage service node can be instructed to send the first lock information to the first service node. In this way, by receiving the first lock information sent by the storage service node, the first service node can obtain the first lock information when the distributed lock currently belongs to the second service node.
[0059] 204. When the current running time is not less than the first oscillation protection time, the first service node receives service data sent by the storage service node.
[0060] In this example, after obtaining the first lock information, the first service node demaps the first oscillation protection time within that information to obtain the specific first oscillation protection time. Subsequently, the first service node compares the current running time with the first oscillation protection time and decides whether to perform a data migration operation based on the comparison result. For example, if the current running time is not less than the first oscillation protection time, the first service node receives service data sent by the storage service node. For instance, if the current running time is 20 minutes and the first oscillation protection time is 15 minutes, a comparison shows that 20 minutes > 15 minutes, and in this case, the first service node can receive the service data sent by the storage service node.
[0061] For example, if the first service node determines that the current running time is less than the first oscillation protection time, it indicates that the distributed lock will not be occupied by other service nodes during the first oscillation protection time, and no data migration operation is required. Therefore, when the current running time is less than the first oscillation protection time, the first service node can also forward the access request to the second service node, which will then feed back the corresponding service data to the service-using device. It should be noted that the process of the second service node feeding back service data to the service-using device can be understood by referring to the description in steps 202 to 205 of this application, and will not be elaborated here.
[0062] Figure 3 This diagram illustrates the process of the first service node handling an access request. Figure 3 As shown, the first service node receives the access request and queries the local database to see if the first lock information is stored.
[0063] If the first service node determines that the first lock information is already stored in its local database, it further determines whether the current running time is less than the first oscillation protection time specified in the first lock information. Conversely, if the first service node determines that the first lock information is not stored in its local database, it retrieves the first lock information from the storage service node and then determines whether the current running time is less than the first oscillation protection time specified in the first lock information.
[0064] If the first service node determines that the current running time is not less than the first oscillation protection time in the first lock information, then the first service node will process the access request. How to process this access request can be understood by referring to the descriptions in steps 204 and 205, which will not be repeated here. Conversely, if the first service node determines that the current running time is less than the first oscillation protection time in the first lock information, then the first service node will forward the access request to the second service node corresponding to the node identifier in the first lock information, and the second service node will continue to process the access request. It should be noted that how the second service node processes the access request can be referred to... Figure 3 The flowchart is provided for understanding; further details will not be elaborated here.
[0065] 205. The first service node sends an access response message corresponding to the access request to the service-using device. The access response message includes service data.
[0066] In this example, after receiving service data from the storage service node, the first service node can map the service data to an access response message, and then send an access response message corresponding to the access request back to the service-using device. In this way, the service data is sent to the service-using device via the access response message.
[0067] 206. The service uses the device to perform access operations on the service data based on the access response message.
[0068] In this example, after receiving an access response message, the service-using device demaps the message to extract the service data carried within. This allows the device to perform access operations on the service data, facilitating access to the corresponding service. For example, the services mentioned in this application may include, but are not limited to, game services, business services, etc., without specific limitations. For instance, game services may include, but are not limited to, game gift pack services, game lobby services, game store services, game team services, etc., without further description in this embodiment.
[0069] The following will describe the data migration process provided in the embodiments of this application from the perspective of device and node interaction. Figure 4 This diagram illustrates the overall flow of a data migration method based on distributed locks provided in an embodiment of this application. Figure 4 As shown, the overall process diagram includes at least the following steps:
[0070] 401. The service uses the device to obtain the node list and the first event from the cluster management device. The node list includes at least two service nodes, and the first event is used to indicate that the first service node needs to perform a scaling up or scaling down operation. The at least two service nodes include the first service node.
[0071] 402. The service-using device sends an access request to the first service node based on the first event. The access request is used to access service data.
[0072] 403. The first service node obtains the first lock information based on the access request. The first lock information includes the first oscillation protection time. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information.
[0073] It should be noted that steps 401 to 403 in this embodiment can be specifically referred to the foregoing. Figure 2 The content described in steps 201 to 203 is understood and will not be repeated here.
[0074] 404. When the current running time is not less than the first oscillation protection time, the first service node sends a data migration request to the storage service node.
[0075] In this example, if it is determined that the current running time is not less than the first oscillation protection time, the first service node can send a data migration request to the storage service node while receiving service data from the storage service node. This data migration request instructs the storage service node to migrate the service data from the second service node to the first service node.
[0076] 405. The storage service node migrates service data from the second service node to the first service node based on the data migration request.
[0077] In this example, after receiving a data migration request from the first service node, the storage service node learns that data migration is required. Based on this, the storage service node migrates the service data from the second service node to the first service node according to the data migration request.
[0078] In some examples, before performing data migration operations on service data, the storage service node can further determine the relationship between the current running time and the first expiration time in the first lock information, provided that the current running time is not less than the first oscillation protection time. Subsequently, when the storage service node determines that the current running time is less than the first expiration time, it migrates the service data from the second service node to the first service node based on the data migration request. For example, the storage service node can notify the second service node to write back and release the service data through messages or other means. After the second service node successfully writes back and releases the service data, it will update the first lock information and then fully allocate the updated lock information (i.e., the second lock information) to the first service node, thereby enabling the first service node to load the service data based on the second lock information, thus completing the service data migration process.
[0079] It should be noted that the first shock protection time, the first lock information, and the first expiration time mentioned here can be referred to in the preceding text. Figure 2 The content described in step 202 is for your understanding and will not be repeated here.
[0080] Furthermore, if the storage service node determines that the current runtime is not less than the first expiration time, it means that the distributed lock has expired its maximum validity period, and the second service node can no longer mutually exclusively hold the distributed lock. Therefore, if the current runtime is not less than the first expiration time, the storage service node can update the first lock information based on the second lock information.
[0081] The aforementioned second lock information includes the node identifier of the first service node, the second oscillation protection time, and the second expiration time. The second oscillation protection time indicates the effective protection period of the distributed lock when the first service node accesses service data while holding the second lock information. The second expiration time indicates the longest valid period of the distributed lock when the first service node accesses service data. As an illustrative example, during the process of updating the first lock information, the storage service node can specifically update the node identifier of the second service node to the node identifier of the first service node; similarly, the storage service node updates the first oscillation protection time to the second oscillation protection time and the first expiration time to the second update time.
[0082] Figure 5 This diagram illustrates the process of a storage service node handling a data migration request. Figure 5 As shown, the storage service node receives a data migration request and determines whether the current running time is less than the first oscillation protection time in the first lock information.
[0083] If the storage service node determines that the current running time is less than the first oscillation protection time in the first lock information, it directly assigns the first lock information to the second service node. Conversely, if the storage service node determines that the current running time is not less than the first oscillation protection time, it further determines whether the current running time is less than the first expiration time in the first lock information.
[0084] When the storage service node determines that the current runtime is less than the first expiration time, it notifies the second service node to write back and release the service data. After the second service node successfully writes back and releases the service data, it allocates the updated second lock information to the first service node, allowing the first service node to load the service data based on the second lock information, thus completing the service data migration process. Conversely, if the storage service node determines that the current runtime is not less than the first expiration time, it directly allocates the second lock information to the first service node.
[0085] 406. The storage service node sends a data response message corresponding to the data migration request to the first service node. The data response message includes service data.
[0086] In this example, the storage service node completes the data migration operation after migrating service data from the second service node to the first service node. At this point, the storage service node sends a data response message corresponding to the data migration request to the first service node, thereby informing the first service node of the relevant service data through the data response message. Upon receiving the data response message, the first service node performs demapping processing on the data response message to extract the service data carried within it.
[0087] 407. The first service node sends an access response message corresponding to the access request to the service-using device. The access response message includes service data and is used to instruct the service-using device to perform an access operation on the service data.
[0088] 408. The service uses the device to perform access operations on service data based on the access response message.
[0089] It should be noted that steps 408 to 409 in this embodiment can be specifically referred to the foregoing. Figure 2 The content described in steps 205 to 206 is understood and will not be repeated here.
[0090] In this embodiment, a first oscillation protection time is added to the first lock information. The first service node only needs to determine that the distributed lock should be held by the first service node if it determines that the current running time is not less than the first oscillation protection time. At this time, the service data fed back by the storage service node can be used to respond to the device using the service. That is to say, in this embodiment, when receiving new routing information, it is not necessary to directly perform data migration processing. Instead, the new service node (i.e., the first service node) needs to further interact with the storage service node to complete the data migration operation if it determines that the current running time is not less than the first oscillation protection time. This reduces the number of times service data is migrated between service nodes, which not only improves the stability of server load but also reduces the latency of service migration.
[0091] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that to achieve the above functions, corresponding hardware structures and / or software modules are included to execute each function. Those skilled in the art should readily recognize that, based on the modules and algorithm steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0092] This application embodiment can divide the device into functional modules according to the above method example. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0093] The first service node in the embodiments of this application will be described in detail below. Figure 6 This is a schematic diagram of one embodiment of the first service node provided in this application. Figure 6 As shown, the first service node may include an acquisition unit 601 and a sending unit 602. Exemplarily, the first service node may also include a processing unit 603.
[0094] The acquisition unit 601 is used to acquire access requests sent by the service-using device, whereby the access requests are used to request access to service data. For details, please refer to the preceding description. Figure 2 Step 202 or Figure 4 The content described in step 402 is for your understanding and will not be repeated here.
[0095] The acquisition unit 601 is used to acquire first lock information based on the access request. The first lock information includes a first oscillation protection time, which indicates the effective protection time of the distributed lock when the second service node accesses service data while the second service node holds the first lock information. For details, please refer to the foregoing. Figure 2 Step 203 or Figure 4 The content described in step 403 is for your understanding and will not be repeated here.
[0096] The acquisition unit 601 is used to receive service data sent by the storage service node when the current running time is not less than the first oscillation protection time. For details, please refer to the aforementioned... Figure 2 Step 203 or Figure 4 The content described in step 406 is for your understanding and will not be repeated here.
[0097] The sending unit 602 is configured to send an access response message corresponding to the access request to the service-using device. The access response message includes service data and is used to instruct the service-using device to perform an access operation on the service data. For details, please refer to the foregoing. Figure 2 Step 204 or Figure 4 The content described in step 407 is for your understanding and will not be repeated here.
[0098] In some optional embodiments, the sending unit 602 is further configured to send a data migration request to the storage service node before receiving service data sent by the storage service node. The data migration request instructs the storage service node to migrate service data from the second service node to the first service node. The obtaining unit 601 is configured to receive a data response message corresponding to the data migration request sent by the storage service node. The data response message includes service data.
[0099] In some alternative embodiments, the sending unit 602 is further configured to send a first message to the storage service node before obtaining the first lock information based on the access request, and after obtaining the access request when the first lock information is not stored in the local database of the first service node. The first message is used to instruct the storage service node to send the first lock information to the first service node. The obtaining unit 601 is configured to receive the first lock information sent by the storage service node.
[0100] In some alternative implementations, the first lock information also includes the node identifier of the second service node; the processing unit 603 is used to forward the access request to the second service node corresponding to the node identifier when the current running time is less than the first oscillation protection time.
[0101] In some alternative implementations, the sending unit 602 is further configured to send a service scaling-up request or a service scaling-down request to the cluster management device before obtaining the access request sent by the service-using device.
[0102] The above Figure 6 The first service node was mainly described from the perspective of functional modules. The storage service node in this application embodiment will be described in detail below from the perspective of functional modules. Figure 7 This is a schematic diagram of one embodiment of the storage service node provided in this application. Figure 7 As shown, the storage service node includes a receiving module 701, a processing module 702, and a sending module 703.
[0103] The receiving module 701 is used to receive a data migration request sent by the first service node. The data migration request is sent by the first service node when the current running time is not less than the first oscillation protection time in the first lock information. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information.
[0104] The processing module 702 is used to migrate service data from the second service node to the first service node based on the data migration request.
[0105] The sending module 703 is used to send a data response message corresponding to the data migration request to the first service node. The data response message includes service data.
[0106] In some optional implementations, processing module 702 is further configured to, before migrating service data from the second service node to the first service node based on a data migration request, compare the current running time with a first expiration time in the first lock information, provided that the current running time is not less than a first oscillation protection time. The first expiration time is used to indicate the longest valid time of the distributed lock when the second service node accesses the service data, and the first expiration time is greater than the first oscillation protection time. Processing module 702 is also configured to migrate service data from the second service node to the first service node based on the data migration request when the current running time is less than the first expiration time.
[0107] In some alternative implementations, the processing module 702 is further configured to: update the first lock information based on the second lock information when the current running time is not less than the first expiration time. The second lock information includes the node identifier of the first service node, a second oscillation protection time, and a second expiration time. The second oscillation protection time indicates the effective protection time of the distributed lock when the first service node accesses service data while holding the second lock information, and the second expiration time indicates the longest effective time of the distributed lock when the first service node accesses service data.
[0108] The above Figure 6 , Figure 7 The first service node and the storage service node are mainly described from the perspective of functional modules. The following will describe in detail the service-using devices in this embodiment from the perspective of functional modules. Figure 8 This is a schematic diagram of one embodiment of the device used to provide the service described in this application. Figure 8 As shown, the equipment used in this service includes a receiving unit 801, a sending unit 802, and a processing unit 803.
[0109] The receiving unit 801 is used to obtain a node list and a first event from the cluster management device. The node list includes at least two service nodes, and the first event is used to indicate that the first service node needs to perform a scaling-up or scaling-down operation. The at least two service nodes include the first service node.
[0110] Sending unit 802 is configured to send an access request to the first service node based on a first event. The access request is used to request access to service data.
[0111] The receiving unit 801 is used to receive an access response message corresponding to the access request sent by the first service node. The access response message includes service data.
[0112] The processing unit 803 is used to perform access operations on service data based on the access response message.
[0113] In some alternative implementations, the processing unit 803 is further configured to: before sending an access request to the first service node based on the first event, process the node identifier, node list and routing rules of the first service node based on a preset routing model, calculate the node address corresponding to the first event, and the node address is the address of the first service node, so as to determine the first service node.
[0114] The data migration device in this application embodiment has been described above from the perspective of modular functional entities. The data migration device in this application embodiment will now be described below from the perspective of hardware processing. Figure 9 This is a schematic diagram of the structure of a data migration device provided in an embodiment of this application. The data migration device can vary considerably due to differences in configuration or performance. The data migration device may include at least one processor 901, a communication line 907, a memory 903, and at least one communication interface 904.
[0115] The processor 901 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (server IC), or one or more integrated circuits used to control the execution of programs according to the present application.
[0116] Communication line 907 may include a path for transmitting information between the aforementioned components.
[0117] Communication interface 904 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.
[0118] The memory 903 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions. The memory can exist independently and be connected to the processor via communication line 907. The memory can also be integrated with the processor.
[0119] The memory 903 stores computer execution instructions for implementing the scheme of this application, and its execution is controlled by the processor 901. The processor 901 executes the computer execution instructions stored in the memory 903, thereby realizing the data migration method based on distributed locks provided in the above embodiments of this application.
[0120] Optionally, the computer execution instructions in the embodiments of this application may also be referred to as application code, and the embodiments of this application do not specifically limit this.
[0121] In a specific implementation, as one example, the data migration device may include multiple processors, such as... Figure 9 Processors 901 and 902 are described in the text. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0122] In a specific implementation, as one embodiment, the data migration device may further include an output device 905 and an input device 906. The output device 905 communicates with the processor 901 and can display information in various ways. The input device 906 communicates with the processor 901 and can receive input from the target object in various ways. For example, the input device 906 may be a mouse, a touchscreen device, or a sensing device, etc.
[0123] The aforementioned data migration device can be a general-purpose device or a dedicated device. In specific implementations, the data migration device can be a server, a terminal, or something similar. Figure 9 A device with a similar structure. The embodiments of this application do not limit the type of data migration device.
[0124] It should be noted that Figure 9 The processor 901 can invoke computer execution instructions stored in memory 903 to enable the data migration device to perform actions such as... Figures 2 to 5 The method in the corresponding method embodiment.
[0125] Specifically, Figure 6 Processing unit 603 in Figure 7 The processing module 702 and Figure 8 The function / implementation process of the processing unit 803 in the middle can be achieved through Figure 9 The processor 901 in the memory calls computer execution instructions stored in the memory 903 to achieve this. Figure 6 The acquisition unit 601 and the sending unit 602 in the middle, Figure 7 The receiving module 701, the transmitting module 703, and Figure 8 The functions / implementation process of the receiving unit 801 and the transmitting unit 802 can be obtained through Figure 9 It is implemented using the 904 communication interface.
[0126] This application also provides a computer storage medium storing a computer program for electronic data interchange, which causes a computer to perform some or all of the steps of any of the distributed lock-based data migration methods described in the above method embodiments.
[0127] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the distributed lock-based data migration methods described in the above method embodiments.
[0128] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0130] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0132] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0133] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, they can be implemented in whole or in part in the form of a computer program product.
[0135] A computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, they generate, in whole or in part, the processes or functions according to embodiments of this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., SSDs), etc.
[0136] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A data migration method based on distributed locks, characterized in that, Applied to the first service node, the method includes: Obtain the access request sent by the device using the service, the access request being used to request access to service data; Based on the access request, first lock information is obtained. The first lock information includes a first oscillation protection time. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information. When the current running time is not less than the first oscillation protection time, the current running time is compared with the first expiration time in the first lock information. The first expiration time is used to indicate the longest valid time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time. When the current running time is not less than the first oscillation protection time, receive service data sent by the storage service node; Send an access response message corresponding to the access request to the service-using device. The access response message includes the service data and is used to instruct the service-using device to perform an access operation on the service data.
2. The method according to claim 1, characterized in that, Before receiving service data sent by the storage service node, the method further includes: Send a data migration request to the storage service node, the data migration request being used to instruct the storage service node to migrate the service data from the second service node to the first service node; Receive service data sent by the storage service node, including: The system receives a data response message from the storage service node corresponding to the data migration request, the data response message including the service data.
3. The method according to any one of claims 1 to 2, characterized in that, Before obtaining the first lock information based on the access request, the method further includes: Upon receiving the access request, if the first lock information is not stored in the local database of the first service node, a first message is sent to the storage service node. The first message is used to instruct the storage service node to send the first lock information to the first service node. The step of obtaining the first lock information based on the access request includes: Receive the first lock information sent by the storage service node.
4. The method according to any one of claims 1 to 2, characterized in that, The first lock information also includes the node identifier of the second service node, and the method further includes: When the current running time is less than the first oscillation protection time, the access request is forwarded to the second service node corresponding to the node identifier.
5. A data migration method based on distributed locks, characterized in that, Applied to a storage service node, the method includes: The system receives a data migration request sent by a first service node. The data migration request is sent by the first service node when the current running time is not less than the first oscillation protection time in the first lock information. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information. When the current running time is not less than the first oscillation protection time, the current running time is compared with the first expiration time in the first lock information. The first expiration time is used to indicate the longest valid time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time. When the current running time is less than the first expiration time, the service data is migrated from the second service node to the first service node based on the data migration request; Send a data response message corresponding to the data migration request to the first service node. The data response message includes the service data.
6. The method according to claim 5, characterized in that, The method further includes: When the current running time is not less than the first expiration time, the first lock information is updated based on the second lock information. The second lock information includes the node identifier of the first service node, the second oscillation protection time, and the second expiration time. The second oscillation protection time is used to indicate the effective protection time of the distributed lock when the first service node accesses the service data while holding the second lock information. The second expiration time is used to indicate the longest effective time of the distributed lock when the first service node accesses the service data.
7. A data migration method based on distributed locks, characterized in that, Applied to service-use equipment, the method includes: The system retrieves a node list and a first event from the cluster management device. The node list includes at least two service nodes. The first event indicates that the first service node needs to perform a scaling-up or scaling-down operation. The at least two service nodes include the first service node. The first service node retrieves first lock information, which includes a first oscillation protection time and a first expiration time. The first oscillation protection time indicates the effective protection time of the distributed lock when the second service node accesses service data while holding the first lock information. The first expiration time indicates the longest effective time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time. When the current running time is not less than the first oscillation protection time, the system compares the current running time with the first expiration time. When the current running time is less than the first expiration time, the system sends a data migration request to the storage service node. Based on the first event, an access request is sent to the first service node, the access request being used to request access to service data; Receive an access response message sent by the first service node corresponding to the access request, wherein the access response message includes the service data; The service data is accessed based on the access response message.
8. The method according to claim 7, characterized in that, Before sending an access request to the first service node based on the first event, the method further includes: Based on a preset routing model, the node identifier of the first service node, the node list, and the routing rules of the first service node are processed to calculate the node address corresponding to the first event. The node address is the address of the first service node, thereby determining the first service node.
9. A first service node, characterized in that, include: The acquisition unit is used to acquire access requests sent by the service-using device, wherein the access requests are used to request access to service data; The acquisition unit is used to acquire first lock information based on the access request. The first lock information includes a first oscillation protection time. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information. The acquisition unit is used to receive service data sent by the storage service node when the current running time is not less than the first oscillation protection time; A sending unit is configured to send an access response message corresponding to the access request to the service-using device, the access response message including the service data, and the access response message being used to instruct the service-using device to perform an access operation on the service data; The first service node is further configured to compare the current running time with the first expiration time in the first lock information when the current running time is not less than the first oscillation protection time. The first expiration time is used to indicate the longest valid time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time.
10. A storage service node, characterized in that, include: The receiving module is used to receive a data migration request sent by the first service node. The data migration request is sent by the first service node when the current running time is not less than the first oscillation protection time in the first lock information. The first oscillation protection time is used to indicate the effective protection time of the distributed lock when the second service node accesses the service data while the second service node holds the first lock information. The processing module is configured to compare the current running time with the first expiration time in the first lock information when the current running time is not less than the first oscillation protection time. The first expiration time is used to indicate the longest valid time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time. When the current running time is less than the first expiration time, the service data is migrated from the second service node to the first service node based on the data migration request; The sending module is used to send a data response message corresponding to the data migration request to the first service node, wherein the data response message includes the service data.
11. A service device, characterized in that, include: A receiving unit is configured to obtain a node list and a first event from a cluster management device. The node list includes at least two service nodes. The first event is configured to indicate that a first service node needs to perform a scaling-up or scaling-down operation. The at least two service nodes include the first service node. The first service node is configured to obtain first lock information. The first lock information includes a first oscillation protection time and a first expiration time. The first oscillation protection time is configured to indicate the effective protection time of the distributed lock when the second service node accesses service data while the second service node holds the first lock information. The first expiration time is configured to indicate the longest effective time of the distributed lock when the second service node accesses the service data. The first expiration time is greater than the first oscillation protection time. When the current running time is not less than the first oscillation protection time, compare the current running time with the first expiration time; When the current running time is less than the first expiration time, a data migration request is sent to the storage service node; A sending unit is configured to send an access request to the first service node based on the first event, wherein the access request is used to request access to service data. The receiving unit is configured to receive an access response message corresponding to the access request sent by the first service node, wherein the access response message includes the service data; The processing unit is used to perform access operations on the service data based on the access response message.
12. A data migration device, characterized in that, include: Input / output interface, processor, and memory, wherein the memory stores program instructions; The processor is configured to execute program instructions stored in the memory to perform the method as described in any one of claims 1 to 8.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on a computer device, cause the computer device to perform the method as described in any one of claims 1 to 8.
14. A computer program product, characterized in that, The computer program product includes instructions that, when executed on a computer device, cause the computer device to perform the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Shared resource access method and device and computer readable storage medium
CN109753540A
Data migration method, readable storage medium and computing equipment
CN111198845A