Method and apparatus for reading and writing distributed storage systems

By implementing resource isolation and load balancing on the coordinated server, the problem that traditional distributed storage systems are difficult to achieve resource isolation and load balancing in large traffic and high concurrency environments is solved, and resource isolation on the application service instance side and high availability and scalability of the system are realized.

CN113094337BActive Publication Date: 2025-05-13INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110381034.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-09
Publication Date
2025-05-13
Estimated Expiration
2041-04-09

AI Technical Summary

Technical Problem

When traditional distributed storage systems face the requirements of large traffic, high concurrency and low cost, it is difficult to achieve resource isolation and load balancing, resulting in high operation and maintenance costs and poor scalability.

Method used

By implementing resource isolation and load balancing on the coordination server, the target application service sends requests to the coordination server, the coordination server obtains and determines the target application service instance, ensuring that each application service instance independently reads and writes data and realizes resource isolation; at the same time, load balancing is performed by monitoring indicator information to ensure the reasonable allocation of service instances.

Benefits of technology

It realizes resource isolation on the application service instance side, making operation more flexible and easy to control, and at the same time, high availability and scalability of the system are ensured through load balancing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113094337B_ABST
    Figure CN113094337B_ABST
Patent Text Reader

Abstract

The present application relates to the field of Internet big data technology, and specifically discloses a method and device for reading and writing a distributed storage system, wherein the method comprises: a target application service sends a first request to a coordination service end, the target application service is one of multiple application services that have the authority to read and write the distributed storage system, and each application service has multiple corresponding application service instances; in response to the first request, the coordination service end obtains identification information of multiple available application service instances corresponding to the target application service, and determines the target application service instance according to preset rules; the coordination service end sends the identification information of the target application service instance to the target application service; the target application service sends a read and write request to the target application service instance; in response to the read and write request, the target application service instance performs read and write operations on the distributed storage system. The above method can realize resource isolation and multi-instance load balancing on the application service instance side.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet big data technology, and in particular to a method and device for reading and writing a distributed storage system. Background Art

[0002] With the rapid development of big data technology, more and more enterprises are using NoSQL data services based on Hbase as distributed storage systems for structured and semi-structured data. Enterprises usually have multiple applications that need to access storage services. If each application builds an Hbase cluster independently, it will face pressures such as difficult operation and maintenance, low cluster utilization, and difficulty in data sharing. Therefore, building a multi-tenant storage system with simple operation and maintenance, high availability, flexible architecture, and easy access to applications has become an inevitable choice. The traditional monolithic architecture is competent when the amount of data and the number of users are small because there is no decoupling between services. However, when the amount of data and the number of users increase dramatically, problems such as high operation and maintenance costs, poor scalability and fault tolerance often occur, and these problems cannot be solved by simply adding machines. In order to meet the decoupling between services, storage systems usually adopt a microservice architecture. When building a storage system with a microservice architecture, it is necessary to consider requirements such as large traffic, high concurrency, and low cost. It is necessary to ensure the resource isolation of each application and the scalability of the service.

[0003] In order to prevent applications from occupying concurrent resources, the storage system needs to isolate resources for each application to achieve overall service stability. However, traditional resource isolation is usually performed on the cluster side, which is not flexible and difficult to control. At the same time, in order to ensure high availability of services, traditional microservice architectures generally register application service instances with the service registration center. However, each application service instance receives different requests and has different node pressures, and the instance information returned by the service registration center cannot be controlled, so the ideal effect of multi-instance load balancing cannot be achieved.

[0004] To address the above problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method and apparatus for reading and writing a distributed storage system, so as to provide a distributed storage system reading and writing method that realizes resource separation and load balancing.

[0006] An embodiment of the present application provides a method for reading and writing to a distributed storage system, including: a target application service sends a first request to a coordination service end, wherein the target application service is one of multiple application services that have the authority to read and write to the distributed storage system, and each of the multiple application services has corresponding multiple application service instances; in response to the first request, the coordination service end obtains identification information of multiple available application service instances corresponding to the target application service, and determines the target application service instance from the multiple available application service instances according to a preset rule; the coordination service end sends the identification information of the target application service instance to the target application service; the target application service sends a read and write request to the target application service instance based on the identification information of the target application service instance; in response to the read and write request, the target application service instance performs read and write operations on the distributed storage system.

[0007] An embodiment of the present application provides a method for reading and writing to a distributed storage system, which is applied to a coordination service end, and includes: receiving a first request sent by a target application service, wherein the target application service is one of multiple application services that have the authority to read and write to the distributed storage system, and each of the multiple application services has corresponding multiple application service instances; in response to the first request, obtaining identification information of multiple available application service instances corresponding to the target application service; determining a target application service instance from the multiple available application service instances according to a preset rule; and sending the identification information of the target application service instance to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0008] An embodiment of the present application provides a method for reading and writing a distributed storage system, which is applied to a target application service, where the target application service is one of multiple application services that have permission to read and write the distributed storage system, and each of the multiple application services has corresponding multiple application service instances. The method includes: sending a first request to a coordination service end; receiving identification information of a target application service instance corresponding to the target application service returned by the coordination service end in response to the first request; and sending a read and write request to the target application service instance based on the identification information of the target application service instance, so that the target application service instance performs read and write operations on the distributed storage system in response to the read and write request.

