A dynamic routing method and system for multi-bank service requests

By introducing target entry points and a two-layer cache index into the bank-insurance system, bank-level dynamic routing and identity recognition were achieved, solving the problems of high network coupling and difficulty in dynamic expansion, and improving the system's availability and resource utilization.

CN123123233APending Publication Date: 2026-11-17SUNSHINE LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611313437.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In the existing bank-insurance interconnection system, the fixed network connection between the bank side and the front-end machine results in high network coupling, lack of unified management and control, inability to achieve unified traffic scheduling and fault switching, difficulty in dynamic expansion, low resource utilization, and the risk of single point of failure.

Method used

A dynamic routing method for multi-bank service requests is adopted. Requests are received through the target entry point, the bank identity is determined based on the source address and target port number, a two-level cache index is used to quickly find service instances, and dynamic routing is achieved across the entire link. High availability is ensured through primary and backup redundancy and virtual address migration.

Benefits of technology

It achieves bank-level identity recognition and request source verification, reduces routing latency and registry center pressure, automatically detects backend scaling up and down, improves system security and resource utilization, and eliminates single point of failure risk.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123233A_ABST
    Figure CN123123233A_ABST
Patent Text Reader

Abstract

This invention discloses a dynamic routing method and system for multi-bank service requests, relating to the fields of computer network communication and load balancing technology. The method receives requests sent by banks through a target entry point, where each bank is assigned a unique listening port. It determines the corresponding bank's identity information based on the request's source address and target port number. It then queries a cached index based on the bank's identity information to obtain a list of corresponding service instances. A target service instance is randomly selected from the list, and the request is routed to that instance. This invention solves the problems of high network coupling, lack of unified control at the access layer, static and rigid routing, and low resource utilization caused by direct connection to the front-end server on the bank side, through a unified target entry point, port-based bank identity differentiation, a two-layer cached index, and dynamic routing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer network communication and load balancing technology, and in particular to a dynamic routing method and system for multiple bank service requests. Background Technology

[0002] In the context of commercial banks collaborating on insurance agency business, the Bank-Insurance Link System is the core system supporting business data exchange between insurance companies and multiple partner banks.

[0003] The existing bank-insurance interconnection system adopts a traditional virtual machine deployment architecture. Each partner bank is configured with a separate front-end server. The bank establishes a connection with its respective front-end server via a dedicated line. The front-end server exposes Socket long connection service and HTTP short connection service to the bank. The front-end servers of each bank are independent of each other. The bank directly connects to the corresponding front-end server through a fixed Internet Protocol address and port. The front-end servers are manually deployed, upgraded and maintained by the operation and maintenance personnel.

[0004] However, the aforementioned one-to-one front-end deployment model has revealed many shortcomings in actual operation: On the one hand, the network coupling is high, with banks directly connecting to their respective front-end servers via fixed Internet Protocol addresses and ports. When the address or port of the front-end server changes, the bank needs to adjust the network access configuration synchronously. The access layer lacks unified management and control, and the front-end servers of each bank are deployed in a decentralized manner, making it impossible to achieve unified traffic scheduling, circuit breaker degradation, and canary release management. Moreover, each set of front-end servers is independently configured with high availability policies, resulting in long failover times or single point of failure risks. On the other hand, dynamic expansion is difficult, the host startup cycle is long, and it is impossible to quickly respond to the fault handling and resource expansion needs during peak business periods. The routing is static and rigid, with the bank's configuration fixed to a single front-end server. When the front-end server fails or needs expansion, the bank cannot automatically detect and switch over. Resource utilization is low, with each bank occupying a dedicated set of hosts. Operating system-level isolation causes a large amount of resource redundancy, making it impossible to dynamically allocate resources across banks. Summary of the Invention

[0005] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: In a first aspect, a dynamic routing method for multi-bank service requests is provided. The method includes: receiving a request sent by a bank through a target entry point, wherein the target entry point is assigned a unique listening port for each bank; determining the bank identity information corresponding to the request based on the source address and target port number of the request; querying a cache index based on the bank identity information, and obtaining a list of service instances corresponding to the bank identity information based on the cache index, wherein the list of service instances includes at least one service instance; randomly selecting a target service instance from the list of service instances; and routing the request to the target service instance.

[0006] The method provided by this invention receives requests sent by the bank through a target entry point, replacing the dispersed front-end access method with a unified target entry point; it determines the bank's identity information based on the source address and target port number of the request, realizing multi-bank identity recognition based on port differentiation; it obtains a list of service instances corresponding to the bank's identity information by querying the cache index, avoiding real-time querying of the service registry center for each request; and it realizes end-to-end dynamic routing by randomly selecting a target service instance from the list of service instances and routing the request to that instance.

