A service data transmission method, system, electronic device, and storage medium

By introducing a routing and forwarding center into the DUBBO service to parse packet header information for routing and forwarding, the service data transmission channel and firewall rules are simplified, solving the problems of complex firewall rules and resource waste, and improving data transmission efficiency and operation and maintenance efficiency.

CN116567090BActive Publication Date: 2025-11-14CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310530673.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-11
Publication Date
2025-11-14
Estimated Expiration
2043-05-11

AI Technical Summary

Technical Problem

The existing data transmission methods of the DUBBO service lead to complex firewall rules in large enterprises, increase the difficulty of operation and maintenance, and result in resource waste and inefficiency.

Method used

A routing and forwarding center is introduced to perform routing and forwarding by parsing the packet header information of service consumption requests, simplifying the data transmission channel between the service consumer and the provider, and optimizing firewall rules.

Benefits of technology

It reduces the difficulty of maintaining firewall rules, improves data transmission efficiency, reduces server resource waste, and ensures the normal operation of service consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116567090B_ABST
    Figure CN116567090B_ABST
Patent Text Reader

Abstract

This solution relates to a service data transmission method, system, electronic device, and storage medium. The method includes: receiving a service consumption request sent by a service consumer; obtaining packet header information from the service consumption request; forwarding the service consumption request to a service provider corresponding to the service consumption request based on the packet header information, so that the service provider processes the received service consumption request, obtains a return packet, and sends the return packet back to a routing forwarding center; receiving the return packet and sending the return packet to the service consumer. This invention solves the problems of complex transmission channels and complex firewall rules in traditional DUBBO component data transmission methods and can be applied to the field of information technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and more specifically to a service data transmission method, system, electronic device, and storage medium. Background Technology

[0002] With the development of the internet and the continuous expansion of enterprise applications, conventional vertical architectures are no longer adequate, and distributed service architectures are now widely used. Currently, a widely adopted distributed service architecture includes the Dubbo component. In Dubbo, the service provider registers its services with a registry center. Upon receiving a registration request, the registry center caches the registry center according to its interface class. The service provider subscribes to services from the registry center. Upon receiving a subscription request, the registry center looks up the provider address corresponding to the subscribed service based on its interface class and pushes the list of provider addresses to the consumer. After receiving the pushed provider list, the service provider establishes a connection channel with each provider. When a consumer initiates a service consumption request, it sends the request to the service provider through the corresponding connection channel, and the service provider then returns the processing result to the consumer via the same path.

[0003] It can be seen that the Dubbo component is decentralized, and message exchange is mesh-like. Dubbo service consumers and providers establish persistent connections. In complex networks, firewalls need to be enabled between consumers and providers. In large enterprises, the number of applications can reach dozens or even hundreds, and the number of deployed instances often reaches thousands or more. Application iterations and upgrades are very frequent, and service changes and server additions or removals will lead to the opening or closing of relevant firewalls. A change in one service can potentially affect changes to N firewall rules. Frequent changes on the service provider side lead to complex data transmission channels between the service consumer and service provider, resulting in complex firewall rules and increasing the difficulty of maintenance. Any oversight of firewall rules can cause abnormal consumption of Dubbo services.

[0004] The traditional decentralized data transmission method of Dubbo services also suffers from wasted server resources due to high server throughput and low efficiency due to complex completion process. Summary of the Invention

[0005] The purpose of this invention is to solve the technical problems existing in the prior art. To this end, this invention proposes a service data transmission method, system, electronic device, and storage medium, which simplifies the data transmission channel network between service consumers and service providers, thereby simplifying firewall rules and improving data transmission efficiency.

[0006] The first aspect of this invention provides a service data transmission method applied to a routing and forwarding center, comprising:

[0007] Receive a service consumption request sent by a service consumer and obtain the packet header information in the service consumption request; the packet header information includes service feature code information.

[0008] The service consumption request is forwarded to the service provider corresponding to the service consumption request based on the packet header information, so that the service provider processes the received service consumption request, obtains a return packet, and sends the return packet back to the routing and forwarding center.

[0009] The return packet is received and then sent to the service consumer.

[0010] Optionally, the service consumption request includes a header and a body, and obtaining the header information in the service consumption request specifically includes:

[0011] The service consumption request is decoded according to the first preset rule to obtain the header and body of the service consumption request.

[0012] The packet header is decoded according to the second preset rule to obtain packet header information; the packet header includes packet header information and feature information of the packet body.

[0013] Optionally, forwarding the service consumption request to the service provider corresponding to the service consumption request based on the packet header information specifically includes:

[0014] The service feature code information is matched with the preset routing configuration information to find the service provider corresponding to the service consumption request.

[0015] The service consumption request is sent to the corresponding service provider according to the load balancing strategy.

[0016] The routing configuration information includes service signature information provided by all service providers.

[0017] To address the aforementioned problems, a second aspect of the present invention provides a service data transmission method applied to a registration center, comprising:

[0018] Obtain the registration information of all service providers, and determine a list of service provider addresses for all services based on the registration information; the registration information includes service feature code information;

[0019] The list of service provider addresses is packaged into a synchronization file according to a preset format, and the synchronization file is sent to the routing forwarding center so that the routing forwarding center can update the routing configuration information according to the synchronization file.

[0020] Optionally, the method further includes:

[0021] The legitimacy of the service provider is verified based on the registration information.

[0022] If the validity verification passes, the registration information of the service provider will be encapsulated.

[0023] Otherwise, abandon the encapsulation of the service provider's registration information.

[0024] Optionally, the method further includes:

[0025] Receive a subscription service request sent by the service consumer; the subscription service request includes service information and the address of the service consumer.

[0026] The address of the service provider is determined based on the service information and the list of service provider addresses.

[0027] The routing center address is determined based on the address of the service provider and the address of the service consumer.

[0028] The routing forwarding center address is sent to the service consumer.

[0029] The method described in the second aspect of the present invention further includes:

[0030] The validity of the service consumer service is verified based on the subscription service request.

[0031] If the validity check passes, proceed to determine the address of the service provider.

[0032] To address one of the aforementioned problems, a third aspect of the present invention provides a service data transmission system, comprising a routing and forwarding center and a service consumer and a service provider connected to the routing and forwarding center, including:

[0033] The service consumer is used to send service consumption requests and receive response packets.

[0034] The routing and forwarding center is used to receive the service consumption request, obtain the packet header information in the service consumption request, and forward the service consumption request to the service provider corresponding to the service consumption request in the service consumer.

[0035] The service provider is used to receive and process the service consumption request to obtain a return packet, and then send the return packet to the service consumer through the routing and forwarding center.

[0036] To address one of the aforementioned problems, a fourth aspect of the present invention provides a service data transmission system, comprising:

[0037] The service consumer is used to send service consumption requests and receive response packets.

[0038] The routing and forwarding center is used to receive the service consumption request and obtain the packet header information in the service consumption request; and forward the service consumption request to the service provider corresponding to the service consumption request in the service consumer.

[0039] The service provider is used to receive and process the service consumption request, and send the return packet to the service consumer through the routing and forwarding center according to the service consumption request.

[0040] To address one of the aforementioned problems, a fourth aspect of the present invention provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the aforementioned methods.

[0041] To address one of the aforementioned problems, a fifth aspect of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program or computer instructions, which, when executed by a processor, implement any of the aforementioned methods.

[0042] The beneficial effects of this invention are as follows: This invention adds a routing and forwarding center between the service consumer and the service provider. The routing and forwarding center receives service consumption requests sent by the service consumer and obtains the packet header information from the service consumption request. Based on the packet header information, it forwards the service consumption request to the service provider corresponding to the service consumption request. The service provider processes the received service consumption request, obtains a return packet, and sends the return packet back to the routing and forwarding center. The service provider then receives the return packet and sends it back to the service consumer, completing the transmission of service data. This scheme ensures that the addition or removal of servers for the service provider and service consumer is only related to the routing and forwarding center and is independent of the service provider itself. Furthermore, through this network structure transformation, the previous changes to each service and the addition or removal of servers would affect M (number of affected service providers) + N (number of affected service providers) firewall rules. This is optimized to only affect the change of one firewall rule, simplifying the data transmission channel network between the service consumer and the service provider, thus simplifying firewall rules, reducing the operational difficulty for staff, ensuring normal consumption during peak service demand periods, minimizing server resource waste, and improving service efficiency. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of a service data transmission structure provided in an embodiment of the present invention;

[0045] Figure 2 This is a flowchart of a service data transmission method provided in an embodiment of the present invention;

[0046] Figure 3 This is a schematic diagram of a data format for a service consumption request provided in an embodiment of the present invention;

[0047] Figure 4 This is a flowchart illustrating how a registration center provides registration services to service providers, as provided in an embodiment of the present invention.

[0048] Figure 5 This is a flowchart illustrating the information synchronization function between the registration center and the routing forwarding center provided in an embodiment of the present invention.

[0049] Figure 6 This is a flowchart of a service provider registering with a registration center, provided by an embodiment of the present invention;