[0009] An embodiment of the present application provides a method for reading and writing a distributed storage system, which is applied to a service registration center, wherein the service registration center registers multiple coordination service instances corresponding to a coordination service end and multiple application service instances corresponding to each application service in multiple application services that have the authority to read and write the distributed storage system. The method includes: receiving a third request sent by a target application service, wherein the target application service is one of the multiple application services; in response to the third request, returning identification information of an available coordination service instance to the target application service, so that the target application service sends a first request to the target coordination service instance corresponding to the identification information of the available coordination service instance; receiving a second request sent by the target coordination service instance in response to the first request; in response to the second request, returning identification information of multiple available application service instances corresponding to the target application service to the target coordination service instance, wherein the coordination service instance is used to determine the target application service instance from multiple available application service instances according to a preset rule, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0010] An embodiment of the present application provides an apparatus for reading and writing a distributed storage system, which is located at a coordination service end and includes: a receiving module, which is used to receive a first request sent by a target application service, wherein the target application service is one of multiple application services that have the authority to read and write the distributed storage system, and each of the multiple application services has corresponding multiple application service instances; an acquisition module, which is used to obtain identification information of multiple available application service instances corresponding to the target application service in response to the first request; a determination module, which is used to determine the target application service instance from the multiple available application service instances according to a preset rule; and a sending module, which is used to send the identification information of the target application service instance to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0011] An embodiment of the present application also provides a computer device, including a processor and a memory for storing processor executable instructions, wherein when the processor executes the instructions, the steps of the method for reading and writing a distributed storage system described in any of the above embodiments are implemented.

[0012] An embodiment of the present application also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed, implement the steps of the method for reading and writing a distributed storage system described in any of the above embodiments.

[0013] In an embodiment of the present application, a method for reading and writing to a distributed storage system is provided. Each of a plurality of application services that have permission to read and write to the distributed storage system has a corresponding plurality of application service instances. A target application service among the plurality of application services can send a first request to a coordination server. The coordination server obtains identification information of a plurality of available application service instances corresponding to the target application service in response to the first request, and determines a target application service instance from the plurality of available application service instances according to a preset rule. The coordination server sends the identification information of the target application service instance to the target application service. The target application service sends a read and write request to the target application service instance based on the identification information of the target application service instance. The target application service instance performs read and write operations on the distributed storage system in response to the read and write request. In the above scheme, the functions of reading and writing to the distributed storage system can be encapsulated into a service component. The target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system. By providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easier to control. In addition, by coordinating the server to determine the target application service instance corresponding to the target application service that performs the read and write operations, the service instance that performs the read and write operations can be controlled, thereby realizing the effect of multi-instance load balancing. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. In the drawings:

[0015] Figure 1 A schematic diagram showing an application scenario of a method for reading and writing to a distributed storage system in an embodiment of the present application;

[0016] Figure 2 A flow chart of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0017] Figure 3 A flow chart of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0018] Figure 4 A flow chart of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0019] Figure 5A flow chart of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0020] Figure 6 An interactive schematic diagram of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0021] Figure 7 A flowchart showing the execution principle of the Coordinate service in one embodiment of the present application is shown;

[0022] Figure 8 Shows Figure 7 The working principle flow chart of step S706;

[0023] Fig. 9 A schematic diagram of a device for reading and writing to a distributed storage system in an embodiment of the present application is shown;

[0024] Fig.10 A schematic diagram of a computer device in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0025] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the disclosure of the present application more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0026] Figure 1 Those skilled in the art know that the embodiments of the present application can be implemented as a system, device, method or computer program product. Therefore, the present application can be implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0027] Considering that enterprises and other organizations usually have multiple applications that need to access storage services, and if each application builds an Hbase cluster independently, it will face difficulties in operation and maintenance, low cluster utilization, and difficulty in data sharing. A multi-tenant storage system with simple operation and maintenance, high availability, and flexible architecture can be built to make it easy for applications to access. Based on this, the embodiment of the present application provides a method for reading and writing a distributed storage system. Figure 1 A schematic diagram showing an application scenario of a method for reading and writing to a distributed storage system in an embodiment of the present application is shown.

[0028] Please refer to Figure 1, application A, application B, ... application X are multiple application services that need to access the storage service, that is, multiple application services that have the authority to read and write to the distributed storage system. A set of independent application service instances can be provided for each application service. Figure 1 As shown in , A-server service is a group of application service instances corresponding to application A, B-server service is a group of application service instances corresponding to application B, and X-server service is a group of application service instances corresponding to application X. A-server service, B-server service and X-server service are independent groups of application service instances. Figure 1 As shown, each application service can submit read and write requests to its own application service instance, and perform data read and write operations on the distributed storage system (for example, Hbase cluster) through the application service instance, thereby achieving the purpose of resource isolation on the application service instance side.

[0029] Please continue to refer to Figure 1 , you can deploy application service instances into Docker containers, which can be managed through the Kubernetes container orchestration engine. Kubernetes, referred to as K8S, is a container orchestration engine that can manage containers and provide many functions such as fast container scheduling and elastic scaling. The number of read and write requests that each application service instance can receive is limited in concurrency. When the application read and write business volume increases, the Kubernetes container orchestration engine can be used to conveniently and timely expand the number of service instances for the application service, increase concurrent resources, and meet business needs; when the business volume decreases, the Kubernetes container orchestration engine can be used to conveniently and timely reduce the number of service instances for the application service to save resources, thereby achieving the purpose of dynamically allocating online concurrent resources.