[0007] In one possible implementation of the first aspect, the cache index is a two-level cache index, including a first-level index and a second-level index. The first-level index uses the combination of the bank's source address and port number as the index key to map to the corresponding bank identity information. The second-level index uses the bank identity information as the index key to store a list of service instances corresponding to the bank identity information.

[0008] The method provided by this invention uses a two-layer cache index structure. The first layer carries the mapping from the request source to the bank identity, and the second layer carries the mapping from the bank identity to the instance set. This enables joint verification of the request source and fast lookup of the bank-level instance list, avoiding real-time querying of the service registry for each request, and significantly reducing routing latency and registry pressure.

[0009] In one possible implementation of the first aspect, before the request sent by the receiving bank through the target entry point, the method further includes: registering the service instances of each bank to the service registration center, wherein the service instances of each bank are registered with the corresponding bank identity information.

[0010] The method provided by this invention registers the service instances of each bank with the corresponding bank identity information to the service registry center, thereby realizing the automatic publication and unified management of service instances and providing a service discovery foundation for the subsequent construction of cache indexes and dynamic routing.

[0011] In one possible implementation of the first aspect, the method further includes: when a service instance completes deployment and is in a ready state, triggering the retrieval of the latest service instance list corresponding to the bank from the service registry; and writing the retrieved latest service instance list into the cache index.

[0012] The method provided by this invention dynamically retrieves the list of service instances and writes it to the cache index by triggering a deployment completion event, thereby realizing dynamic updates of the routing table. The bank can automatically detect backend scaling up and down without any configuration changes.

[0013] In one possible implementation of the first aspect, determining the bank identity information corresponding to the request based on the source address and target port number of the request includes: querying the first-level index based on the combination of the source address and target port number of the request to obtain the bank identity information mapped by the combination.

[0014] The method provided by this invention determines the bank's identity information by querying the first-level index through a combination of the source address and the target port number, thereby realizing joint identity verification of the request source. It not only verifies the bank corresponding to the port number, but also verifies whether the request source address belongs to that bank, thus improving system security.

[0015] In one possible implementation of the first aspect, the step of querying the cache index based on the bank identity information and obtaining the service instance list corresponding to the bank identity information based on the cache index includes: querying the second-level index based on the bank identity information to obtain the service instance list corresponding to the bank identity information.

[0016] The method provided by this invention obtains the corresponding service instance list by querying the second-level index through bank identity information, realizing fast lookup from bank identity to instance set, and reducing service discovery overhead and latency.

[0017] In one possible implementation of the first aspect, the method further includes: reading the timeliness configuration of the corresponding bank, the timeliness configuration including a connection timeliness threshold and a response timeliness threshold; when the request is routed but no response is received after exceeding the response timeliness threshold, releasing the current session connection; if the bank has multiple service instances, marking the current service instance as temporarily unavailable and retrying with other service instances; if all service instances of the bank are unavailable, returning a preset fixed error code response to the bank.

[0018] The method provided by this invention automatically releases the connection and retryes other instances when a request times out without a response through bank-level timeout configuration and request-level timeout degradation, and returns a fixed error code when all instances are unavailable, thus ensuring service availability and business continuity.

[0019] In one possible implementation of the first aspect, the method further includes: when a service instance fails and is deregistered by the service registry, subsequent request processing will no longer route traffic to the failed service instance; when any bank has a failed node, a service monitoring alarm will be triggered.

[0020] The method provided by this invention achieves automatic isolation and timely detection of faults by automatically removing traffic from the faulty instance when an instance fails and triggering manual intervention when all instances fail.

[0021] In one possible implementation of the first aspect, the target entry point adopts a primary-backup redundancy deployment, and virtual address drift is implemented through a virtual routing redundancy protocol. When the primary node fails, the backup node takes over the traffic, and the virtual address drift is made imperceptible to the bank side through address mapping.

[0022] The method provided by this invention achieves high availability of the target entry point through primary and backup redundancy and virtual address drift. When the primary node fails, the backup node takes over the traffic in seconds, and the address mapping ensures that the virtual address drift is completely transparent to the bank side, eliminating the risk of single point of failure.

[0023] Secondly, the present invention provides a dynamic routing system for multi-bank service requests. The system includes: a request receiving module for receiving requests sent by banks through a target entry point, wherein the target entry point is assigned a unique listening port for each bank; an identity recognition module for determining the bank identity information corresponding to the request based on the source address and target port number of the request; an instance query module for querying a cache index based on the bank identity information and obtaining a list of service instances corresponding to the bank identity information based on the cache index, wherein the list of service instances includes at least one service instance; an instance selection module for randomly selecting a target service instance from the list of service instances; and a routing and forwarding module for routing the request to the target service instance.