[0050] Figure 7 This is a flowchart illustrating how a registration center accepts a service provider's subscription service, as provided in an embodiment of the present invention.

[0051] Figure 8 This is a schematic diagram illustrating the data processing of a routing forwarding center in a service data transmission method provided by an embodiment of the present invention;

[0052] Figure 9 This is a schematic diagram of the structure of a service data transmission system provided in an embodiment of the present invention;

[0053] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this invention. Obviously, the described embodiments are only some embodiments of this invention, not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0055] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit the scope of this application. It should be noted that the technical solutions provided in the various embodiments of this solution can be used interchangeably.

[0057] To better understand this invention, the embodiments are based on the DUBBO component to explain the technical solution of this invention. This method can also be based on other distributed architectures to implement service data transmission. The relevant concepts are described below.

[0058] Dubbo, an open-source distributed service architecture component, is a fundamental framework for common microservice architectures. Compared to Spring Cloud, another common microservice architecture, Dubbo offers twice the performance. Dubbo is a high-performance service framework open-sourced by Alibaba. It enables applications to implement service input and output functions through high-performance Remote Procedure Calls (RPCs) and can be seamlessly integrated with the Spring framework. Dubbo is a distributed service framework dedicated to providing high-performance and transparent RPC remote service invocation solutions, as well as Service-Oriented Architecture (SOA) service governance solutions.

[0059] Throughput: refers to the amount of data successfully transmitted per unit of time to a network, device, port, virtual circuit or other facility, measured in units such as bits, bytes, packets, etc.

[0060] Load balancing, divided into software load balancing and hardware load balancing, is built on top of the existing network. It provides a cost-effective, transparent method to expand the bandwidth of network devices and services, increase throughput, enhance network data processing capabilities, and improve network flexibility and availability. Load balancing means distributing workloads across multiple processing units to complete tasks.

[0061] Firewall policies for changing servers and routing forwarding centers: Before the introduction of a routing forwarding center, changes to each service and the addition or removal of a central change server would affect M (number of affected service providers) + N (number of affected service providers) firewall rules. After the introduction of a routing forwarding center, changes to services and the addition or removal of routing forwarding centers do not affect firewall rules or only affect one firewall rule. Assume there are M providers and N consumers of the changing service; and X and Y service providers deployed on the changing server. Before the introduction of a routing forwarding center, changes to N and M service providers would result in changes to (X*N + Y*M) central servers. After the introduction of a routing forwarding center, changes to service providers and service providers themselves do not change; only one server will change.

[0062] System Description: Please refer to Figure 1 , Figure 1 This is a simplified schematic diagram of the system of the present invention. In the diagram, letter A represents the service consumer and letter B represents the service provider. The implementation system of the method described in the present invention includes a service consumer, a routing and forwarding center, and a service provider. The routing and forwarding center is connected to the service consumer and communicates bidirectionally; the routing and forwarding center is also connected to the service provider and communicates bidirectionally. The service consumer and the service provider do not communicate directly. A routing and forwarding center is added between the consumer and the provider of the DUBBO service to undertake forwarding and receiving functions.

[0063] When the system invokes a service, all Dubbo service requests initiated by the consumer are sent to the routing center, which then forwards them to the corresponding Dubbo service provider. The service provider's data return packets are also sent back to the routing center, which then forwards them to the service consumer.

[0064] To address the aforementioned problems, some embodiments of the present invention provide a service data transmission method, aiming to simplify the data transmission channel network between the service consumer and the service provider, thereby simplifying firewall rules, reducing the operational and maintenance difficulties for staff, ensuring normal consumption of the DUBBO service during peak service demand periods, and improving service delivery efficiency. Figure 2 As shown, Figure 2 This is a flowchart of a data transfer method based on the Dubbo component. The method includes the following steps:

[0065] S110, Receive service consumption requests sent by the service consumer.

[0066] S120. Obtain the header information from the service consumption request; the header information includes service feature code information;

[0067] S130. Based on the packet header information, the service consumption request is forwarded to the service provider corresponding to the service consumption request, so that the service provider processes the received service consumption request, obtains a return packet, and feeds back the return packet to the routing forwarding center.

[0068] S140. Receive the return packet and send the return packet to the service consumer.

[0069] The aforementioned service feature information includes the service code and the service version number.

[0070] The aforementioned service consumer can be any device that needs to consume the service, including personal computers, laptops, and mobile terminals such as mobile phones. The service provider can be any device that provides the service, including but not limited to personal computers, laptops, mobile terminals such as mobile phones, and servers.