[0030] Figure 2 A flow chart of a method for reading and writing a distributed storage system in an embodiment of the present application is shown. Although the present application provides method operation steps or device structures as shown in the following embodiments or drawings, more or fewer operation steps or module units may be included in the method or device based on routine or no creative labor. In the steps or structures where there is no necessary causal relationship logically, the execution order of these steps or the module structure of the device is not limited to the execution order or module structure described in the embodiments of the present application and shown in the drawings. When the method or module structure is applied to an actual device or terminal product, it can be connected according to the method or module structure shown in the embodiments or drawings for sequential execution or parallel execution (for example, a parallel processor or a multi-threaded processing environment, or even a distributed processing environment).

[0031] Specifically, if Figure 2As shown, a method for reading and writing a distributed storage system provided by an embodiment of the present application may include the following steps.

[0032] Step S201: The target application service sends a first request to the coordination server, wherein the target application service is one of a plurality of application services that have the authority to read and write to the distributed storage system, and each of the plurality of application services has a corresponding plurality of application service instances.

[0033] In this embodiment, the function of reading and writing to the distributed storage system can be encapsulated into a service component. As an access application service of the distributed storage system, the target application service can read and write to the distributed storage system. Each of the multiple application services can have corresponding multiple application service instances. The target application service can send a first request to the coordination server.

[0034] Step S202: In response to the first request, the coordination server obtains identification information of multiple available application service instances corresponding to the target application service, and determines the target application service instance from the multiple available application service instances according to a preset rule.

[0035] Step S203: the coordination server sends the identification information of the target application service instance to the target application service.

[0036] In response to the received first request, the coordination server obtains identification information of multiple available application service instances corresponding to the target application service. The first request may carry the application identification of the target application service. In one embodiment, the coordination server may cache identification information of multiple available application service instances corresponding to each application service. In another embodiment, the coordination server may send a second request to the service registration center. The second request may carry the application identification of the target application service. The service registration center may register multiple application service instances corresponding to each application service in multiple application services. The service registration center may return identification information of multiple available application service instances corresponding to the target application service to the coordination server in response to the second request.

[0037] The coordination server may determine the target application service instance from multiple available application service instances according to a preset rule. For example, the coordination server may randomly determine the target application service instance from multiple available application service instances. For another example, the coordination server may determine the target application service instance in sequence, that is, as the second request is received, the target application service instance is given in a preset order. In determining the target application service instance, the coordination server may send identification information of the target application service instance to the target application service.

[0038] Step S204: the target application service sends a read / write request to the target application service instance based on the identification information of the target application service instance.

[0039] Step S205: In response to the read / write request, the target application service instance performs a read / write operation on the distributed storage system.

[0040] After receiving the identification information of the target application service instance, the target application service can send a read / write request to the target application service instance based on the received identification information. The target application service instance can perform read / write operations on the distributed storage system in response to the read / write request.

[0041] In the above embodiments, the functions of reading and writing to the distributed storage system can be encapsulated into a service component. The target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system. By providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easy to control. In addition, by coordinating the server to determine the target application service instance corresponding to the target application service that performs the read and write operations, the service instance that performs the read and write operations can be controlled, thereby realizing the effect of multi-instance load balancing.

[0042] Please refer to Figure 3 , shows a flow chart of a method for reading and writing to a distributed storage system in one embodiment of the present application. The method in this embodiment can be applied to a coordination server. Figure 3 As shown, a method for reading and writing a distributed storage system provided by an embodiment of the present application may include the following steps.

[0043] Step S301: receiving a first request sent by a target application service, wherein the target application service is one of a plurality of application services that have the authority to read and write to a distributed storage system, and each of the plurality of application services has a corresponding plurality of application service instances.

[0044] Step S302: in response to the first request, obtaining identification information of multiple available application service instances corresponding to the target application service.

[0045] The coordination server may receive a first request sent by a target application service. The target application service, as one of multiple access application services of a distributed storage system, may read and write to the distributed storage system. The functions of reading and writing to the distributed storage system may be encapsulated into a service component. Each of the multiple application services may have a set of application service instances. The first request may carry an application identifier of the target application service. The coordination server may obtain identification information of multiple available application service instances corresponding to the target application service in response to the received first request.

[0046] Step S303: determining a target application service instance from a plurality of available application service instances according to a preset rule.

[0047] Step S304: sending the identification information of the target application service instance to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0048] The coordination server can determine the target application service instance from multiple available application service instances according to preset rules. For example, the coordination server can randomly determine the target application service instance from multiple available application service instances. For another example, the coordination server can determine the target application service instance in sequence, that is, with the received second request, the target application service instance is given in a preset order. In determining the target application service instance, the coordination server can send the identification information of the target application service instance to the target application service. After receiving the identification information of the target application service instance, the target application service can send a read and write request to the target application service instance based on the received identification information. The target application service instance can perform read and write operations on the distributed storage system in response to the read and write requests.