[0024] Thirdly, an electronic device is provided, the electronic device including a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method as described in any implementation of the first aspect.

[0025] Fourthly, a computer-readable storage medium is provided, including computer instructions that, when executed on an electronic device, cause the electronic device to perform a method as described in any implementation of the first aspect.

[0026] Fifthly, a computer program product is provided that, when run on a computer, causes the computer to perform the method in any implementation of the first aspect.

[0027] Understandably, the beneficial effects achieved by the system of the second aspect, the electronic device of the third aspect, the computer-readable storage medium of the fourth aspect, and the computer program product of the fifth aspect provided above can be referred to with reference to the beneficial effects of the first aspect and any of its possible design embodiments, which will not be repeated here. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a dynamic routing method for multiple bank service requests provided in an embodiment of the present invention; Figure 3 A diagram illustrating a high availability and port differentiation mechanism for a target entry point provided in an embodiment of the present invention; Figure 4 This invention provides a deployment-triggered dynamic IP update timing diagram according to an embodiment of the invention. Figure 5 A two-layer cache index structure and dynamic routing flowchart are provided in this embodiment of the invention; Figure 6 A flowchart of request forwarding fault tolerance and monitoring provided in an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a dynamic routing system for multiple bank service requests provided in an embodiment of the present invention. Detailed Implementation

[0029] The technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. In the description of the present invention, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. The "or" in the present invention is merely a description of the relationship between the related objects, indicating that three relationships can exist. For example, A or B can represent: A alone, A and B simultaneously, and B alone. A and B can be singular or plural. Furthermore, in the description of the present invention, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.

[0030] Furthermore, to facilitate a clear description of the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.

[0031] In this embodiment of the invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this embodiment of the invention should not be construed as superior or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.

[0032] In the context of commercial bank-agent insurance business cooperation, the Bank-Insurance Link system is the core system supporting business data interaction between insurance companies and multiple partner banks. The existing Bank-Insurance Link system adopts a traditional virtual machine deployment architecture, with each partner bank configuring a separate front-end server. Banks establish connections with their respective front-end servers via dedicated lines, and the front-end servers expose Socket long-connection services and HTTP short-connection services to the banks. Each bank's front-end server is independent, and the bank directly connects to its corresponding front-end server via a fixed Internet Protocol address and port. The front-end servers are manually deployed, upgraded, and maintained by operations and maintenance personnel.

[0033] However, the aforementioned "one-to-one front-end server" deployment model has revealed many shortcomings in actual operation: On the one hand, the network coupling is high, with banks directly connected to their respective front-end servers via fixed Internet Protocol addresses and ports. When the address or port of the front-end server changes, the bank needs to adjust the network access configuration synchronously. The access layer lacks unified management and control, and the front-end servers of each bank are deployed in a decentralized manner, making it impossible to achieve unified traffic scheduling, circuit breaker degradation, and canary release management. Moreover, each front-end server is independently configured with a high availability strategy, resulting in long failover times or single-point failure risks. On the other hand, dynamic expansion is difficult, the host startup cycle is long, and it is impossible to quickly respond to the fault handling and resource expansion needs during peak business periods. The routing is static and rigid, with the bank's configuration fixed to a single front-end server. When the front-end server fails or needs expansion, the bank cannot automatically detect and switch over. Resource utilization is low, with each bank occupying a dedicated set of hosts. Operating system-level isolation causes a large amount of resource redundancy, making it impossible to dynamically allocate resources across banks.

[0034] In view of this, embodiments of the present invention provide a dynamic routing method for multi-bank service requests. The method includes: receiving a request sent by a bank through a target entry point, wherein the target entry point is assigned a unique listening port for each bank; determining the bank identity information corresponding to the request based on the source address and target port number of the request; querying a cache index based on the bank identity information, and obtaining a list of service instances corresponding to the bank identity information based on the cache index, wherein the list of service instances includes at least one service instance; randomly selecting a target service instance from the list of service instances; and routing the request to the target service instance.

[0035] The method provided by this invention receives requests sent by the bank through a target entry point, replacing the dispersed front-end access method with a unified target entry point; it determines the bank's identity information based on the source address and target port number of the request, realizing multi-bank identity recognition based on port differentiation; it obtains a list of service instances corresponding to the bank's identity information by querying the cache index, avoiding real-time querying of the service registry center for each request; and it realizes end-to-end dynamic routing by randomly selecting a target service instance from the list of service instances and routing the request to that instance.

[0036] In some embodiments, the dynamic routing method for multi-bank service requests provided by the present invention can be executed by a dynamic routing system for multi-bank service requests (hereinafter referred to as the routing system).

