Data sharing method, device, equipment and computer readable storage medium
By preconfiguring data receiving cluster services and protocol services, parallel sharing and parallel calling are achieved, which solves the problems of reduced performance and high complexity of business systems in the existing technology, and improves system performance and reliability.
Patent Information
- Application Number
- CN202210663453.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The existing RPC or RestAPI point-to-point synchronization method and MQ message queue asynchronous method have problems of performance degradation and high complexity in the business system. Especially when the downstream services change, the upstream business processing is not friendly, which can easily lead to system performance degradation and interruption. .
By pre-configuring data receiving cluster services and their corresponding available protocol services, parallel sharing of data to be shared is achieved, using thread pools to call multiple servers in parallel, supporting RPC and HTTP protocol services, and retrying and logging when calls fail. , adjust the number of servers to improve system performance.
It reduces the intrusion and complexity of the business, improves system performance and response speed, avoids server call failures due to network status, and extends server life.
Smart Images

Figure CN115037731B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a data sharing method, device, equipment and computer-readable storage medium. Background Art
[0002] There are two ways of communication between services in most business systems: one is a point-to-point synchronous method such as RPC (Remote Procedure Call) or RestAPI; the other is an asynchronous method such as MQ (Message Queue).
[0003] Both of the above methods have certain disadvantages. First, if point-to-point synchronization methods such as RPC or RestAPI are used, the upstream business service (i.e., data publishing cluster service) needs to traverse all downstream service (i.e., data receiving cluster service) requests, which is not friendly to upstream business processing. Changes in downstream services will affect upstream business. The more downstream services there are, the more upstream calls there are, which will lead to reduced system performance, reduced response speed and throughput, and prone to interruption problems, which will affect the overall business. Secondly, if the MQ asynchronous method is used, it is also necessary to clarify the downstream service queue before deployment, and traverse to send event messages to all queues. It is necessary to modify the code to implement the configuration between the downstream service and the upstream business service, and restart the system to complete the docking of the downstream service and the upstream business service, which increases the business complexity and intrusiveness to the upstream business. Summary of the invention
[0004] An object of the present invention is to provide a data sharing method, which reduces the intrusiveness of the business, reduces the complexity of business implementation, and improves system performance; another object of the present invention is to provide a data sharing device, equipment and computer-readable storage medium.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] A data sharing method, comprising:
[0007] receiving data to be shared;
[0008] Acquire each preconfigured data receiving cluster service and the available protocol service corresponding to each of the data receiving cluster services;
[0009] Sharing the to-be-shared data to each of the data receiving cluster services in parallel according to each of the available protocol services;
[0010] Each data receiving cluster service includes at least one server.
[0011] In a specific implementation of the present invention, receiving data to be shared includes:
[0012] Receive a message queue message sent by a data publishing cluster service; wherein the message queue message is a message obtained by encapsulating the data to be shared and the publisher identification information of the data publishing cluster service;
[0013] Acquiring each pre-configured data receiving cluster service and the available protocol services corresponding to each of the data receiving cluster services, including:
[0014] According to the publisher identification information, the pre-configured data receiving cluster services and the available protocol services respectively corresponding to the data receiving cluster services are acquired.
[0015] In a specific implementation of the present invention, sharing the to-be-shared data in parallel to each of the data receiving cluster services according to each of the available protocol services includes:
[0016] Calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services to obtain each target server;
[0017] For each target server, call the corresponding thread from the thread pool;
[0018] The data to be shared is shared to each of the target servers in parallel through each of the threads.
[0019] In a specific implementation of the present invention, calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services includes:
[0020] The servers in the data receiving cluster services are called in parallel and averagely according to the available protocol services; wherein the available protocol services are RPC protocol services and / or HTTP protocol services.
[0021] In a specific implementation of the present invention, after calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services, the method further includes:
[0022] When it is detected that there is a server to which the call fails, a retry call is made to the server to which the call fails.
[0023] In a specific implementation of the present invention, after calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services, the method further includes:
[0024] Performs server call logging.
[0025] In a specific embodiment of the present invention, it also includes:
[0026] Parsing the received data receiving cluster service adjustment request to obtain the target data receiving cluster service to be adjusted;
[0027] An adjustment operation is performed on the number of servers in the target data receiving cluster service.
[0028] A data sharing device, comprising:
[0029] A data receiving module, used for receiving data to be shared;
[0030] A protocol service acquisition module, used to acquire each pre-configured data receiving cluster service and the available protocol services corresponding to each of the data receiving cluster services;
[0031] A data sharing module is used to share the to-be-shared data in parallel to each of the data receiving cluster services according to each of the available protocol services; wherein each of the data receiving cluster services includes at least one server.
[0032] A data sharing device, comprising:
[0033] Memory for storing computer programs;
[0034] A processor is used to implement the steps of the data sharing method as described above when executing the computer program.
[0035] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data sharing method described above are implemented.
[0036] A computer program product comprises a computer program, wherein the computer program implements the steps of the data sharing method as described above when executed by a processor.
[0037] The data sharing method provided by the present invention receives data to be shared; obtains pre-configured data receiving cluster services and available protocol services corresponding to each data receiving cluster service; shares the data to be shared in parallel to each data receiving cluster service according to each available protocol service; wherein each data receiving cluster service includes at least one server.
[0038] It can be seen from the above technical solution that each data receiving cluster service that needs to receive the data to be shared and the available protocol services corresponding to each data receiving cluster service are pre-configured. After receiving the data to be shared sent by the data publishing cluster service, the data to be shared are shared in parallel to each data receiving cluster service according to each available protocol service. By pre-configuring each data receiving cluster service and the available protocol services corresponding to each data receiving cluster service, calling the available protocol services corresponding to each data receiving cluster service to share the data to be shared to each data receiving cluster service, the parallel sharing of the data to be shared to multiple data receiving cluster services is realized, which reduces the intrusiveness of the business, reduces the complexity of business implementation, and improves system performance.
[0039] Correspondingly, the present invention also provides a data sharing device, equipment and computer-readable storage medium corresponding to the above-mentioned data sharing method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A flowchart of an implementation of a data sharing method in an embodiment of the present invention;
[0042] Figure 2 Another implementation flow chart of the data sharing method in the embodiment of the present invention;
[0043] Figure 3 This is an architecture diagram of a data sharing system in an embodiment of the present invention;
[0044] Figure 4 is a timing diagram of a data sharing method in an embodiment of the present invention;
[0045] Figure 5 Another implementation flow chart of the data sharing method in the embodiment of the present invention;
[0046] Figure 6 is a structural block diagram of a data sharing device in an embodiment of the present invention;
[0047] Figure 7 A structural block diagram of a data sharing device in an embodiment of the present invention;
[0048] Figure 8 A schematic diagram of the specific structure of a data sharing device provided in this embodiment. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0050] See also Figure 1 , Figure 1 This is an implementation flow chart of a data sharing method in an embodiment of the present invention. The method may include the following steps:
[0051] S101: receiving data to be shared.
[0052] A cluster grouping service is pre-set between the data publishing cluster service and the data receiving cluster service. When the data publishing cluster service needs to share data with one or more data receiving cluster services, the data to be shared is sent to the cluster grouping service. The cluster grouping service receives the data to be shared.
[0053] The data to be shared can be any data that needs to be shared by the data publishing cluster service.
[0054] The data publishing cluster service and the data receiving cluster service both contain at least one server. Each server in the cluster can be considered equal, and any server can respond to user requests independently. The use of clusters can improve the system's responsiveness.
[0055] The cluster grouping service and the data publishing cluster service can transmit data through the message queue middleware, and the cluster grouping service and the data receiving cluster service can communicate through the available protocol services (such as RPC protocol service, HTTP protocol service, etc.) provided by the data receiving cluster service.
[0056] S102: Acquire pre-configured data receiving cluster services and available protocol services corresponding to the data receiving cluster services.
[0057] The cluster grouping service can determine the data receiving cluster service (i.e., the subscriber) of the data to be shared in advance according to the subscription status of the data to be shared published by the data publishing cluster service, and search for the available protocol services of each data receiving cluster service. According to the search results, each data receiving cluster service and the available protocol services corresponding to each data receiving cluster service are pre-configured.
[0058] The available protocol service corresponding to the data receiving cluster service may include only one specific protocol service. In this case, the data transmission protocol subsequently used by the data receiving cluster service with the cluster grouping service is the specific protocol service. For example, when the available protocol service corresponding to a data receiving cluster service includes only the RPC protocol service, it is determined that the data transmission protocol subsequently used by the data receiving cluster service with the cluster grouping service is the RPC protocol service; when the available protocol service corresponding to a data receiving cluster service includes only the HTTP protocol service, it is determined that the data transmission protocol subsequently used by the data receiving cluster service with the cluster grouping service is the HTTP protocol service. The available protocol service corresponding to the data receiving cluster service may also include multiple protocol services. In this case, the data transmission protocol subsequently used by the data receiving cluster service with the cluster grouping service may be selected from multiple available protocol services, such as the priorities of multiple available protocol services may be pre-set, and the final data transmission protocol may be selected from each available protocol service according to the preset priority. For example, when the available protocol service corresponding to a data receiving cluster service includes the RPC protocol service and the HTTP protocol service, the priority of the RPC protocol service is pre-set to be higher than the HTTP protocol service, and the data transmission protocol finally selected is the RPC protocol service.
[0059] S103: Sharing the to-be-shared data to each data receiving cluster service in parallel according to each available protocol service.
[0060] Each data receiving cluster service includes at least one server.
[0061] After obtaining the pre-configured data receiving cluster services and the available protocol services corresponding to each data receiving cluster service, the data to be shared is shared in parallel to each data receiving cluster service according to each available protocol service. For example, by calling each server in each data receiving cluster service in parallel according to each available protocol service, the data to be shared from the data publishing cluster service to each data receiving cluster service is shared. This solves the problem of parallel protocol service calls in a multi-cluster environment and improves the processing power and response speed of the system. Different data receiving cluster services can consume the same data to be shared (i.e., collaborative events) in parallel, and each data receiving cluster service does not affect each other. This reduces the intrusiveness of the business and the complexity of business implementation. Subscribers can dynamically subscribe to publisher events online and consume them in real time. The publisher does not need to pay attention to which subscribers have subscribed to the event. Both the publisher and the subscriber only need to pay attention to the processing of the business logic of the collaborative event itself.
[0062] In a specific implementation of the present invention, step S103 may include the following steps:
[0063] Step 1: Call each server in each data receiving cluster service in parallel according to each available protocol service to obtain each target server;
[0064] Step 2: For each target server, retrieve the corresponding thread from the thread pool;
[0065] Step 3: Share the data to be shared to each target server in parallel through each thread.
[0066] For the convenience of description, the above three steps can be combined for explanation.
[0067] Each data receiving cluster service contains one or more servers. After obtaining the pre-configured data receiving cluster services and the available protocol services corresponding to each data receiving cluster service, each server in each data receiving cluster service is called in parallel according to each available protocol service to obtain each target server. A thread pool is pre-set, and the thread pool contains multiple threads. For each target server, the corresponding idle thread is called from the thread pool, and the data to be shared is shared in parallel to each target server through each thread. Through multi-threaded parallel data sharing, interference in the data sharing process between data receiving cluster services is avoided, and the success rate of data sharing is improved.
[0068] When the data receiving cluster service includes multiple servers, and the data publishing cluster service only needs to share the data to be shared to one server in the data receiving cluster service, it can randomly select any available server for data sharing, or select a relatively idle server for data sharing based on the busyness of each server. When the amount of data to be shared is large, the available servers in the data receiving cluster service can be used for data sharing based on the load balancing algorithm.
[0069] In a specific implementation of the present invention, calling each server in each data receiving cluster service in parallel according to each available protocol service may include the following steps:
[0070] Each server in each data receiving cluster service is called in parallel and averagely according to each available protocol service.
[0071] The available protocol services are RPC protocol services and / or HTTP protocol services.
[0072] When calling each server in the data receiving cluster service, you can rely on the characteristics of the RPC protocol service and / or HTTP protocol service to call each server in each data receiving cluster service in parallel and evenly. By calling all servers in each data receiving cluster service evenly, all servers in each data receiving cluster service receive the shared data evenly, that is, all servers in each data receiving cluster service consume this collaborative event evenly, which ensures load balancing between servers and improves server life.
[0073] See also Figure 3 , Figure 3 The following is an architecture diagram of a data sharing system in an embodiment of the present invention. Cluster service A is a data publishing cluster service. Cluster service A includes multiple servers A. Cluster service A adopts the Nginx load balancing strategy to utilize each server A to receive the data to be shared sent by the user. After receiving the data to be shared, cluster service A sends the data to be shared to the queue in the cluster group (i.e., cluster group service) through the message queue middleware in the underlying basic service. The cluster group consumes the data to be shared (i.e., sends the data to be shared to each data receiving cluster service that subscribes to the data to be shared). It may include multiple data receiving cluster services that subscribe to the data to be shared. Figure 3 In the case where cluster service B, cluster service C, ..., cluster service N all subscribe to the shared data, based on the characteristics of the RPC protocol service or the HTTP protocol service, each data receiving cluster service can be used to consume the shared data on an average (i.e., each server in each data receiving cluster service is called on an average).
[0074] In a specific implementation of the present invention, after calling each server in each data receiving cluster service in parallel according to each available protocol service, the method may further include the following steps:
[0075] When it is detected that there is a server to which the call fails, a retry call is made to the server to which the call fails.
[0076] In the process of calling the server, the server call may fail. Therefore, after calling each server in each data receiving cluster service in parallel according to each available protocol service, when a server with a failed call is detected, the server with the failed call is retried. By setting up a server call retry mechanism, server call failures caused by temporary factors such as network status are avoided.
[0077] In a specific implementation of the present invention, after calling each server in each data receiving cluster service in parallel according to each available protocol service, the method may further include the following steps:
[0078] Performs server call logging.
[0079] After calling each server in each data receiving cluster service in parallel according to each available protocol service, the server call log can be recorded. By logging the server call situation, the usage frequency of each server can be effectively recorded, which can be used as a reference for subsequent server calls, avoiding repeated calls to the same server, and further improving the server life.
[0080] In addition to the usage frequency of each server, the log record content can also include the amount of data received by each server during the data sharing process. Since the server hard disk can be erased and written a limited number of times, it is convenient to make server calls in the future based on the usage frequency of each server and the amount of data previously received, avoiding too frequent erasures of a server and further improving the server life.
[0081] It can be seen from the above technical solution that each data receiving cluster service that needs to receive the data to be shared and the available protocol services corresponding to each data receiving cluster service are pre-configured. After receiving the data to be shared sent by the data publishing cluster service, the data to be shared are shared in parallel to each data receiving cluster service according to each available protocol service. By pre-configuring each data receiving cluster service and the available protocol services corresponding to each data receiving cluster service, calling the available protocol services corresponding to each data receiving cluster service to share the data to be shared to each data receiving cluster service, the parallel sharing of the data to be shared to multiple data receiving cluster services is realized, which reduces the intrusiveness of the business, reduces the complexity of business implementation, and improves system performance.
[0082] It should be noted that, based on the above embodiment, the embodiment of the present invention also provides corresponding improved solutions. In the subsequent embodiments, the same steps or corresponding steps as those in the above embodiment can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be repeated one by one in the following improved embodiments.
[0083] In a specific embodiment of the present invention, the method may further include the following steps:
[0084] Step 1: Parse the received data receiving cluster service adjustment request to obtain the target data receiving cluster service to be adjusted;
[0085] Step 2: Adjust the number of servers in the target data receiving cluster service.
[0086] For the convenience of description, the above two steps can be combined for explanation.
[0087] The number of servers in each data receiving cluster service may change. When the number of servers in the data receiving cluster service needs to be adjusted, a data receiving cluster service adjustment request is sent to the cluster grouping service. The cluster grouping service receives the data receiving cluster service adjustment request, parses the received data receiving cluster service adjustment request, obtains the target data receiving cluster service to be adjusted, and adjusts the number of servers in the target data receiving cluster service. The cluster service adjustment request can be a request to add a server to the data receiving cluster service, or a request to delete the original server in the data receiving cluster service, thereby enabling the subscriber to dynamically add or remove servers in the data receiving cluster service online.
[0088] See also Figure 2 , Figure 2 Another implementation flow chart of the data sharing method in the embodiment of the present invention, the method may include the following steps:
[0089] S201: Receive a message queue message sent by a data publishing cluster service; wherein the message queue message is a message encapsulated by the publisher identification information of the shared data and the data publishing cluster service.
[0090] The publishing cluster service can pre-encapsulate the data to be shared and the publisher identification information of the data publishing cluster service, obtain the message queue message, and send the message queue message to the cluster grouping service through the message queue middleware. The cluster grouping service receives the message queue message sent by the data publishing cluster service. By setting the message queue message containing the data to be shared and the publisher identification information, it is convenient to group and share each data to be shared according to the data to be shared and the publisher identification information in the message queue message when there are multiple groups of data to be shared.
[0091] S202: Acquire, according to the publisher identification information, each pre-configured data receiving cluster service and the available protocol services corresponding to each data receiving cluster service.
[0092] The publisher identification information in the publishing center and the data receiving cluster services in the subscription center and the available protocol services corresponding to each data receiving cluster service are collaboratively configured in advance. After receiving the message queue message containing the data to be shared and the publisher identification information, the pre-configured data receiving cluster services and the available protocol services corresponding to each data receiving cluster service are obtained according to the publisher identification information. By pre-configuring the correspondence between the publisher identification information, each data receiving cluster service, and the available protocol services corresponding to each data receiving cluster service, the indexing speed of the available protocol services corresponding to each data receiving cluster service is improved.
[0093] S203: Sharing the to-be-shared data to each data receiving cluster service in parallel according to each available protocol service.
[0094] Each data receiving cluster service includes at least one server.
[0095] See also Figure 4 and Figure 5 , Figure 4 is a timing diagram of a data sharing method in an embodiment of the present invention, Figure 5 It is another implementation flow chart of the data sharing method in the embodiment of the present invention. The data sharing process can be roughly divided into two stages. In the first stage, the publisher cluster service A pre-encapsulates the publisher code and collaborative content information to obtain the business collaborative message (i.e., the data to be shared), and then sends the business collaborative message to the message queue in the group consumption service (i.e., the cluster group service). The publisher code is the unique code configured by the publisher in the publishing center. The subscriber can dynamically subscribe to the publishing event of the publishing center and configure the RPC or HTTP service provided by the subscriber. The relationship between the publisher and the subscriber is 1:N. In the cluster group consumption service, after listening to the message, the publisher code will be used to obtain all subscribers and their available RPC or HTTP services from the collaborative configuration center. In the second stage, the group consumption service will call the downstream business service in parallel according to the RPC or HTTP service multi-threading. All servers in each business service cluster will accept the call of the RPC or HTTP service on average, and different service clusters will not affect each other. The failure of the RPC or HTTP service call will trigger the retry mechanism and record the service call log.
[0096] In a specific instance application, for example, when the publisher cluster service A represents the cluster responsible for on-boarding file management, the data receiving cluster service B represents the cluster responsible for attendance management, and the data receiving cluster service C represents the cluster responsible for salary payment management, the publisher cluster service A can send the employee information of the new employee to the cluster grouping service through the message queue middleware. The cluster grouping service uses a load balancing strategy to call the servers in the data receiving cluster service B and the data receiving cluster service C in parallel based on the available RPC or HTTP services corresponding to the data receiving cluster service B and the data receiving cluster service C respectively, and sends the employee information of the new employee to the called server, thereby realizing the sharing of the employee information of the new employee in each cluster, and the sharing process between different clusters does not affect each other.
[0097] Corresponding to the above method embodiment, the present invention further provides a data sharing device. The data sharing device described below and the data sharing method described above can be referenced to each other.
[0098] See also Figure 6 , Figure 6This is a structural block diagram of a data sharing device in an embodiment of the present invention, and the device may include:
[0099] A data receiving module 61, used for receiving data to be shared;
[0100] The protocol service acquisition module 62 is used to acquire each pre-configured data receiving cluster service and the available protocol services corresponding to each data receiving cluster service;
[0101] The data sharing module 63 is used to share the to-be-shared data to each data receiving cluster service in parallel according to each available protocol service; wherein each data receiving cluster service includes at least one server.
[0102] It can be seen from the above technical solution that each data receiving cluster service that needs to receive the data to be shared and the available protocol services corresponding to each data receiving cluster service are pre-configured. After receiving the data to be shared sent by the data publishing cluster service, the data to be shared are shared in parallel to each data receiving cluster service according to each available protocol service. By pre-configuring each data receiving cluster service and the available protocol services corresponding to each data receiving cluster service, calling the available protocol services corresponding to each data receiving cluster service to share the data to be shared to each data receiving cluster service, the parallel sharing of the data to be shared to multiple data receiving cluster services is realized, which reduces the intrusiveness of the business, reduces the complexity of business implementation, and improves system performance.
[0103] In a specific implementation of the present invention, the data receiving module 61 is specifically a module for receiving a message queue message sent by a data publishing cluster service; wherein the message queue message is a message encapsulated with the publisher identification information of the shared data and the data publishing cluster service;
[0104] The protocol service acquisition module 62 is specifically a module for acquiring each pre-configured data receiving cluster service and the available protocol services corresponding to each data receiving cluster service according to the publisher identification information.
[0105] In a specific implementation of the present invention, the data sharing module 63 includes:
[0106] The server calling submodule is used to call each server in each data receiving cluster service in parallel according to each available protocol service to obtain each target server;
[0107] The thread calling submodule is used to call the corresponding thread from the thread pool for each target server;
[0108] The data sharing submodule is used to share the data to be shared to each target server in parallel through each thread.
[0109] In a specific embodiment of the present invention, the server calling submodule is specifically a module that performs parallel and average calls on each server in each data receiving cluster service according to each available protocol service; wherein each available protocol service is an RPC protocol service and / or an HTTP protocol service.
[0110] In a specific embodiment of the present invention, the device may further include:
[0111] The retry calling module is used for, after calling each server in each data receiving cluster service in parallel according to each available protocol service, retrying the calling of the server when it is detected that there is a server with failed calling.
[0112] In a specific embodiment of the present invention, the device may further include:
[0113] The log recording module is used for performing server call log recording after parallel calls are made to each server in each data receiving cluster service according to each available protocol service.
[0114] In a specific embodiment of the present invention, the device may further include:
[0115] A request parsing module, used to parse the received data receiving cluster service adjustment request to obtain the target data receiving cluster service to be adjusted;
[0116] The server adjustment module is used to adjust the number of servers in the target data receiving cluster service.
[0117] Corresponding to the above method embodiment, see Figure 7 , Figure 7 This is a schematic diagram of a data sharing device provided by the present invention, and the device may include:
[0118] A memory 332, for storing computer programs;
[0119] The processor 322 is used to implement the steps of the data sharing method of the above method embodiment when executing a computer program.
[0120] For details, please refer to Figure 8 , Figure 8A specific structural diagram of a data sharing device provided for this embodiment, which may have relatively large differences due to different configurations or performances, may include a processor (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, wherein the memory 332 stores one or more computer applications 342 or data 344. Among them, the memory 332 may be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), each of which may include a series of instruction operations in the data processing device. Furthermore, the processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the data sharing device 301.
[0121] The data sharing device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .
[0122] The steps in the data sharing method described above can be implemented by the structure of a data sharing device.
[0123] Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
[0124] Receive data to be shared; obtain pre-configured data receiving cluster services and available protocol services corresponding to each data receiving cluster service; share the data to be shared in parallel to each data receiving cluster service according to each available protocol service; wherein each data receiving cluster service includes at least one server.
[0125] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0126] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.
[0127] Corresponding to the above method embodiment, the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the data sharing method as described above can be implemented.
[0128] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the devices, equipment and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0129] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the technical solution and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, the present invention can also be improved and modified without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A data sharing method, characterized in that: The cluster grouping service used to set up between the data publishing cluster service and each data receiving cluster service includes: Receive a message queue message sent by a data publishing cluster service; wherein the message queue message is a message encapsulated by the shared data and the publisher identification information of the data publishing cluster service; According to the publisher identification information, each pre-configured data receiving cluster service and the available protocol service corresponding to each of the data receiving cluster services are obtained; the available protocol service between each of the data receiving cluster services and the cluster grouping service is a specific protocol service or a protocol service selected from multiple available protocol services; According to each of the available protocol services, each server in each of the data receiving cluster services is called in parallel and averagely to obtain each target server; wherein each of the available protocol services is an RPC protocol service and / or an HTTP protocol service; For each target server, call the corresponding thread from the thread pool; Sharing the data to be shared to each of the target servers in parallel through each of the threads; Each data receiving cluster service includes at least one server.
2. The data sharing method according to claim 1, characterized in that: After calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services, the method further includes: When it is detected that there is a server to which the call fails, a retry call is made to the server to which the call fails.
3. The data sharing method according to claim 1, characterized in that: After calling each of the servers in each of the data receiving cluster services in parallel according to each of the available protocol services, the method further includes: Performs server call logging.
4. The data sharing method according to claim 1, characterized in that: Also includes: Parsing the received data receiving cluster service adjustment request to obtain the target data receiving cluster service to be adjusted; An adjustment operation is performed on the number of servers in the target data receiving cluster service.
5. A data sharing device, characterized in that: The cluster grouping service used to set up between the data publishing cluster service and each data receiving cluster service includes: A data receiving module, used to receive a message queue message sent by a data publishing cluster service; wherein the message queue message is a message encapsulated by the shared data and the publisher identification information of the data publishing cluster service; A protocol service acquisition module, used to acquire, according to the publisher identification information, each pre-configured data receiving cluster service and the available protocol services corresponding to each of the data receiving cluster services; A data sharing module, wherein the data sharing module comprises: The server calling submodule is used to perform parallel and average calls on each server in each data receiving cluster service according to each available protocol service to obtain each target server; wherein each available protocol service is an RPC protocol service and / or an HTTP protocol service; the available protocol service between each data receiving cluster service and the cluster grouping service is a specific protocol service or a protocol service selected from multiple available protocol services; The thread calling submodule is used to call the corresponding thread from the thread pool for each target server; The data sharing submodule is used to share the data to be shared to each target server in parallel through each thread; Each data receiving cluster service includes at least one server.
6. A data sharing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data sharing method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data sharing method according to any one of claims 1 to 4 are implemented.
8. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the data sharing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Data processing method and device
CN111147496A
Asynchronous call implementation method and device, server and server cluster
CN111385255A
Data sharing method, system and device of power distribution network and computer equipment
CN112015813A
Main task processing method and device, server and storage medium
CN112380030A
Data sharing method and device
CN114281778A