[0049] In the above embodiments, the functions of reading and writing to the distributed storage system can be encapsulated into a service component. The target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system. By providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easy to control. In addition, by coordinating the server to determine the target application service instance corresponding to the target application service that performs the read and write operations, the service instance that performs the read and write operations can be controlled, thereby realizing the effect of multi-instance load balancing.

[0050] In some embodiments of the present application, in response to a first request, obtaining identification information of multiple available application service instances corresponding to a target application service may include: sending a second request to a service registration center in response to the first request, wherein the service registration center registers multiple application service instances corresponding to each of the multiple application services; and receiving identification information of multiple available application service instances corresponding to the target application service returned by the service registration center in response to the second request.

[0051] In response to the first request, the coordination server may send a second request to the service registration center. The second request may carry the application identifier of the target application service. The service registration center may register multiple application service instances corresponding to each of the multiple application services. In response to the second request, the service registration center may determine the identification information of the multiple available application services corresponding to the target application service, and return the identification information of the multiple available application service instances corresponding to the target application service to the coordination server. By registering the application service instances corresponding to each of the multiple application services to the registration center, the identification information of the multiple available application service instances corresponding to the target application service can be obtained from the registration center.

[0052] In some embodiments of the present application, the method may further include: periodically sending a fourth request to the service registration center; receiving identification information of multiple available application service instances corresponding to each of the multiple application services returned by the service registration center in response to the fourth request; and caching the identification information of multiple available application service instances corresponding to each of the multiple application services locally.

[0053] After the coordination service is initialized after startup, it can obtain information of multiple application service instances corresponding to each application service in multiple application services from the service registration center and cache it locally. After that, it can be updated every preset time (for example, 1 minute, 5 minutes). If the update fails, the identification information of the previous application service instance is still cached. Specifically, the coordination service can send a fourth request to the service registration center at regular intervals. In response to the fourth request, the service registration center returns identification information of multiple available application service instances corresponding to each application service in multiple application services to the coordination service. After the coordination service receives the identification information of multiple available application service instances corresponding to each application service in multiple application services returned by the service registration center, it caches it locally to achieve regular updates. Correspondingly, in the case where the coordination service fails to send the second request to the service registration center, the identification information of multiple available application services corresponding to the target application can be obtained from the local cache. In the above manner, the identification information of multiple available application service instances corresponding to the target application can still be obtained in the case of a connection failure between the coordination service and the service registration center.

[0054] In some embodiments of the present application, determining a target application service instance from multiple available application service instances according to preset rules may include: obtaining monitoring indicator information of each available application service instance among multiple available application service instances corresponding to the target application; and determining the target application service instance from multiple available application service instances according to the monitoring indicator information of each available application service instance.

[0055] Specifically, the coordination server can obtain the monitoring indicator information of each service instance in the multiple available application service instances corresponding to the target application service. In one embodiment, the multiple application service instances are deployed in a containerized manner and managed by a container orchestration engine, and the container orchestration engine can be used to monitor the monitoring indicator information of each application service instance in the multiple application service instances. The coordination server can obtain the monitoring indicator information of each instance in the multiple available application service instances corresponding to the target application service from the container orchestration engine.

[0056] In one embodiment, the monitoring indicator information may include at least one of the following: CPU utilization, memory, IO and other indicator information. For example, the coordination server can calculate and return the server information that best meets the requirements according to custom rules. For example, the CPU utilization, memory, IO and other indicators in the monitoring indicators are calculated and added according to a custom ratio, and the IP and port of the service instance with the largest or smallest value are returned. For another example, the coordination server can sort the service instances according to a single indicator, such as returning the identification information of the service instance with the lowest CPU utilization or returning the identification information of the service instance with the largest available memory. In the above manner, the service instance with the best performance can be returned to execute the read and write operations of the distributed storage system, so as to achieve the purpose of multi-instance load balancing.

[0057] Please refer to Figure 4 , shows a flow chart of a method for reading and writing to a distributed storage system in one embodiment of the present application. The method in this embodiment is applied to a target application service, which is one of multiple application services that have the authority to read and write to the distributed storage system, and each of the multiple application services has corresponding multiple application service instances. Figure 4 As shown, a method for reading and writing a distributed storage system provided by an embodiment of the present application may include the following steps.

[0058] Step S401: Send a first request to the coordination server.

[0059] In this embodiment, the function of reading and writing to the distributed storage system can be encapsulated into a service component. As an access application service of the distributed storage system, the target application service can read and write to the distributed storage system. Each of the multiple application services can have corresponding multiple application service instances. The target application service can send a first request to the coordination server. The first request can carry an application identifier of the target application service.

[0060] Step S402: receiving identification information of a target application service instance corresponding to the target application service returned by the coordination server in response to the first request.

[0061] In response to the received first request, the coordination server obtains identification information of multiple available application service instances corresponding to the target application service. The first request may carry the application identification of the target application service. In one embodiment, the coordination server may cache identification information of multiple available application service instances corresponding to each application service. In another embodiment, the coordination server may send a second request to the service registration center. The second request may carry the application identification of the target application service. The service registration center may register multiple application service instances corresponding to each application service in multiple application services. The service registration center may return identification information of multiple available application service instances corresponding to the target application service to the coordination server in response to the second request.