[0037] As an example, a routing system can be any electronic device with data processing capabilities, such as a general-purpose computer, personal computer, server, or gateway device. The specific implementation of the routing system is not limited here.

[0038] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown. The electronic device 200 includes a processor 210, a memory 220, and a communication interface 230.

[0039] Processor 210 may include one or more processing cores. Processor 210 connects to various parts within electronic device 200 using various interfaces and lines, and performs various functions and processes data of electronic device 200 by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 may be implemented using at least one of the following hardware forms: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).

[0040] The memory 220 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 220 may include a non-transitory computer-readable storage medium. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a program storage area. This program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc.

[0041] Communication interface 230 is used to communicate with other devices, equipment or communication networks, such as data storage devices, image processing devices or Ethernet, wireless access network (RAN), wireless local area network (WLAN), etc.

[0042] In terms of physical implementation, the aforementioned devices (such as processor 210, memory 220, and communication interface 230) can each be devices within the same device (such as a laptop computer). Alternatively, at least two of these devices can be located within the same device, i.e., as different devices within the same device, similar to the deployment of devices or components in a distributed system.

[0043] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200. In other embodiments of the present invention, the electronic device 200 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0044] The following description, in conjunction with the accompanying drawings, illustrates a dynamic routing method for multi-bank service requests provided by an embodiment of the present invention.

[0045] Figure 2 This is a flowchart illustrating a dynamic routing method for multi-bank service requests provided in an embodiment of the present invention. Optionally, this method can be... Figure 1 The illustrated electronic device performs this operation. The method includes the following steps: S1. Receive a request sent by the bank side through the target entry point, wherein the target entry point is assigned a unique listening port for each bank.

[0046] Specifically, the target entry point refers to the unified traffic access point that replaces the distributed front-end servers. It exposes a unified virtual Internet Protocol address and port to the outside world, and all bank-side requests are sent to this unified entry point via a dedicated line. The listening port refers to the unique port number assigned to each bank by the target entry point. The port numbers assigned to each bank are unique, and each bank is configured with an independent upstream service cluster.

[0047] In one possible implementation, the target entry point is deployed with primary and backup redundancy. Virtual address shifting is achieved through a virtual routing redundancy protocol. When the primary node fails, the backup node takes over the traffic, and the virtual address shifting is made imperceptible to the bank side through address mapping.

[0048] Among them, the Virtual Router Redundancy Protocol (VRRP) is a protocol for implementing primary and backup redundancy. The load balancing nodes are deployed in a primary and backup redundancy manner. When the primary node is normal, it holds the virtual Internet Protocol address and responds to requests, while the backup node is in standby mode. When the primary node fails, VRRP triggers virtual address migration, and the backup node takes over the traffic within seconds. The virtual address migration is achieved at the network level through address mapping, which is completely imperceptible to the bank side. The bank side does not need to modify any configuration or adaptation.

[0049] In one example, see Figure 3 , Figure 3 This diagram illustrates a target entry point high availability and port differentiation mechanism provided in an embodiment of the present invention. (See diagram for example.) Figure 3 As shown, the overall architecture is divided into four layers from top to bottom: the banking service layer, the network layer, the access layer, the soft load balancing layer, and the upstream service layer. The banking service layer includes multiple banking business systems such as Bank A, Bank B, and Bank C. Each bank sends business requests to the network layer via dedicated lines. The network layer sets up an Internet Protocol address mapping (IPA) unit to complete network address translation. The access layer exposes a unified virtual IP as the unified access point (target entry point) for all banks. The soft load balancing layer deploys a load balancer master node (master node) and a load balancer backup node (backup node) to achieve redundancy. The master and backup nodes are configured with unique listening ports to distinguish different bank identities (bank identity information). The soft load balancing layer also deploys a dynamic routing module, a process-level high-speed cache (cache index), and a load balancing routing IP update interface. When the master load balancer fails, the virtual IP is switched to the backup node via virtual IP migration. Thanks to the IPA mapping in the network layer, the virtual IP migration process is completely transparent to the banks. The upstream service layer comprises multiple upstream service clusters (service instances). Requests from different banks are forwarded to the corresponding bank's upstream service cluster after identity verification by the soft load balancing layer. This architecture abandons the independent front-end deployment model for each bank. All banks connect to the same unified entry point (target entry point), and multi-bank identity isolation is achieved through ports. At the same time, single points of failure in the access layer are eliminated by relying on primary / backup and virtual IP migration.

[0050] Before receiving requests from the bank, the cache index needs to be built. In one possible implementation, building the cache index includes two steps: service registration and dynamic fetching.