[0071] The aforementioned routing forwarding center includes at least one routing forwarding device or at least one level of routing forwarding device, which includes hardware and software devices. The routing forwarding devices in the routing forwarding center store a list of service provider addresses, a list of addresses for each routing forwarding device, the external interface addresses (i.e., path addresses) of the routing devices, and the service types. The service provider address list, the list of addresses for each routing forwarding device, and the service types are stored in a one-to-one mapping relationship, forming the routing path for the calling data packet. Different routing forwarding paths can be set by changing the control methods and the path addresses. This facilitates the routing forwarding center in updating the routing configuration information based on the registration information of the service providers forwarded by the registration center, and also allows the registration center to easily find the supply addresses of the services provided by the routing forwarding center to the service providers.

[0072] Specifically, the routing and forwarding center undertakes the functions of forwarding and invoking. When a service consumer needs a service, it performs the following steps: receiving a service consumption request sent by the service consumer; obtaining the header information in the service consumption request; the header information includes service signature information. The service consumption request contains a request packet for the service, and the request packet includes a header and a body.

[0073] Dubbo's underlying communication is implemented using the Java open-source framework Netty. Compared to Hypertext Transfer Protocol (HTTP) for data packet transmission, which lacks request line information, Dubbo requires the service provider to first read the entire Dubbo request packet content, then decompile the packet body information to obtain the consumed service information before determining the forwarding route for that service. This is not only inefficient but also consumes a lot of server resources from load balancing devices or software, thus affecting throughput.

[0074] To address the aforementioned issues and prevent the routing and forwarding center from becoming a performance bottleneck in the entire microservice architecture, this invention modifies the encoding and decoding functions of the DUBBO component, adding service characteristic code information such as the encoding and version number of the consumed service to the packet header of the service consumption request data packet of the DUBBO service.

[0075] The specific implementation method, step 120, involves obtaining the header information from the service consumption request, specifically including the following steps:

[0076] S121. Decode the service consumption request according to the first preset rule to obtain the header and body of the service consumption request; the header includes header information and feature information of the body.

[0077] S122. Decode the packet header according to the second preset rule to obtain packet header information.

[0078] Specifically, such as Figure 3 As shown, Figure 3 This is a schematic diagram of the data format for a service consumption request. A service consumption request consists of two parts: the TCP / IP protocol and the data packet. The data packet of the Dubbo network communication protocol is further divided into two parts: the header and the body. The header uses codec encoding and decoding, while the body uses serialization.

[0079] When a service provider initiates a service consumption request, it encodes the request: the request information for the service to be consumed is serialized into a byte stream and placed in the Body. The service information to be consumed, the serialization flag and message type, the length of the serialized request message Body, the request ID, etc., are then encoded into a fixed-length byte array using a codec and placed in the Header. During network transmission, this data packet is further processed using the TCP / IP protocol to form the service consumption request.

[0080] During decoding, firstly, the service consumption request is decoded according to the first preset rule. For example, the service consumption request is obtained according to the TCP / IP protocol and then decoded to obtain the header and body. Then, the header is decoded according to the second preset rule to obtain header information. For example, after obtaining the header, the header is decoded using a codec to obtain a fixed-length byte array.

[0081] Therefore, it can be seen that the packet header contains header information and packet body feature information, request ID, etc. In addition to serialization flag and message type, serialized message body length information, request ID, etc., the packet header information also includes the consumed service information such as the encoding and version number of the consumed service.

[0082] The characteristics of the packet body include, but are not limited to, serialization flags and message type, as well as the length of the serialized message body.

[0083] The header information may also include other information that can represent the service and the identity and characteristics of the service provider, such as the characteristics and labels of the service provider with pre-defined mapping relationships, etc., without any restrictions.

[0084] In some embodiments of this solution, step S130 forwards the service consumption request to the service provider corresponding to the service consumption request based on the packet header information, specifically including:

[0085] S131. Match the service feature code information with the preset routing configuration information to find the service provider corresponding to the service consumption request;

[0086] S132. The service consumption request is sent to the corresponding service provider according to the load balancing strategy.

[0087] The aforementioned routing configuration information includes, but is not limited to, the routing path for calling services, the type and service code of services, the version number of services, the address list of service providers, routing policies, the address list of routing devices in the routing forwarding center and the forwarding paths of the routing devices, and the address list of service consumers. The routing configuration information is cached in the routing forwarding center with mapping relationships for easy querying and retrieval.