[0062] The coordination server can determine the target application service instance from multiple available application service instances according to preset rules. For example, the coordination server can randomly determine the target application service instance from multiple available application service instances. For another example, the coordination server can determine the target application service instance in sequence, that is, with the received second request, the target application service instance is given in a preset order. For another example, the coordination server can obtain the monitoring indicator information of each available application service instance among multiple available application service instances, and determine the target application service instance from multiple available application service instances based on the monitoring indicator information of each available application service instance. The target application service can receive the identification information of the target application service instance corresponding to the target application service returned by the coordination server in response to the first request.

[0063] Step S403: Send a read / write request to the target application service instance based on the identification information of the target application service instance, so that the target application service instance performs a read / write operation on the distributed storage system in response to the read / write request.

[0064] After receiving the identification information of the target application service instance, the target application service can send a read / write request to the target application service instance based on the received identification information. The target application service instance can perform read / write operations on the distributed storage system in response to the read / write request.

[0065] In the above embodiments, the functions of reading and writing to the distributed storage system can be encapsulated into a service component. The target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system. By providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easy to control. In addition, by coordinating the server to determine the target application service instance corresponding to the target application service that performs the read and write operations, the service instance that performs the read and write operations can be controlled, thereby realizing the effect of multi-instance load balancing.

[0066] In some embodiments of the present application, the coordination server has multiple coordination service instances; accordingly, sending a first request to the coordination server may include: sending a third request to a service registration center, wherein the service registration center has multiple coordination service instances registered; receiving identification information of the available coordination service instance returned by the service registration center in response to the third request; and sending the first request to the target coordination service instance corresponding to the identification information of the available coordination service instance.

[0067] Specifically, the coordination service end can be set to multi-instance deployment, that is, the coordination service end has multiple coordination service instances. Multiple coordination service instances can be registered in the service registration center. The target application service can send a third request to the service registration center. The service registration center can determine the available or surviving coordination service instance in response to the third request, and return the identification information of the available coordination service instance to the target application service. In the case where there are multiple coordination service instances in stock, the service registration center can return the identification information of one of them to the target application service. The target application service can send a first request to the target coordination service instance corresponding to the received identification information of the available coordination service instance to obtain the identification information of the corresponding target application service instance. In the above embodiment, by setting the coordination service end to multi-instance deployment, single node failure can be prevented.

[0068] In some embodiments of the present application, multiple application service instances are deployed in a containerized manner and managed by a container orchestration engine. The container orchestration engine is used to monitor monitoring indicator information of each application service instance in the multiple application service instances, and expand or reduce the capacity of each application service instance in the multiple application service instances based on the monitoring indicator information.

[0069] Specifically, multiple application service instances can be deployed into containers and managed through the container orchestration engine. The number of concurrent read and write requests that each application service instance can receive is limited. When the application read and write business volume increases, the container orchestration engine can conveniently and timely expand the number of service instances for the application, increase concurrent resources, and meet business needs; when the business volume decreases, the number of service instances can be reduced in a timely manner to save resources, thereby achieving the purpose of dynamically allocating online concurrent resources.

[0070] Please refer to Figure 5 , shows a flow chart of a method for reading and writing to a distributed storage system in one embodiment of the present application. Figure 5 As shown, a method for reading and writing a distributed storage system provided by an embodiment of the present application may include the following steps.

[0071] Step S501: receiving a third request sent by a target application service, wherein the target application service is one of a plurality of application services.

[0072] The method in this embodiment is applied to a service registration center, which registers multiple coordination service instances corresponding to the coordination server and multiple application service instances corresponding to each application service in multiple application services that have the authority to read and write to the distributed storage system. Each application service instance and coordination service instance can be registered in the service registration center after startup, so that the service registration table of the service registration center will store information on all application service instances and coordination service instances. If a service instance does not send a heartbeat to the service registration center within the default time, the registration service center will delete the service instance from the application registration service list and only retain the available service instances. The service registration center can receive a third request sent by a target application service among multiple application services.

[0073] Step S502: in response to the third request, return the identification information of the available coordination service instance to the target application service, so that the target application service sends a first request to the target coordination service instance corresponding to the identification information of the available coordination service instance.

[0074] The service registration center may return the identification information of the available coordination service instance to the target application service in response to the third request. The target application service sends a first request to the corresponding target coordination service instance based on the received identification information of the available coordination service instance.

[0075] Step S503: receiving a second request sent by the target coordination service instance in response to the first request.

[0076] Step S504, in response to the second request, returns identification information of multiple available application service instances corresponding to the target application service to the target coordination service instance, and the target coordination service instance is used to determine the target application service instance from the multiple available application service instances according to preset rules, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0077] After receiving the first request, the target coordination service instance sends a second request to the service registration center. In response to the second request, the service registration center can obtain the identification information of multiple available application service instances corresponding to the target application service from the service registration list, and return it to the target coordination service instance. After receiving the identification information of multiple available application service instances, the target coordination service instance can determine the target application service instance from multiple available application service instances according to a preset rule. For example, the target coordination service instance can randomly determine the target application service instance from multiple available application service instances. For another example, the target coordination service instance can determine the target application service instance in sequence, that is, with the received second request, the target application service instance is given in a preset order. For another example, the target coordination service instance can obtain the monitoring indicator information of each available application service instance in multiple available application service instances, and determine the target application service instance from multiple available application service instances according to the monitoring indicator information of each available application service instance. In determining the target application service instance, the target coordination service instance can send the identification information of the target application service instance to the target application service.