[0051] During the service registration process, service instances from each bank are registered with the service registry center. Each bank's service instance is registered using its corresponding bank identity information. The bank's insurance and banking service is deployed as containerized service instances. After startup, the service instance automatically registers its network internet protocol address and port with the service registry center through the registration client, achieving automatic publication of the service instance. Each bank's service is registered in the registry center using its bank service name, and a one-to-one correspondence is maintained between the bank service name and the bank identity information.

[0052] During the dynamic retrieval process, when a service instance is deployed and in a ready state, the latest list of service instances corresponding to that bank is retrieved from the service registry, and the retrieved list is written to the cache index. Specifically, after the bank service instance is deployed and its status transitions to the ready state, the routing target update interface provided by the target entry point is called, triggering the Internet Protocol address retrieval instruction of the dynamic routing processing module. The dynamic routing processing module then calls the service instance query interface of the service registry, using the bank service name as the search key, to retrieve all active service instances under that service name, parses the response message to extract the Internet Protocol address and port number of each instance, and serializes them into a service instance list, which is then written to the process-level cache. If the service retrieval fails, an alarm is triggered, and a retry or degradation process is initiated.

[0053] For example, see Figure 4 , Figure 4This invention provides a deployment-triggered dynamic IP update sequence diagram. The participants in this sequence flow include a deployment management system, containerized service instances, a service registry, and a unified traffic gateway (target entry point). The entire process is divided into three stages: deployment and registration, triggering and retrieval, and cache update, with an exception branch for retrieval failure. Stage 1 is deployment and registration: The deployment management system issues deployment instructions to deploy service instances; after deployment, the containerized service instances undergo state transition, moving to the ready state; the containerized service instances perform self-registration, registering their own IP, port, and bank service name (bank identity information) to the service registry. Stage 2 is triggering and retrieval: The deployment management system calls the network management interface to send an IP retrieval instruction, activating the dynamic routing processing module inside the unified traffic gateway (target entry point); the dynamic routing processing module uses the bank service name (bank identity information) as the search key to initiate a service instance query to the service registry; the service registry returns a structured instance list, carrying a list of service instance IPs (service instance list). Phase 3 Cache Update: The gateway parses the response message to extract the instance IPs, writes the instance list to the process-level high-speed cache (cache index), completes the second-level index update, and dynamically updates the routing table. If the instance list retrieval fails, the system enters the exception branch, executes retry logic, and triggers a retrieval failure alarm. This sequence ensures that the routing cache update is automatically triggered after service expansion, upgrades, and deployments are ready, without requiring any configuration modifications on the bank's side.

[0054] The method provided by this invention achieves centralized access for all bank traffic by replacing distributed front-end machines with a unified target entry point; it achieves identity differentiation among multiple banks at the same entry layer by assigning a unique listening port to each bank; it achieves high availability at the entry layer through primary / backup redundancy and virtual address drift; and it provides a data foundation for subsequent dynamic routing by building a cache index through service registration and dynamic retrieval. This solves the problems of high network coupling and complex high availability configuration caused by direct connection of the bank side to the front-end machine in the prior art.

[0055] S2. Determine the bank identity information corresponding to the request based on the source address and target port number of the request.

[0056] Specifically, the source address refers to the source Internet Protocol address of the request made by the bank, and the destination port number refers to the listening port number corresponding to the point where the request reaches the destination entry point. Bank identity information refers to the identifying information used to distinguish different banks.

[0057] In one possible implementation, determining the bank identity information corresponding to the request based on the source address and target port number of the request includes: querying a first-level index based on the combination of the source address and target port number of the request to obtain the bank identity information mapped by the combination.

[0058] When a bank's request reaches the target entry point, the entry point identifies the corresponding bank by parsing the target port number of the request. Since the target entry point assigns a unique listening port to each bank, the bank corresponding to the request can be uniquely identified through the target port number. Simultaneously, by combining the source address of the request with the target port number to form a composite key, joint identity verification of the request source is achieved. This means that not only is the bank corresponding to the port number verified, but also whether the source address of the request belongs to that bank, thus improving system security.

[0059] The method provided by this invention determines bank identity information by combining the source address and the destination port number, realizing multi-bank identity recognition and joint verification of request source based on port differentiation, and solving the problem of static and rigid routing caused by direct connection of the bank side to a fixed address port in the prior art.

[0060] S3. Query the cache index based on the bank identity information, and obtain the service instance list corresponding to the bank identity information based on the cache index.

[0061] Specifically, the cache index refers to the index structure stored in the target entry process-level cache area, used to quickly find the list of service instances corresponding to the bank's identity information, avoiding real-time queries to the service registry center for each request. The service instance list refers to the list of Internet Protocol addresses and port numbers of all service instances currently active for a particular bank.