[0088] Specifically, after obtaining consumption information containing the code and version number of the consumed service, this consumption information is compared with the routing configuration information cached in the routing forwarding center. The routing forwarding center determines the service required by the service provider based on the code and version number of the consumed service, and finds the service provider corresponding to the required service in the service provider address list organized by service. The routing forwarding center then forwards the service consumption request to the corresponding service provider according to a load balancing strategy, including but not limited to random, round-robin, consistent hash-based load balancing, and least active round-robin load balancing strategies. After receiving the request, the service provider processes it and returns the response packet to the service provider through the routing center.

[0089] The processing of the request includes, but is not limited to, parsing the request, obtaining service information and the identity information of the service provider, verifying the legality of the service, and confirming whether the service provider is providing the correct service.

[0090] The returned packet contains, but is not limited to, the consumption data requested by the service provider.

[0091] The above-mentioned random strategy refers to randomly selecting a path from the existing list of backend paths to provide services. The disadvantage of the random strategy is that the randomness is relatively strong, which increases the probability of two service requests colliding on the same interface. In non-peer cluster networking or when there are large differences in hardware configuration, the load on each node is uneven, which can be improved by weighted randomization.

[0092] The advantages of the above round-robin strategy are its simplicity, ease of horizontal scaling, and relatively even distribution across all paths. The disadvantage is that it cannot know the status of all paths.

[0093] Polling strategies are further divided into round-robin selection and weighted round-robin selection. Round-robin selection refers to selecting a path from an existing list of backend paths sequentially to provide services. One method of round-robin selection is to treat all paths as individual points and connect these points to form a circle. Round-robin selection then selects a point on this circle clockwise, i.e., choosing a path to provide services. This clockwise selection function can be achieved by taking the modulo of the number of requests.

[0094] Weighted round-robin selection refers to the practice where different paths are assigned different weights, thus requiring the implementation of weighted round-robin selection. Paths with higher weights are selected more frequently, while those with lower weights are selected less frequently.

[0095] The nodes with weighted information can be arranged in a circle, but the corresponding nodes are repeated a different number of times according to different weights, that is, the paths with different weights are repeated a different number of times. Then, a point is selected clockwise. Each node is repeated a corresponding number of times according to its weight, so the number of times a node with different weights is selected is also different, and the number of times it is selected is related to its own weight. This simply implements weighted round-robin selection.

[0096] This invention also provides a service data transmission method, such as... Figure 4 As shown, Figure 4 This is a flowchart of the registration process provided by the registry center for service providers; the method is applied to the registry center and includes the following steps:

[0097] S210. Obtain the registration information of all service providers, and determine a list of service provider addresses for all services based on the registration information; the registration information includes service feature code information;

[0098] S230. The service provider address list is packaged into a synchronization file according to a preset format, and the synchronization file is sent to the routing forwarding center so that the routing forwarding center updates the routing configuration information according to the synchronization file.

[0099] Some embodiments of this invention add an automatic synchronization function of routing configuration information between the registration center and the routing forwarding center. For example... Figure 5 As shown, Figure 5 This is a flowchart illustrating the information synchronization function between the registration center and the routing forwarding center. After receiving the registration information from the service provider, the registration center collects the registration information, such as the list of service provider addresses for each service, and updates the local service and the corresponding provider registration information. It generates a synchronization file containing the registered services and all service provider registration information for those services, and sends it to the routing forwarding center. Upon receiving the synchronization file, the routing forwarding center reads the forwarding policy information within it and compares it with the forwarding policy information cached locally. If they are inconsistent, the routing forwarding center updates its local cache with the newly synchronized forwarding policy, thus implementing the automatic policy update function of the routing forwarding center.

[0100] The method for comparing the forwarding policy information with the local cache may include, but is not limited to, matching the first address list of the service provider with the second address list cached in the routing forwarding center, and updating the routing configuration information according to the registration information when the first address list fails to match the second address list.

[0101] The registration information includes a first address list of the service provider, which contains the service provider's version, ID, address, and information such as the services it can provide, the service code of the services, and the version.

[0102] The first address list mentioned above is a list of addresses containing all service providers that provide services, obtained by updating the original address list cached in the registration center after the registration center receives the registration information from the service provider.

[0103] The aforementioned second address list refers to the list of addresses stored in the routing and forwarding center before receiving the synchronization file sent by the registration center. This second address list includes the address lists of all previously registered service providers, but does not include the address lists of newly registered service providers.

[0104] The above-mentioned service data transmission method further includes, before step S230:

[0105] S220. Verify the legitimacy of the service provider based on the registration information; if the legitimacy verification passes, encapsulate the registration information of the service provider; otherwise, abandon the encapsulation of the registration information of the service provider.