[0078] After receiving the identification information of the target application service instance, the target application service can send a read / write request to the target application service instance based on the received identification information. The target application service instance can perform read / write operations on the distributed storage system in response to the read / write request.

[0079] In the above embodiment, the function of reading and writing to the distributed storage system can be encapsulated into a service component. The target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system. By providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easier to control. In addition, by registering multiple application service instances and multiple coordination service instances to the service registration center, the information of available application service instances and available coordination service instances can be maintained for easy acquisition. Furthermore, setting the coordination service end to multi-instance deployment can prevent single node failures.

[0080] Reference below Figures 6 to 8 The above method is described in conjunction with a specific embodiment. However, it is worth noting that the specific embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application.

[0081] The method in this specific embodiment can apply the following technologies:

[0082] 1) Kubernetes container orchestration service. Kubernetes can manage containers and provide many functions such as fast container scheduling and elastic scaling. This embodiment mainly uses the Horizontal Pod Autoscaling function of Kubernetes. By deploying the Server service to the container, Kubernetes automatically expands and shrinks the Server instance based on the container CPU utilization and monitored transaction volume and other indicators.

[0083] 2) Eureka Registry. Eureka is an open source framework that is mainly used to locate intermediate services running in the process management platform to achieve the purpose of load balancing and middle-tier service failover. This embodiment mainly uses Eureka's registration and service discovery capabilities. Each Server service instance will be registered in Eureka after startup, so that the service registry in Eureka will store information about all available application service nodes. If a Server service instance does not send a heartbeat to Eureka for more than the default time, Eureka will delete the service instance from the application registration service list.

[0084] 3) The coordinate service custom rule algorithm is used to obtain a list of all available service instances from Eureka, and then to monitor the indicator information of each service instance collected, and to calculate and return the server information that best meets the requirements according to the custom rules. For example, the CPU utilization, memory, IO and other indicators in the monitoring indicators are calculated and added according to the custom ratio, and the IP and port of the service instance with the largest or smallest value is returned.

[0085] In this specific embodiment, the method for reading and writing a distributed storage system involves a client service (i.e., the application service mentioned above), a Coordinate service (i.e., the coordination server mentioned above), and a Server service (i.e., the application service instance mentioned above). The client service is responsible for initiating requests to read and write the Hbase database (distributed storage system), including obtaining an available Coordinate service from Eureka, obtaining an available Server service IP and port from the Coordinate service, and issuing read and write requests to the Server service. The Coordinate service is responsible for obtaining a list of available Server services for the application from Eureka, and returning the address of a Server service with the best performance according to custom rules. The Server service is responsible for connecting to the Hbase cluster and performing online reading and writing of the Hbase database.

[0086] Please refer to Figure 6 , shows an interactive schematic diagram of a method for reading and writing to a distributed storage system in an embodiment of the present application. Figure 6 As shown, the method may include the following steps.

[0087] Step S601: After starting, the Server service instance and the Coordinate service instance register themselves with Eureka.

[0088] Step S602: The client sends a request to Eureka to obtain an available Coordinate service instance. The Coordinate service instance is deployed as multiple instances to prevent single node failure.

[0089] Step S603: Eureka returns the available Coordinate service instance information to the client, such as IP and port.

[0090] Step S604: The client sends a request to the available Coordinate service instance to obtain the available Server instance information, such as the IP and port of the Server instance.

[0091] Step S605: After receiving the client request, the Coordinate service obtains all Server instance information under the application name from Eureka.

[0092] Step S606: Eureka returns all surviving Server instances in the application service name registration list to the Coordinate service.

[0093] Step S607: Coordinate returns the Server service instance information with the best value after calculation according to the custom rule.

[0094] Step S608: The client sends an http read / write request to the acquired Server service instance.

[0095] Step S609: The Server service instance that receives the read / write request performs read / write operations on the Hbase database according to the command in the request.

[0096] Step S610: The Server service instance returns the execution result of the read and write operations to the client.

[0097] Please refer to Figure 7 , showing a flowchart of the Coordinate service execution principle in an embodiment of the present application.

[0098] Step S701: After the Coordinate service is started, it is initialized and the Server instance information of all applications is obtained from Eureka and cached locally. It is then updated every 1 minute. If the update fails, the previous instance information is still cached.

[0099] Step S702: After receiving the client request, the Coordinate service sends an http request to Eureka to obtain the Server instance information to which the application belongs.

[0100] Step S703: Determine whether the request is sent successfully. If it is sent successfully, execute step S704; if it fails, execute step S705.

[0101] Step S704: Determine whether there is Server service instance information in Eureka. If so, execute step S706; otherwise, execute step S707.

[0102] Step S705: Determine whether the Server service instance information under the application service exists in the cache. If so, execute step S706; otherwise, execute step S707.

[0103] Step S706: Coordinate returns the IP and port of the Server service instance calculated according to the custom rule.

[0104] Step S707: Coordinate returns relevant error information.

[0105] Please refer to Figure 8 , showing Figure 7 Flow chart of the working principle of step S706.

[0106] Step S801: Coordinate obtains the Server service instance list of the application to which it belongs. If there are multiple Server service instance information in the list, proceed to the subsequent steps, otherwise return directly.