[0062] In one possible implementation, the cache index is a two-level cache index, including a first-level index and a second-level index. The first-level index uses the combination of the bank's source address and port number as the index key to map to the corresponding bank identity information. The second-level index uses the bank identity information as the index key to store a list of service instances corresponding to the bank identity information.

[0063] The first-level index maps the request source to the bank's identity, while the second-level index maps the bank's identity to the instance set, thus forming a two-level index structure—the outer layer maps network endpoint identifiers to bank identities, and the inner layer maps bank identities to instance sets. The process-level cache contains both levels of indexes, respectively carrying runtime metadata for Transmission Control Protocol (TCP) long-connection services and Hypertext Transfer Protocol (HTTP) short-connection services.

[0064] In one possible implementation, the step of querying the cached index based on the bank identity information and obtaining the service instance list corresponding to the bank identity information based on the cached index includes: querying the second-level index based on the bank identity information to obtain the service instance list corresponding to the bank identity information.

[0065] Specifically, in S2, after determining the bank's identity information through the first-level index, the second-level index uses the bank's identity information as the index key to obtain a list of Internet Protocol addresses and port numbers for all instances corresponding to that bank. This eliminates the need to query the service registry in real time for each request, minimizing the overhead and latency of service discovery.

[0066] The method provided by this invention uses a two-layer cache index structure. The first layer verifies the identity of the request source, and the second layer enables fast lookup from the bank to the instance set. This avoids real-time querying of the registry center for each request, significantly reducing routing latency and registry center pressure. It also solves the problems of lack of unified management and rigid, static routing in the existing technology.

[0067] S4. Randomly select a target service instance from the list of service instances.

[0068] Specifically, the target service instance refers to the backend service instance to which this request will be routed.

[0069] In one possible implementation, when the service instance list contains multiple service instances, a service instance is randomly selected from the service instance list as the target service instance; when the service instance list contains only one service instance, that service instance is directly selected as the target service instance.

[0070] The random selection algorithm is used to evenly distribute traffic among multiple available service instances, achieving load balancing. When a bank has only a single service instance, that instance is selected directly, avoiding the additional overhead of the random algorithm.

[0071] For example, see Figure 5 , Figure 5 This invention provides a two-layer cache index structure and dynamic routing flowchart. Figure 5 As shown on the left, the process-level cache (cache index) maintains a two-layer index structure. The first-layer index is a configuration table, using a combination key consisting of the bank's source address and listening port as the index key to map to the corresponding bank service name (bank identity information), completing the joint identity verification of the request source. The second-layer index uses the bank service name (bank identity information) as the index key to store a list of all service instance IPs corresponding to that bank (service instance list). The process-level cache (cache index) maintains both a Transmission Control Protocol (TCP) long-connection configuration table and a Hypertext Transfer Protocol (HTTP) short-connection configuration table to adapt runtime metadata for two different request types. The service registry provides backend service instance metadata to the process-level cache (cache index). Figure 5The dynamic routing process on the right is as follows: After a request arrives at the gateway, the request source address and port are parsed, and the first-level index is queried to obtain the bank service name (bank identity information); the second-level index is then queried to obtain the list of instance IPs corresponding to the bank (service instance list); the number of instances is determined; if multiple instances exist, a target IP (target service instance) is randomly selected; if only a single instance exists, the instance IP (target service instance) is directly read; then a connection is established to route the request, and finally a response message is returned; the timeliness configuration file provides connection and response timeliness threshold configuration parameters for this process. This invention, through a two-level index, eliminates the need for real-time access to the service registry during request processing, reducing routing latency and registry access pressure.

[0072] The method provided by this invention achieves load balancing among service instances by randomly selecting target service instances from a list of service instances, thus solving the problems of uneven traffic distribution and inability to dynamically expand caused by the fixed direction of the bank side to a single front-end machine in the prior art.

[0073] S5. The request is routed to the target service instance.

[0074] Specifically, this step forwards the bank's request to the selected target service instance, completing the end-to-end delivery of the request.

[0075] In one possible implementation, the method further includes timeliness control and fault tolerance: reading the timeliness configuration of the corresponding bank, the timeliness configuration including connection timeliness threshold and response timeliness threshold; when the request is routed but no response is received after exceeding the response timeliness threshold, the current session connection is released; if the bank has multiple service instances, the current service instance is marked as temporarily unavailable and other service instances are selected for retry; if all service instances of the bank are unavailable, a preset fixed error code response is returned to the bank.

[0076] The connection timeout threshold limits the maximum time for establishing a connection, while the response timeout threshold limits the maximum time a request waits for a response. When a request has been routed but has not received a response after exceeding the preset timeout threshold, the dynamic routing module releases the current session connection and executes an error degradation strategy, ensuring service availability through retries or fixed error code responses.