[0106] The registry center can verify the legitimacy of a service provider by checking whether the registration information is correct and complete. This can be achieved by adding a specific identifier to the registration request, which the registry center can then use to verify the legitimacy of the service provider.

[0107] like Figure 6 As shown, Figure 6 A flowchart illustrating the registration process between a service provider and a registration center. In some embodiments of this invention, step S220 may further include: if the verification passes, caching the service provider's registration information in the registration center; if the verification fails, the registration center analyzes the reason for the failure and returns registration failure information to the service provider, including the reason for the failure and the service provider's registration information.

[0108] Cache the service provider's registration information in the registry center during the verification process. This helps avoid updating the registration information in the registry center and also prevents the service provider from registering repeatedly.

[0109] In some embodiments of this solution, the service data transmission method further includes the service provider subscribing to a service from the registry center. The service provider subscribing to a service from the registry center includes:

[0110] S240, Receive a subscription service request sent by the service consumer;

[0111] S260. Determine the address of the service provider based on the service information and the service provider address list;

[0112] S270. Determine the routing forwarding center address based on the address of the service provider and the address of the service consumer;

[0113] S280. Send the address of the routing forwarding center to the service consumer.

[0114] The subscription service request includes service information and the address of the service consumer.

[0115] Specifically, prior to step S260, the service provider's subscription to the service from the registry center further includes:

[0116] S250. Verify the legality of the subscription service according to the subscription request. If the verification is successful, query the corresponding service provider according to the subscription service. Determine the routing forwarding center address that needs to be passed through to complete the service according to the corresponding service provider and the service provider. Push the routing forwarding center address that needs to be passed through to the service provider.

[0117] The address of the aforementioned routing forwarding center includes the routing path and the address of the routing device. Specifically, it can be selected based on a combination of information such as the address, ID, model, and version of the service provider.

[0118] The registry caches a list of service provider addresses on a service-by-service basis. It then locates the corresponding service provider within the service unit requested in the subscription request. When querying the corresponding service provider based on the subscribed service, it determines whether a service provider exists that offers services that meet the service provider's requirements. If so, it pushes the required routing forwarding center address to the service provider.

[0119] In this technical solution, the DUBBO component supports the following registry centers: Multicast registry center, Zookeeper registry center, Redis registry center, and Simple registry center.

[0120] The registry center is responsible for registering and finding service addresses, which is equivalent to a directory service. The registry center does not forward requests or call services, so it has relatively low pressure.

[0121] The registry center is a peer-to-peer cluster that can dynamically add machine deployment instances. All service providers and service providers will automatically discover the new registry center. Service providers are stateless and can dynamically add machine deployment instances. After a new service provider successfully registers with the registry center, the registry center will push the new service provider information to the consumer.

[0122] like Figure 7 As shown, Figure 7 This is a flowchart of the registration center accepting service subscriptions from service providers; in some embodiments provided by the present invention, step 250 of the method may further include: if the verification fails, the registration center returns subscription failure information to the service provider, indicating that the subscription has failed.

[0123] Step 260 may also include: determining whether there is a corresponding service provider; if so, determining the routing forwarding center address based on the address of the service provider and the address of the service consumer; if not, returning a subscription failure message to the service provider and prompting the consumer that the subscription failed.

[0124] Information regarding subscription failures may include, but is not limited to, failure notifications, reasons for the failure, and solutions.

[0125] In some embodiments of this solution, a service data transmission method is provided, which is applied to a system including a service provider, a routing and forwarding center, and the service provider, comprising:

[0126] S310, The service consumer sends a service consumption request to the routing and forwarding center.

[0127] S320. The routing and forwarding center receives the service consumption request and obtains the packet header information in the service consumption request.

[0128] S330. The routing and forwarding center forwards the service consumption request to the service provider corresponding to the service consumption request based on the packet header information.

[0129] S340. The service provider receives and processes the service consumption request, and sends a return packet to the service consumer through the routing and forwarding center according to the service consumption request.

[0130] like Figure 8 As shown, Figure 8 This diagram illustrates how the routing center processes data. After receiving a service consumption request from a service consumer, the routing center first reads the packet header information and retrieves the service code and service version of the requested service from a specified location in the header. Figure 8 The location shown retrieves a service with a service code of XXX.2.XX and a service version of V2. This service code (XXX.2.XX) and service version (V2) are then matched with the service registration information synchronized from the registry center. The aforementioned service registration information is cached in... Figure 8As shown in the table, after finding the list of providers for the request, the routing center forwards the service consumption request to the corresponding service provider according to a load balancing strategy, such as random or round-robin. Upon receiving the request, the service provider processes it and returns the response packet to the consumer along the same path.