[0107] Step S802: Obtain indicator information of each server from the monitoring module, such as CPU usage, remaining memory size, and network status.

[0108] Step S803: Calculate the indicator information of each Server service instance according to the custom function. First, convert the value of each indicator into [0,1] for normalization. The normalized value is: (the original value of the indicator - the minimum value of the indicator) / (the maximum value of the indicator - the minimum value of the indicator). Then multiply each indicator by the custom ratio and add them together. For example, if the amount of data in each piece of information in the read and write request is large, the memory requirement is relatively high, and the timeliness requirement is relatively low, then the available CPU indicator ratio can be set to 30%, the available memory ratio to 50%, and the remaining indicator ratio to 20%. The obtained value is the Server instance information with the lowest load that best meets the application requirements.

[0109] Step S804: Return the IP and port number of the Server service instance with the best value calculated in step S803 to the client.

[0110] In the above embodiment, by encapsulating the functions of reading and writing Hbase into a Server service component, a set of independent Server service instances is provided for each access application. The application reads and writes data by submitting requests to its own instance, thereby achieving the purpose of resource isolation on the Server instance side. At the same time, the Server instance is deployed in a Docker container and managed by the Kubernetes container orchestration engine. The number of read and write requests that each Server service instance can receive is limited in concurrency. When the application read and write business volume increases, the Kubernetes container orchestration engine can conveniently and timely expand the number of service instances for the application, increase concurrent resources, and meet business needs; when the business volume decreases, the number of service instances is reduced in time to save resources, thereby achieving the purpose of dynamically allocating online concurrent resources. Finally, the self-developed Coordinate service returns a list of servers with the best performance according to custom rules to achieve multi-instance load balancing.

[0111] Based on the same inventive concept, an apparatus for reading and writing a distributed storage system is also provided in an embodiment of the present application, which is located at the coordination service end, as described in the following embodiments. Since the principle of solving the problem by the apparatus for reading and writing a distributed storage system is similar to that of the method for reading and writing a distributed storage system, the implementation of the apparatus for reading and writing a distributed storage system can refer to the implementation of the method for reading and writing a distributed storage system, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived. Fig. 9 is a structural block diagram of a device for reading and writing to a distributed storage system according to an embodiment of the present application, such as Fig. 9 As shown, it includes: a receiving module 901, an acquiring module 902, a determining module 903 and a sending module 904. The structure is described below.

[0112] The receiving module 901 is used to receive a first request sent by a target application service, wherein the target application service is one of multiple application services that have the authority to read and write to the distributed storage system, and each of the multiple application services has corresponding multiple application service instances.

[0113] The acquisition module 902 is used to acquire identification information of multiple available application service instances corresponding to the target application service in response to the first request.

[0114] The determination module 903 is used to determine a target application service instance from multiple available application service instances according to a preset rule.

[0115] The sending module 904 is used to send the identification information of the target application service instance to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

[0116] From the above description, it can be seen that the embodiments of the present application achieve the following technical effects: the functions of reading and writing to the distributed storage system can be encapsulated into a service component, and the target application service, as the access application service of the distributed storage system, can read and write to the distributed storage system, and by providing a set of independent application service instances for each of the multiple application services that have the authority to read and write to the distributed storage system, each application service can read and write data by submitting a request to its own application service instance, thereby realizing resource isolation on the application service instance side. Compared with the traditional resource isolation on the cluster side, realizing resource isolation on the application service instance side is more flexible and easy to control. In addition, by coordinating the server to determine the target application service instance corresponding to the target application service that performs the read and write operations, the service instance that performs the read and write operations can be controlled, thereby realizing the effect of multi-instance load balancing.

[0117] The present application also provides a computer device, which can be found in Fig.10 The computer device structure diagram of the method for reading and writing to a distributed storage system provided in an embodiment of the present application is shown, and the computer device may specifically include an input device 11, a processor 12, and a memory 13. Among them, the memory 13 is used to store processor executable instructions. When the processor 12 executes the instructions, the steps of the method for reading and writing to a distributed storage system described in any of the above embodiments are implemented.

[0118] In this embodiment, the input device may specifically be one of the main devices for information exchange between the user and the computer system. The input device may include a keyboard, a mouse, a camera, a scanner, a light pen, a handwriting input board, a voice input device, etc.; the input device is used to input the original data and the program for processing these numbers into the computer. The input device can also obtain and receive data transmitted from other modules, units, and devices. The processor can be implemented in any appropriate manner. For example, the processor can take the form of a computer-readable medium, a logic gate, a switch, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable logic controller, and an embedded microcontroller, etc., such as a microprocessor or a processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro) processor. The memory may specifically be a memory device used to store information in modern information technology. The memory may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function without a physical form is also called a memory, such as a RAM, a FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, a TF card, etc.

[0119] In this embodiment, the functions and effects specifically realized by the computer device can be explained in comparison with other embodiments and will not be described in detail here.

[0120] In an embodiment of the present application, a computer storage medium based on a method for reading and writing a distributed storage system is also provided, wherein the computer storage medium stores computer program instructions, and when the computer program instructions are executed, the steps of the method for reading and writing a distributed storage system described in any of the above embodiments are implemented.

[0121] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD) or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.

[0122] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other embodiments and will not be repeated here.