[0077] In one possible implementation, the method further includes fault handling and operation and maintenance alarms: when a service instance fails and is deregistered by the service registry, subsequent request processing will no longer route traffic to the failed service instance; when any bank has a faulty node, a service monitoring alarm is triggered.

[0078] In one possible implementation, the method further includes traffic logging: logging traffic for each request route, writing the traffic logs to a local log file in a structured format, and cleaning up expired logs according to a preset period.

[0079] The method provided by this invention achieves fault tolerance and monitoring of request forwarding through timeliness control, fault handling, and traffic log recording, solving the problems of long fault switching time, difficulty in dynamic expansion, and lack of unified management in the prior art.

[0080] In one example, see Figure 6 , Figure 6 This invention provides a flowchart for request forwarding fault tolerance and monitoring. After a bank request arrives at the gateway, it queries the dual-layer cache index (cache index) and simultaneously records traffic logs: recording traffic logs, writing structured traffic logs to local logs, and cleaning up expired logs according to a preset period. After querying the index, it obtains a list of instance IPs (service instance list), selects a target instance (target service instance), and establishes a connection to route the request. It reads the timeout configuration to determine if the request has timed out; if not, it returns a normal response. If the request times out, it releases the current session connection and then checks the number of instances. If multiple instances exist, the current instance (current service instance) is marked as temporarily unavailable, and other instances (other service instances) are selected for retry. If only a single instance exists, a preset fixed error code is returned, and a service monitoring alarm is triggered. This process uses two parallel alarm mechanisms: when an instance fails and is deregistered by the service registry, subsequent routing to that failed instance (failed service instance) is no longer possible; all instance failures trigger instance-level fault alarms; request timeout failures trigger request timeout alarms. Two types of alarms run in parallel, covering two abnormal scenarios: instance failure and request timeout, respectively, to complete the entire chain of fault-tolerant retry, degradation return, and operation and maintenance alarm processing.

[0081] As described in S1-S5 above, the method provided in this embodiment of the invention receives requests sent by the bank side through the target entry point in S1, replacing the distributed front-end machines with a unified entry point; determines the bank's identity information based on the source address and target port number in S2, achieving multi-bank identity recognition with port differentiation; obtains the service instance list by querying the dual-layer cache index in S3, avoiding real-time queries to the registration center; randomly selects the target service instance from the service instance list in S4; and routes the request to the target service instance in S5, performing timeliness control, fault handling, and traffic log recording. The method provided by this invention solves the problems of high network coupling, lack of unified management and control at the access layer, complex high-availability configuration, difficulty in dynamic expansion, static and rigid routing, and low resource utilization caused by direct connection of the bank side to the front-end machine in the prior art.

[0082] To facilitate understanding of this solution, the following detailed explanation of the method provided in this embodiment of the invention will be provided with reference to a specific example.

[0083] In one example, an insurance company collaborates with multiple banks on bancassurance business. The routing system deploys a unified traffic gateway as the target ingress, assigning a unique listening port to each bank; for example, bank A is assigned port 8080, and bank B is assigned port 8081. Each bank's bancassurance service is deployed as a containerized service instance, automatically registering with the service registry upon startup.

[0084] After the service instance of Bank A is deployed and is in the ready state, the routing target update interface of the target entry is called. The dynamic routing processing module pulls the Internet Protocol address and port number of all active instances of Bank A from the service registry and writes them into the second-level index of the process-level cache. At the same time, the relationship between the combination key of Bank A's source address and port 8080 and Bank A's identity is written into the first-level index.

[0085] When a client of Bank A sends a request to the target ingress via a dedicated line, the target ingress resolves the request to the target port number 8080, uses the source address to query the first-level index to identify Bank A, and then queries the second-level index to obtain a list of service instances of Bank A. If Bank A has multiple instances, one instance is randomly selected as the routing target, and the request is forwarded to that instance. If the request times out and no response is received, the current instance is marked as transiently unavailable, and another instance is selected for retry; if all instances of Bank A are unavailable, a preset fixed error code is returned. When Bank A upgrades or expands its services, the dynamic fetch is triggered again after the new instance is ready, updating the second-level index. The bank can automatically detect backend changes without any configuration changes.

[0086] The foregoing primarily describes the solutions of the embodiments of the present invention from a methodological perspective. It is understood that, in order to achieve the above-mentioned functions, the routing system 100 includes at least one of the hardware structures and software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present invention.