[0131] The technical terms such as load balancing strategy and registration information mentioned above are the same as those in the foregoing embodiments, and will not be repeated here.

[0132] To address one of the aforementioned problems, some embodiments of this solution provide a service data transmission system for implementing the methods described in some embodiments, such as... Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of a service data transmission system based on the DUBBO component.

[0133] The system includes: a consumer server, a routing and forwarding center, a service provider, a registration center, and a monitoring center.

[0134] The service consumer side is used to send service consumption requests and also to receive return packets.

[0135] The routing and forwarding center is used to receive the service consumption request and obtain the packet header information in the service consumption request; and forward the service consumption request to the service provider corresponding to the service consumption request in the service consumer end according to the packet header information.

[0136] The service provider is used to receive and process the service consumption request to obtain a return packet, and then send the return packet to the service consumer through the routing and forwarding center.

[0137] The aforementioned service consumer end includes at least two service providers, and the routing and forwarding center may include at least one routing and forwarding device, which includes hardware and software devices.

[0138] In some embodiments of this solution, the routing forwarding center is specifically used to parse data packets to obtain the packet header information, obtain service information from the packet header information, match the service information with the routing configuration information of the service provider stored in the routing forwarding center, and find the specific service provider among the service providers corresponding to the service consumption request;

[0139] The routing and forwarding center is specifically used to send the service consumption request to the corresponding service provider segment according to the load balancing strategy.

[0140] In some embodiments provided in this solution, the registration center is used to obtain the registration information of the provider and send the registration information to the routing and forwarding center.

[0141] The routing forwarding center is also used to update routing configuration information based on the registration information.

[0142] The registration center is specifically used to receive registration requests sent by the service provider, verify the legitimacy of the service provider based on the registration request, and when the verification passes, encapsulate the registration information of the service provider into a synchronization file, which the registration center then sends to the routing and forwarding center. The registration center is also used to verify the legitimacy of the consumer provider; when the verification passes, the registration information from the service provider is cached in the registration center; when the verification fails, the registration center analyzes the reason for the failure and returns registration failure information to the service provider.

[0143] The routing forwarding center is specifically used to receive and parse the synchronization file to obtain the registration information, match the first address list of the service provider with the second address list cached in the routing forwarding center, and update the routing configuration information according to the registration information when the first address list fails to match the second address list.

[0144] In some embodiments provided in this solution, the registration center is also used to provide subscription service functionality to the service consumer, and to push the routing forwarding center address of the service to the service consumer based on the service subscribed by the service consumer.

[0145] The registration center is specifically used to receive subscription requests from the service consumers; verify the legality of the subscription service based on the subscription request; if the verification passes, query the service provider in the service provider database based on the subscription service; if the verification fails, the registration center returns subscription failure information to the service consumers, indicating to the service provider that the subscription failed.

[0146] The registry center is specifically used to query the service providers of the services subscribed to by the service providers, determine whether there is a corresponding service provider, and if so, determine the address of the routing center that needs to be passed through to complete the service and send the address of the routing center to the service provider; if not, it returns a subscription failure message to the service provider, prompting the consumer that the subscription has failed.

[0147] In some embodiments provided in this solution, the registration center is also used to provide a subscription service to the service consumer and push the service address to the service consumer according to the subscription service.

[0148] The specific implementation methods and related terminology are the same as those described above, and will not be repeated here.

[0149] In some embodiments provided in this solution, the monitoring center is used to count the number of times each service is called, the call time, etc.

[0150] The aforementioned registration center and monitoring center can be deployed on the same server, or their configurations can be changed to deploy them on different servers.

[0151] The service consumers, service providers, and registration center are dynamically connected and dynamically added. The specific service providers can dynamically expose themselves to other service consumers that need their services through the registration center, without the service providers having to update their configuration files one by one to find other service providers.

[0152] The service consumer side implements a dynamic discovery principle, and the service provider side can dynamically search for new configurations, routing configuration rules and new service providers without restarting the service for them to take effect.

[0153] The registry center supports dynamic adjustment of parameters, and new parameters are automatically updated to all relevant service nodes.

[0154] To address one of the aforementioned problems, some embodiments of the present invention provide an electronic device, such as... Figure 10 As shown, Figure 10 This is a schematic diagram of an electronic device, which includes a 1000 memory and a 2000 processor. The memory stores a computer program, and the processor executes the computer program to implement any of the methods described above in this invention.

[0155] To address one of the aforementioned problems, some embodiments of the present invention provide a computer-readable storage medium storing a computer program or computer instructions that, when executed by a processor, implement the methods described above.