[0123] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0124] It should be understood that the above description is for illustration and not for limitation. By reading the above description, many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art. Therefore, the scope of the present application should not be determined with reference to the above description, but should be determined with reference to the aforementioned claims and the full scope of equivalents possessed by these claims.

[0125] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for reading and writing a distributed storage system, characterized in that: include: The target application service sends a first request to the coordination server, wherein the target application service is one of a plurality of application services that have the authority to read and write the distributed storage system, and each of the plurality of application services has a corresponding plurality of application service instances; In response to the first request, the coordination service end obtains identification information of multiple available application service instances corresponding to the target application service, and determines the target application service instance from the multiple available application service instances according to a preset rule; The coordination service end sends the identification information of the target application service instance to the target application service; The target application service sends a read / write request to the target application service instance based on the identification information of the target application service instance; In response to the read / write request, the target application service instance performs a read / write operation on the distributed storage system.

2. A method for reading and writing a distributed storage system, characterized in that: Applied to the coordination server, including: Receiving a first request sent by a target application service, wherein the target application service is one of a plurality of application services that have permission to read and write the distributed storage system, and each of the plurality of application services has a corresponding plurality of application service instances; In response to the first request, obtaining identification information of multiple available application service instances corresponding to the target application service; Determine a target application service instance from the multiple available application service instances according to a preset rule; The identification information of the target application service instance is sent to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

3. The method according to claim 2, characterized in that In response to the first request, obtaining identification information of multiple available application service instances corresponding to the target application service includes: In response to the first request, sending a second request to a service registration center, wherein the service registration center has registered a plurality of application service instances corresponding to each of the plurality of application services; Receive identification information of multiple available application service instances corresponding to the target application service returned by the service registration center in response to the second request.

4. The method according to claim 3, characterized in that Also includes: Sending a fourth request to the service registration center at a regular interval; receiving identification information of multiple available application service instances corresponding to each of the multiple application services returned by the service registration center in response to the fourth request; The identification information of the multiple available application service instances corresponding to each application service in the multiple application services is cached locally.

5. The method according to claim 2, characterized in that: Determining a target application service instance from the multiple available application service instances according to a preset rule includes: Obtaining monitoring indicator information of each available application service instance among multiple available application service instances corresponding to the target application; According to the monitoring indicator information of each available application service instance, a target application service instance is determined from the multiple available application service instances.

6. A method for reading and writing a distributed storage system, characterized in that: Applied to a target application service, the target application service being one of a plurality of application services having permission to read and write the distributed storage system, each of the plurality of application services having a corresponding plurality of application service instances, the method comprising: Sending a first request to the coordination server; the first request carries an application identifier of the target application service; receiving identification information of a target application service instance corresponding to an application identification of the target application service returned by the coordination server in response to the first request; Based on the identification information of the target application service instance, a read / write request is sent to the target application service instance, so that the target application service instance performs a read / write operation on the distributed storage system in response to the read / write request.

7. The method according to claim 6, characterized in that The coordination service end has multiple coordination service instances; Accordingly, a first request is sent to the coordination server, including: Sending a third request to a service registration center, wherein the service registration center has registered the multiple coordination service instances; Receiving identification information of an available coordination service instance returned by the service registration center in response to the third request; A first request is sent to a target coordination service instance corresponding to the identification information of the available coordination service instance.

8. According to the method of claim 6, the multiple application service instances are deployed in a containerized manner and managed by a container orchestration engine, and the container orchestration engine is used to monitor monitoring indicator information of each application service instance in the multiple application service instances, and expand or reduce the capacity of each application service instance in the multiple application service instances according to the monitoring indicator information.

9. A method for reading and writing a distributed storage system, characterized in that: Applied to a service registration center, the service registration center registers multiple coordination service instances corresponding to the coordination server and multiple application service instances corresponding to each application service in multiple application services that have the authority to read and write the distributed storage system, the method comprising: receiving a third request sent by a target application service, wherein the target application service is one of the multiple application services; In response to the third request, returning the identification information of the available coordination service instance to the target application service, so that the target application service sends a first request to the target coordination service instance corresponding to the identification information of the available coordination service instance; receiving a second request sent by the target coordination service instance in response to the first request; In response to the second request, identification information of multiple available application service instances corresponding to the target application service is returned to the target coordination service instance, and the target coordination service instance is used to determine the target application service instance from the multiple available application service instances according to preset rules, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

10. A device for reading and writing a distributed storage system, characterized in that: Located on the coordination server, including: A receiving module, configured to receive a first request sent by a target application service, wherein the target application service is one of a plurality of application services that have the authority to read and write the distributed storage system, and each of the plurality of application services has a corresponding plurality of application service instances; an acquisition module, configured to acquire, in response to the first request, identification information of a plurality of available application service instances corresponding to the target application service; A determination module, configured to determine a target application service instance from the plurality of available application service instances according to a preset rule; The sending module is used to send the identification information of the target application service instance to the target application service, so that the target application service performs read and write operations on the distributed storage system through the target application service instance.

11. A computer device, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 2 to 5 when executing the instructions.

12. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed, the steps of the method according to any one of claims 2 to 5 are implemented.

Citation Information

Patent Citations

  • A service discovery and client load balancing method based on a service registration center

    CN109257440A

  • Remote procedure call method and device

    CN112114979A