[0087] In this embodiment of the invention, the routing system 100 can be divided into functional units according to the above method example. For example, the routing system 100 can be divided into functional units corresponding to various functions, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0088] For example, Figure 7 A schematic diagram of a routing system provided in an embodiment of the present invention is shown. The routing system 100 includes: a request receiving module 110, used to receive requests sent by a bank through a target entry point, wherein the target entry point assigns a unique listening port to each bank; an identity recognition module 120, used to determine the bank identity information corresponding to the request based on the source address and target port number of the request; an instance query module 130, used to query a cache index based on the bank identity information and obtain a list of service instances corresponding to the bank identity information based on the cache index, wherein the list of service instances includes at least one service instance; an instance selection module 140, used to randomly select a target service instance from the list of service instances; and a routing forwarding module 150, used to route the request to the target service instance.

[0089] It should be understood that specific descriptions of the above-mentioned optional methods can be found in the foregoing method embodiments, and will not be repeated here. Furthermore, explanations of any of the routing systems 100 provided above, as well as descriptions of their beneficial effects, can be found in the corresponding method embodiments described above, and will not be repeated here.

[0090] This invention also provides a computer-readable storage medium storing at least one computer instruction, which is loaded and executed by a processor to implement the methods of the various embodiments described above. Explanations of the relevant content and descriptions of the beneficial effects of any of the computer-readable storage media provided above can be found in the corresponding embodiments described above, and will not be repeated here.

[0091] This invention also provides a chip. This chip integrates a control circuit for implementing the functions of the routing system 100 described above, and one or more ports. Optionally, the functions supported by this chip are as described above, and will not be repeated here.

[0092] Those skilled in the art will understand that the program for implementing all or part of the steps of the above embodiments, which can be executed by a program instructing related hardware, can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.

[0093] This invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.

[0094] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present invention, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory. Those skilled in the art should recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0095] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for dynamic routing of multi-bank service requests, the method comprising: include: Receive requests sent by the bank through a target entry point, wherein the target entry point is assigned a unique listening port to each bank; The bank identity information corresponding to the request is determined based on the source address and destination port number of the request; The cache index is queried based on the bank identity information, and a list of service instances corresponding to the bank identity information is obtained based on the cache index. The list of service instances includes at least one service instance. Randomly select a target service instance from the list of service instances; The request is routed to the target service instance.

2. The method of claim 1, wherein, The cache index is a two-level cache index, including a first-level index and a second-level index. The first-level index uses the combination of the bank's source address and port number as the index key to map to the corresponding bank identity information. The second-level index uses the bank identity information as the index key to store a list of service instances corresponding to the bank identity information.

3. The method of claim 1, wherein, Before the request sent by the receiving bank through the target entry point, the following is also included: Each bank's service instance is registered with the service registry center, and each bank's service instance is registered with the corresponding bank's identity information.

4. The method of claim 3, wherein, The method further includes: When a service instance is deployed and is in a ready state, the latest list of service instances corresponding to that bank is retrieved from the service registry. Write the list of the latest service instances retrieved into the cache index.

5. The method of claim 2, wherein, Determining the bank identity information corresponding to the request based on the source address and destination port number includes: The first-level index is queried based on the combination of the source address and the target port number of the request to obtain the bank identity information mapped by the combination.

6. The method of claim 2, wherein, The step of querying the cached index based on the bank identity information and obtaining the service instance list corresponding to the bank identity information based on the cached index includes: The second-level index is queried based on the bank's identity information to obtain a list of service instances corresponding to that bank's identity information.

7. The method of claim 1, wherein, The method further includes: Read the timeliness configuration of the corresponding bank, which includes connection timeliness threshold and response timeliness threshold; If no response is received after the request has been routed and the response timeout threshold has expired, the current session connection is released. If the bank has multiple service instances, the current service instance is marked as temporarily unavailable and other service instances are selected for retry. If all service instances of the bank are unavailable, a preset fixed error code response is returned to the bank.

8. The method of claim 1, wherein, The method further includes: When a service instance fails and is deregistered by the service registry, subsequent request processing will no longer route traffic to the failed service instance. When any bank has a faulty node, a service monitoring alarm is triggered.

9. The method of claim 1, wherein, The target entry point adopts a primary-backup redundancy deployment, and virtual address drift is realized through a virtual routing redundancy protocol. When the primary node fails, the backup node takes over the traffic, and the virtual address drift is made imperceptible to the bank side through address mapping.

10. A system for dynamic routing of multi-bank service requests, the system comprising: include: The request receiving module is used to receive requests sent by the bank side through the target entry point, wherein the target entry point is assigned a unique listening port for each bank; The identity recognition module is used to determine the bank identity information corresponding to the request based on the source address and target port number of the request; An instance query module is configured to query a cache index according to the bank identity information and obtain a service instance list corresponding to the bank identity information based on the cache index, the service instance list including at least one service instance; An instance selection module is configured to randomly select a target service instance from the service instance list; A routing and forwarding module is configured to route the request to the target service instance.