[0156] To verify the feasibility of the above method, the present invention conducts performance tests on the technical solution of this invention. Test environment description: the test servers are all 4C8G virtual machines, and the number of providers and consumers is 1 each, and they are in the same gigabit local area network.

[0157] Table 1 shows the test results of this scheme. As can be seen from the table, compared to the service provider directly establishing a long connection to complete the service, adding a routing forwarding center between the service providers and having the routing forwarding center complete the service call between them can reduce the server throughput when the data packet and return packet sizes are the same.

[0158] Table 1

[0159]

[0160]

[0161] The nginx listed in the table is a high-performance HTTP and reverse proxy web server.

[0162] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0163] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0164] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0165] It should be understood that in this application, "at least one (item)" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0166] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0167] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0168] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0169] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0170] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A service data transmission method, characterized in that, Applied to routing and forwarding centers, including: The system receives a service consumption request sent by a DUBBO service consumer. The service consumption request includes a header and a body. The system decodes the service consumption request according to a first preset rule to obtain the header and body of the service consumption request. The system decodes the header according to a second preset rule to obtain header information. The header includes header information and feature information of the body. The header information includes service feature code information, which includes the service code and the version number of the service. The service signature information is matched with the preset routing configuration information to find the DUBBO service provider corresponding to the service consumption request; the service consumption request is sent to the corresponding DUBBO service provider according to the load balancing strategy; so that the DUBBO service provider processes the received service consumption request, obtains a return packet, and sends the return packet back to the routing forwarding center; wherein, the routing configuration information includes the service signature information of all services provided by DUBBO service providers; The return packet is received and then sent to the DUBBO service consumer.

2. A service data transmission method, characterized in that, Applied to the registry center, including: Obtain the registration information of all Dubbo service providers, and determine the list of Dubbo service provider addresses for all services based on the registration information; the registration information includes service signature information. The legality of the DUBBO service provider is verified based on the registration information. If the legality verification passes, the registration information of the DUBBO service provider is encapsulated. Otherwise, the encapsulation of the registration information of the DUBBO service provider is abandoned, the registration center analyzes the reason for the verification failure, and returns the registration failure information to the DUBBO service provider. The list of DUBBO service provider addresses is encapsulated into a synchronization file according to a preset format, and the synchronization file is sent to the routing forwarding center so that the routing forwarding center updates the routing configuration information according to the synchronization file. The routing forwarding center receives and forwards the service consumption request sent by the DUBBO service consumer to the corresponding DUBBO service provider based on the updated routing configuration information. The service consumption request includes a header and a body. The service consumption request is decoded according to a first preset rule to obtain the header and body of the service consumption request. The header is decoded according to a second preset rule to obtain header information. The header includes header information and feature information of the body. The header information includes service feature code information, which includes the service code and the version number of the service.

3. The method according to claim 2, characterized in that, The method further includes: Receive a subscription service request sent by a DUBBO service consumer; the subscription service request includes service information and the address of the DUBBO service consumer; The address of the DUBBO service provider is determined based on the service information and the list of DUBBO service provider addresses; The routing forwarding center address is determined based on the address of the DUBBO service provider and the address of the DUBBO service consumer. The routing forwarding center address is sent to the DUBBO service consumer.

4. The method according to claim 3, characterized in that, The method further includes: Verify the legitimacy of the DUBBO service consumer service based on the subscription service request; If the validity check passes, proceed to determine the address of the DUBBO service provider.

5. A service data transmission system, characterized in that, This includes a routing forwarding center and a Dubbo service consumer and a Dubbo service provider connected to the routing forwarding center, wherein: The DUBBO service consumer is used to send service consumption requests and receive response packets. A routing and forwarding center is used to receive the service consumption request, which includes a header and a body. The center decodes the service consumption request according to a first preset rule to obtain the header and body. It then decodes the header according to a second preset rule to obtain header information, which includes header information and feature information of the body. The header information includes service signature information, which includes the service code and version number of the service. The center also retrieves the header information from the service consumption request, matches the service signature information with preset routing configuration information to find the DUBBO service provider corresponding to the service consumption request, and sends the service consumption request to the corresponding DUBBO service provider according to a load balancing strategy. The routing configuration information includes service signature information provided by all DUBBO service providers. The DUBBO service provider receives and processes the service consumption request to obtain a return packet, and sends the return packet to the DUBBO service consumer through the routing and forwarding center.

6. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program or computer instructions that, when executed by a processor, implement the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Distributed service access system and method

    CN110191164A

  • Network request processing method, computing device and storage medium

    CN111586097A