Business processing method and apparatus, electronic device, storage medium, and program product
Patent Information
- Application Number
- CN202411472649.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2044-10-21
AI Technical Summary
[0003]相关技术中,在将访问请求由原业务服务切换至目标业务服务之后,原业务服务仍然会继续调度消息,造成消息的利用率较低
[0018] By performing traffic status detection on business services, the traffic status of the business services is obtained. The traffic status indicates whether the business service has stopped receiving access request traffic. Based on the traffic status, business messages in the message queue are scheduled. Thus, while a business service is responding to an access request from the application, and the access request switches to a second business service, the business service may respond to the target access request. However, since the business service has no access request, even if it responds to the target access request, it cannot send back the response result, resulting in message waste. By performing traffic status detection on the business services, the traffic status of the business services is obtained. Based on whether the business service has stopped receiving access request traffic as indicated by the traffic status, business messages in the message queue are scheduled to prevent message waste and effectively improve message utilization.
Smart Images

Figure CN119697180B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a business processing method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] Clustering technology, a technology that has emerged with the development of the internet, connects a group of independent computers through a high-speed network to form a cluster system that can be uniformly managed and scheduled. This system is used to handle various big data scenarios, thereby improving service scalability and reliability. To ensure the normal operation of big data scenarios, cluster systems typically store massive amounts of data to support various business operations within these scenarios.
[0003] In related technologies, after the access request is switched from the original business service to the target business service, the original business service will continue to schedule messages, resulting in low message utilization. Summary of the Invention
[0004] This application provides a business processing method, apparatus, electronic device, computer-readable storage medium, and computer program product that can effectively improve message utilization.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] This application provides a business processing method, including:
[0007] Traffic status detection is performed on the business service to obtain the traffic status of the business service. The traffic status is used to indicate whether the business service has stopped receiving access request traffic.
[0008] Based on the traffic status, business messages in the message queue are scheduled.
[0009] This application provides a business processing apparatus, including:
[0010] The detection module is used to detect the traffic status of the business service and obtain the traffic status of the business service. The traffic status is used to indicate whether the business service has stopped receiving access request traffic.
[0011] The response module is used to schedule business messages in the message queue based on the traffic status.
[0012] This application provides an electronic device, including:
[0013] Memory is used to store executable instructions or computer programs.
[0014] The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the business processing method provided in the embodiments of this application.
[0015] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the business processing method provided in this application.
[0016] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the business processing method described in this application embodiment.
[0017] The embodiments of this application have the following beneficial effects:
[0018] By performing traffic status detection on business services, the traffic status of the business services is obtained. The traffic status indicates whether the business service has stopped receiving access request traffic. Based on the traffic status, business messages in the message queue are scheduled. Thus, while a business service is responding to an access request from the application, and the access request switches to a second business service, the business service may respond to the target access request. However, since the business service has no access request, even if it responds to the target access request, it cannot send back the response result, resulting in message waste. By performing traffic status detection on the business services, the traffic status of the business services is obtained. Based on whether the business service has stopped receiving access request traffic as indicated by the traffic status, business messages in the message queue are scheduled to prevent message waste and effectively improve message utilization. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the architecture of the business processing system provided in the embodiments of this application;
[0020] Figure 2 This is a schematic diagram of the structure of an electronic device for business processing provided in an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of the structure of an electronic device for business processing provided in an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of the architecture of the distributed service system provided in the embodiments of this application;
[0023] Figure 5 This is a flowchart illustrating the business processing method provided in the embodiments of this application. Figure 1 ;
[0024] Figure 6 This is a flowchart illustrating the business processing method provided in the embodiments of this application. Figure 2 ;
[0025] Figure 7 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 1 ;
[0026] Figure 8 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 2 ;
[0027] Figure 9 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 3 ;
[0028] Figure 10 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 4 . Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0031] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0032] 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 this application.
[0033] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0034] 1) Business Services: Business services typically refer to components or services that perform specific business processing functions. They are responsible for executing corresponding logical processing based on access requests, such as data validation, business logic calculations, and data storage. A business service may be a module within an application or an external service.
[0035] 2) Application: An application is a program that runs on a computer's operating system and provides specific functions or services to the user. Applications are typically written by developers using a programming language and translated into machine-executable code by a compiler or interpreter. An application can be a desktop application (such as word processing software, spreadsheet software, etc.), a web application (such as online banking, social media platforms, etc.), or a mobile application (such as mobile games, navigation software, etc.). Applications can interact with users through a graphical user interface (GUI) or a command-line interface (CLI). An application can be a single software program or a series of cooperating software modules that together provide complex functions and services. The design and development of applications must consider factors such as user needs, usability, performance, security, and maintainability.
[0036] 3) Access Request Flow: This refers to the process where a user sends a request to an application through their browser, the application processes the request through its business services, and returns a response. Specifically, an access request includes the following steps: User input: The user enters a URL or submits a form through their browser, generating a web request. Sending the request: The user's browser sends the request to the web server. Business service processing: After receiving the request, the web server may process it through multiple business services, performing authentication, data processing, etc. Sending the response: After the business services complete their processing, they return the response to the web server. Returning the result: The web server returns the response result to the user's browser. Display: After receiving the response, the browser renders and displays the content based on the response (such as an HTML page).
[0037] 4) Pod: A Pod is the smallest unit that can be created and managed in Kubernetes. It is a collection of containers that share the same network namespace and storage volumes. A Pod typically contains one or more containers, along with shared resources for inter-container communication and storage. Containers within a Pod share the same network interface and storage volumes, meaning they can communicate with each other via localhost and access the same storage resources. Pods have their own lifecycle, including states such as creation, running, paused, resumed, and terminated. Pods are used to deploy and manage applications; they are the basic unit for Kubernetes to schedule and manage compute tasks.
[0038] 5) Cluster technology: This technology has emerged recently with the development of the Internet. It connects a group of independent computers through a high-speed network to form a cluster system that can be uniformly managed and scheduled. This system is used to handle various big data scenarios, thereby improving the scalability and reliability of services. To ensure the normal operation of big data scenarios, cluster systems typically store massive amounts of data to support various business operations within these scenarios.
[0039] 6) Responding to: used to indicate the conditions or states on which the operation is performed. When the conditions or states on which the operation is performed are met, one or more operations may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0040] 7) Distributed System: This refers to a distributed file system designed to run on commodity hardware. It shares many similarities with existing distributed file systems, but its differences are also significant. HDFS is a highly fault-tolerant system suitable for deployment on inexpensive machines. HDFS provides high-throughput data access, making it ideal for applications with large datasets. HDFS relaxes some POSIX constraints to enable streaming access to file system data. HDFS is highly fault-tolerant and designed for deployment on low-cost hardware. It provides high throughput access to application data, making it suitable for applications with very large datasets. HDFS relaxes POSIX requirements to enable streaming access to data in the file system.
[0041] 8) Cloud Technology: Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0042] During the implementation of the embodiments of this application, the applicant discovered the following problems with the related technology:
[0043] In related technologies, after the access request is switched from the original business service to the target business service, the original business service will continue to schedule messages, resulting in low message utilization.
[0044] This application provides a business processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can effectively improve message utilization. The following describes an exemplary application of the business processing system provided in this application.
[0045] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the business processing system 100 provided in the embodiments of this application. The terminal (terminal 400 is shown as an example) connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0046] Terminal 400 is used by users to access client 410 and display the application's interface on graphical interface 410-1 (graphical interface 410-1 is shown as an example). Terminal 400 and server 200 are interconnected via wired or wireless network.
[0047] In some embodiments, server 200 can be a standalone physical server, a server cluster or business system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Terminal 400 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smart TV, smartwatch, in-vehicle terminal, etc., but is not limited to these. The electronic device provided in this application embodiment can be implemented as a terminal or a server. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application embodiment.
[0048] In some embodiments, server 200 performs traffic status detection on the service to obtain the traffic status of the service, and sends the traffic status of the service to terminal 400. Terminal 400 schedules the service messages in the message queue based on the traffic status.
[0049] In other embodiments, terminal 400 performs traffic status detection on the service to obtain the traffic status of the service, and sends the traffic status of the service to server 200. Server 200 schedules service messages in message queue based on the traffic status.
[0050] In other embodiments, the embodiments of this application can be implemented with the aid of cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize the computation, storage, processing, and sharing of data.
[0051] Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, allowing for on-demand use with flexibility and convenience. Cloud computing technology will become a crucial support. The backend services of cloud computing systems require substantial computing and storage resources.
[0052] See Figure 2 , Figure 2 This is a schematic diagram of the structure of an electronic device 500 for business processing provided in an embodiment of this application, wherein, Figure 2 The electronic device 500 shown can be Figure 1 Server 200 or terminal 400 in the middle, Figure 2The illustrated electronic device 500 includes at least one processor 430, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 440.
[0053] Processor 430 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0054] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 430.
[0055] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0056] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0057] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0058] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, such as Bluetooth, WiFi, and Universal Serial Bus.
[0059] In some embodiments, the service processing apparatus provided in this application can be implemented in software. Figure 2 A service processing device 455 stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a detection module 4551 and a response module 4552. These modules are logically linked and can therefore be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0060] See Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device for business processing provided in an embodiment of this application, wherein, Figure 3 The electronic device 600 shown can be Figure 1 Server 200 or terminal 400 in the middle, Figure 3 The illustrated electronic device 600 includes at least one processor 530, a memory 550, and at least one network interface 520. The various components in the electronic device 600 are coupled together via a bus system 540. It is understood that the bus system 540 is used to implement communication between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 3 The general labeled all buses as Bus System 540.
[0061] Processor 530 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0062] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices physically located away from the processor 530.
[0063] The memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory.
[0064] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0065] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0066] The network communication module 552 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, such as Bluetooth, WiFi, and Universal Serial Bus.
[0067] In some embodiments, the service processing apparatus provided in this application can be implemented in software. Figure 3 A service processing device 555 stored in memory 550 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a switching module 5551. These modules are logically linked and can therefore be arbitrarily combined or further split according to the functions they implement. The functions of each module will be described below.
[0068] In other embodiments, the service processing apparatus provided in this application can be implemented in hardware. As an example, the service processing apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the service processing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0069] In some embodiments, the terminal or server can implement the business processing method provided in the embodiments of this application by running a computer program or computer-executable instructions. For example, the computer program can be a native program in the operating system (e.g., a dedicated business processing program) or a software module, such as a business processing module that can be embedded in any program (e.g., an instant messaging client, a photo album program, an electronic map client, a navigation client); for example, it can be a native application (APP), that is, a program that needs to be installed in the operating system to run. In summary, the above-mentioned computer program can be any form of application, module, or plug-in.
[0070] The business processing methods provided in the embodiments of this application will be described in conjunction with exemplary applications and implementations of the servers or terminals provided in the embodiments of this application.
[0071] In some embodiments, the business processing methods provided in this application can be applied to distributed service systems, see [link to relevant documentation]. Figure 4 , Figure 4 This is a schematic diagram of the architecture of a distributed service system provided in an embodiment of this application. The distributed service system provided in this embodiment includes at least a management service and a business service cluster, and the business service cluster includes multiple business services. For example, Figure 4 The distributed service system shown includes management service 40, business service 41, business service 42, business service 43, business service 44 and resource service 45.
[0072] See Figure 5 , Figure 5 This is a flowchart illustrating the business processing method provided in the embodiments of this application. Figure 1 , will combine Figure 5 Steps 101 to 102 shown will be explained. The business processing method provided in this application embodiment can be implemented by the server or the terminal alone. The following will take the implementation by the server alone as an example to explain the business processing method provided in this application embodiment from the perspective of business services.
[0073] In step 101, traffic status detection is performed on the service to obtain the traffic status of the service.
[0074] In some embodiments, traffic status is used to indicate whether a service has stopped receiving access request traffic.
[0075] In some embodiments, a business service typically refers to a component or service that performs specific business processing functions. It is responsible for performing corresponding logical processing based on access requests, such as data validation, business logic calculation, and data storage. A business service may be a module within an application or an external service.
[0076] In some embodiments, step 101 above can be implemented as follows: if the service is a service that responds to the access request, then the traffic status is determined to be that the service receives the access request traffic; if the service is not a service that responds to the access request, then the traffic status is determined to be that the service stops receiving the access request traffic.
[0077] In some embodiments, if the business service is designed to respond to a specific access request (that is, the service is the appropriate service to handle this type of request), then the traffic state is determined to be "The business service receives access request traffic, which means that the traffic will be directed to the business service and processed by it. In this state, the business service should be active, able to handle incoming requests, and able to manage the flow of this traffic to ensure that the service responds correctly."
[0078] In some embodiments, if the service is not the appropriate service to handle the access request (that is, it should not respond to this type of request), then the traffic state is determined to be that the service stops receiving access request traffic. This means that traffic will not be directed to the service, or the service will refuse to process these requests. In this state, the service may be inactive, or it may be configured not to respond to such requests. This may involve traffic redirection, or simply dropping requests that are irrelevant to the service.
[0079] In this way, by accurately defining the responsibilities and traffic status of business services, resource allocation can be effectively optimized and system performance improved. Traffic is correctly directed to the business services responsible for responding to access requests, ensuring service specialization and efficiency, thereby reducing unnecessary service processing burdens. At the same time, for non-responsive services, promptly blocking them from receiving access request traffic avoids waste of service resources, enhances security and stability, and ensures the rational flow of traffic and overall operational efficiency.
[0080] In step 102, business messages in the message queue are scheduled based on traffic status.
[0081] In some embodiments, step 102 above can be implemented as follows: in response to the traffic reception status indicating that the service stops receiving access request traffic, the service identifies the access requests in the access request traffic and obtains the identification result; in response to the identification result indicating that there is a target access request in the access request that has not been responded to by the service, the service message in the message queue is stopped from being scheduled.
[0082] In some embodiments, the above-mentioned response identification of access requests in access request traffic to obtain identification results can be achieved in the following way: for each access request in access request traffic, obtain the response information of the access request, the response information is used to indicate whether the access request is accessed by the business service; and determine the identification result based on the response information of each access request.
[0083] In some embodiments, the determination of the identification result based on the response information of each access request can be achieved in the following way: if the response information of an access request indicates that the access request has not been accessed by the business service, then the identification result is determined to be that there is a target access request in the access request that has not been responded to by the business service; if the response information of an access request does not indicate that the access request has not been accessed by the business service, then the identification result is determined to be that there is no target access request in the access request that has not been responded to by the business service.
[0084] In some embodiments, before performing response identification on the access requests in the access request traffic and obtaining the identification result, the following processing may also be performed: obtaining the response progress of the business service to the access request; if the response progress indicates that the access request has not been responded to by the business service, then the access request is determined as the target access request.
[0085] In some embodiments, the above-mentioned response identification of access requests in access request traffic to obtain identification results can be achieved in the following way: if the number of target access requests is at least one, then the identification result is determined to be that there is at least one target access request that has not been responded to by the business service among the access requests received by the business service.
[0086] In some embodiments, during the process of a business service responding to an application's access request, in response to the access request switching to a second business service, that is, the first business service stops receiving access request traffic, and there is a target access request that was not responded to by the first business service in the access requests received by the first business service (that is, the identification result described above indicates that there is a target access request that was not responded to by the business service). A stop instruction is generated.
[0087] In some embodiments, the stop instruction is used to trigger the first service to stop acquiring messages for responding to the access request and not to respond to the target access request. That is, the stop instruction stops the scheduling of service messages in the message queue.
[0088] In some embodiments, during the process of a business service responding to an access request from an application, and the access request is switched to a second business service, the business service cannot respond to access requests that have not been received. If there is a target access request among the access requests received by the first business service that has not been responded to by the first business service, the business service may respond to the target access request, thus continuing to schedule messages. However, since the business service has no access request at this time, it cannot feed back the response result of the target business request to the management service, resulting in message waste. By generating a stop command, the first business service is triggered to stop acquiring messages for responding to access requests and does not respond to the target access request, thereby stopping the waste of messages and effectively improving message utilization.
[0089] In some embodiments, a business service typically refers to a component or service that performs specific business processing functions. It is responsible for performing corresponding logical processing based on access requests, such as data validation, business logic calculation, and data storage. A business service may be a module within an application or an external service.
[0090] In some embodiments, an application refers to a program running on a computer's operating system that provides specific functions or services to a user. Applications are typically written by developers using a programming language and translated into machine-executable code by a compiler or interpreter. An application can be a desktop application (such as word processing software, spreadsheet software, etc.), a web application (such as online banking, social media platforms, etc.), or a mobile application (such as mobile games, navigation software, etc.). Applications can interact with users through a graphical user interface (GUI) or a command-line interface (CLI). An application can be a single software program or a series of cooperating software modules that together provide complex functions and services. The design and development of applications must consider factors such as user needs, usability, performance, security, and maintainability.
[0091] In some embodiments, an access request flow refers to the process by which a user sends a request to an application through a browser, the application processes the request through business services, and returns a response. Specifically, an access request includes the following steps: User input: The user enters a URL or submits a form through their browser, generating a web request. Sending the request: The user's browser sends the request to the web server. Business service processing: After receiving the request, the web server may process it through multiple business services, performing authentication, data processing, etc. Sending the response: After the business services complete their processing, they return the response to the web server. Returning the result: The web server returns the response result to the user's browser. Display: After receiving the response, the browser renders and displays the content based on the response (such as an HTML page).
[0092] As an example, see Figure 4 Taking business service 41 as an example, traffic status detection is performed on the business service to obtain the traffic status of the business service. The traffic status of business service 41 is used to indicate whether the business service has stopped receiving access request traffic.
[0093] As an example, see Figure 4 Taking business service 41 as an example, during the process of business service 41 responding to the access request of application 30, business service 41 switches to a second business service (a second business service other than business service 41, such as business service 42, business service 43 and business service 44) in response to the access request, and there is a target access request in the access request received by the first business service 41 that has not been responded to by the first business service 41, business service 41 generates a stop instruction.
[0094] Thus, during the process of a business service responding to an application's access request, if the access request switches to a second business service, the business service cannot respond to access requests that have not been received. If there are target access requests among the access requests received by the business service that have not been responded to by the business service, the business service may respond to the target access request, leading to continued message scheduling. However, since the business service cannot feed back the response result of the target business request to the management service at this time, it results in message waste. By generating a stop command, the first business service is triggered to stop obtaining messages for responding to the access request and does not respond to the target access request, thereby stopping the waste of messages and effectively improving message utilization.
[0095] In some embodiments, during the process of the first service responding to the access request of the application, it can be determined whether the access request has switched to the second service in the following ways: identifying at least one target service that needs to respond to the access request; if the first service is the target service, then determining that the access request has not switched to the second service; if the first service is not the target service, then determining that the access request has switched to the second service.
[0096] In some embodiments, since at least one target business service that needs to respond to the access request is the destination to which the access request needs to flow, it is determined whether the business service is the target business service, thereby determining whether the business service is the destination to which the access request needs to flow, and thus determining whether the access request has switched to the second business service. If the business service is not the destination to which the access request needs to flow, it is determined that the access request has switched to the second business service; if the business service is not the destination to which the access request needs to flow, it is determined that the access request has not switched to the second business service.
[0097] In this way, by identifying the target business service that needs to respond to the access request, the system can avoid unnecessary processing and resource waste. This means that only the relevant business service will be activated to handle the request, rather than all services. If the current business service is the target business service, the system confirms that the access request has not switched to a second business service. This helps ensure that the request is processed continuously on a single service, avoiding potential problems caused by requests jumping between different services. If the current business service is not the target business service, the system can promptly determine that the request flow has switched to a second business service. This helps to quickly respond to changes in system load or failures, thereby maintaining service availability and stability. Through this logic, the system can avoid processing the same request flow repeatedly. If a request flow has already been processed on another service, the current service will not process it again, thus preventing data inconsistency and resource waste.
[0098] In some embodiments, the above-mentioned response to the identification result indicating that there is a target access request in the access request that has not been responded to by the service can be implemented in the following manner: In response to the identification result indicating that there is a target access request in the access request that has not been responded to by the service, determine whether there is a reference access request in the access request that has been responded to by the service; if there is a reference access request in the access request that has been responded to by the service, determine the response progress of the service to each reference access request; if the response progress of each reference access request indicates that the service has completed responding to the reference access request, then stop scheduling the service messages in the message queue.
[0099] In some embodiments, the above-mentioned response to the access request switching to the second service, and the first service receiving access requests containing target access requests that have not been responded to by the first service, generating a stop instruction can be implemented as follows: In response to the access request switching to the second service, and the first service (i.e., the service described above) receiving access requests containing target access requests that have not been responded to by the first service, determine whether there are any reference access requests that have been responded to by the first service among the access requests received by the first service; if there are at least one reference access request that has been responded to by the first service among the access requests received by the first service, determine the response progress of the first service to each reference access request; if the response progress of each reference access request indicates that the first service has completed responding to the reference access request, stop scheduling service messages in the message queue.
[0100] In some embodiments, the aforementioned reference access requests that have been responded to by the service include reference access requests that have been completed by the service response and reference access requests that have not been completed by the service response.
[0101] In some embodiments, when the access request is switched to the second service, and the first service receives a target access request that has not been responded to by the first service, the access request received by the service may include a reference access request that has been responded to by the first service. Since the stop command will prevent the service from obtaining the message, the response to the reference access request cannot be made. Therefore, the stop command needs to be generated after the response to the second service is completed to ensure that the response to the reference access request can be made normally.
[0102] In some embodiments, the above response progress is used to indicate that the service has completed responding to the reference access request.
[0103] In some embodiments, after determining the response progress of the first service (i.e., the service described above) to each of the reference access requests, the following processing may also be performed: if the response progress of a reference access request indicates that the first service (i.e., the service described above) has not completed responding to the reference access request, then the reference access request that has not been responded to is determined as a candidate access request; for the candidate access request, the reference access request is responded to based on the service message until the response to the reference access request is completed; if the first service has completed responding to each of the candidate access requests, then the scheduling of service messages in the message queue is stopped.
[0104] In some embodiments, if the response progress of the reference access request indicates that the first service has not completed responding to the reference access request, then the response to the candidate access request needs to be completed before generating the stop instruction, that is, responding to the reference access request based on the service message until the response to the reference access request is completed.
[0105] In some embodiments, after the business service has completed responding to each candidate access request, the business service does not need to use messages. At this time, stop resources are generated, which effectively reduces message waste and ensures that all access requests that have started responding can be completed by the business service.
[0106] In this way, by monitoring response progress, the business service can ensure that each responded access request is fully processed and responded to. If the business service has not yet completed responding to a reference access request, the request will be marked as a candidate access request to ensure that it can continue to be processed. The candidate access request is processed based on the information already obtained, meaning that resources are fully utilized and are not wasted due to incomplete processing of requests. The service can continue processing candidate access requests without interrupting the current processing flow, thus reducing downtime and improving processing efficiency.
[0107] In some embodiments, after generating the stop instruction, the following processing may also be performed: sending the stop instruction to the message provider of the message, the stop instruction being used to trigger the message provider to stop sending the message to the first service and to send the target access request to the second service.
[0108] In some embodiments, the service sends a stop instruction to the message provider, causing the message provider to stop sending messages to the service, and sends the target access request that was not responded to by the service to a second service for response, thereby ensuring that the target access request can be responded to.
[0109] As an example, see Figure 4 Taking business service 42 as an example, business service 42 sends a stop command to the message provider (resource service 45). The stop command is used to trigger the message provider (resource service 45) to stop sending messages to business service 42, and resource service 45 sends the target access request to the second business service.
[0110] Thus, the stop command can promptly notify the message provider to cease sending messages to the current business service, preventing unnecessary resource allocation, especially when the service no longer needs these resources. When a business service is unable to continue processing requests due to failure or other reasons, the stop command can quickly trigger resource reallocation, facilitating rapid recovery and continuous service. The stop command, combined with the resource reallocation mechanism, helps achieve system load balancing, preventing situations where some services are overloaded while others are idle. By sending the target access request to a secondary business service, it can be ensured that even when some business services are unable to continue operating, services can continue to be provided seamlessly, guaranteeing the continuity and reliability of business services.
[0111] In some embodiments, after responding to a traffic reception status indication that the service stops receiving access request traffic, identifying the access requests in the access request traffic, and obtaining the identification result, the following processing may also be performed: in response to the identification result indicating that there are no target access requests in the access requests that have not been responded to by the service, determining the response progress of each access request received by the service; for each access request, if the response progress of the access request indicates that the service has not completed responding to the access request, then responding to the access request based on the service message until the response to the access request is completed.
[0112] In some embodiments, during the process of the first service (i.e., the service described above) responding to the access request of the application, the following processing may also be performed: in response to the access request switching to the second service, and if there is no target access request that has not been responded to by the first service among the access requests received by the first service, the response progress of each access request in the access requests received by the first service is determined; for each access request, if the response progress of the access request indicates that the first service has not completed the response to the access request, the access request is responded to based on the service message until the response to the access request is completed; if the first service has completed the response to each access request, a resource rejection instruction is generated.
[0113] In some embodiments, the resource rejection instruction is used to trigger the first service to stop acquiring messages used to respond to the access request.
[0114] In some embodiments, when the access request is switched to the second service and there is no target access request that has not been responded to by the first service among the access requests received by the first service, the service has already started responding to all received access requests. However, it is unknown whether the service has completed responding to all access requests. In this case, the response progress of each received service request can be determined. If the service has completed responding to all access requests, a resource rejection instruction can be generated to trigger the first service to stop obtaining messages for responding to the access requests.
[0115] In some embodiments, after generating a resource rejection instruction, a resource rejection instruction is sent to the management service to cause the management service to stop sending messages to the business service in response to access requests.
[0116] As an example, see Figure 4 Taking business service 43 as an example, after business service 43 generates a resource rejection instruction, business service 43 then sends a message to management service 40 to respond to the access request.
[0117] In some embodiments, after the first service stops acquiring messages for responding to the access request, the following processing may also be performed: during the process of the first service stopping responding to the access request of the application, in response to the access request being switched from the second service to the first service, a recovery instruction is generated; the recovery instruction is used to trigger the first service to resume acquiring messages for responding to the access request and to respond to the access request switched to the first service.
[0118] In some embodiments, during the process where the first service stops responding to the access request of the application, in response to the access request being switched from the second service to the first service, the service needs to resume responding to the access request. Since the service has stopped acquiring messages for responding to the access request during the process of the service stopping responding to the access request of the application, and it needs to resume acquiring messages for responding to the request stream, a recovery instruction is generated to trigger the first service to resume acquiring messages for responding to the access request and to respond to the access request switched to the first service.
[0119] Thus, when an access request switches back to the original business service from the secondary business service, the recovery command helps optimize the load distribution of the entire system, preventing some services from being overloaded while others are idle. Through recovery commands, business services acquire resources only when needed, which helps reduce resource waste and improve resource utilization. The ability to quickly respond to service status changes allows business services to recover quickly, improving system availability. The recovery command mechanism enables business services to recover quickly from failures, enhancing the system's fault recovery capabilities. Recovery commands support elastic scaling when facing different workloads, allowing the system to adapt to different business needs.
[0120] In some embodiments, during the process where the first service stops responding to the access request of the application, the following processing may also be performed: determining at least one target service that currently needs to respond to the access request; if the first service is the target service, determining that the access request has been switched from the second service to the first service; if the first service is not the target service, determining that the access request has not been switched from the second service to the first service.
[0121] In some embodiments, during the process of stopping the response to the access request of the application, a service acquisition request may be sent to the management service so that the management service can query at least one target business service that currently needs to respond to the access request, and the business service receives at least one target business service that currently needs to respond to the access request.
[0122] In some embodiments, if the first service is the target service, it means that the service can receive the access request, and it can be determined that the access request has been switched from the second service to the first service.
[0123] In some embodiments, if the first service is not the target service, it means that the service cannot receive the access request. In this case, it can be determined that the access request has not been switched from the second service to the first service.
[0124] Thus, by identifying the target business service, it becomes clear which services should be responsible for responding to specific access requests. This helps avoid confusion of responsibilities among services and duplication or omissions in request processing. If a business service identifies itself as the target business service, it can ensure that access requests are correctly routed to the service that should handle them, thereby optimizing request distribution and routing. When a business service identifies itself as not being the target business service, it can avoid processing request flows that are not its responsibility, reducing unnecessary computation and network overhead. Ensuring that only the target business service handles specific request flows avoids conflicts and competition between multiple services, improving the overall processing efficiency of the system. By correctly switching and distributing access requests, more effective load balancing can be achieved, preventing some services from being overloaded while others remain idle.
[0125] Thus, by performing traffic status detection on the business service, the traffic status of the business service is obtained. The traffic status is used to indicate whether the business service has stopped receiving access request traffic. Based on the traffic status, business messages in the message queue are scheduled. Thus, while the business service is responding to the application's access request, and the access request switches to a second business service, the business service may respond to the target access request. However, since the business service has no access request, even if it responds to the target access request, it cannot send back the response result, resulting in message waste. By performing traffic status detection on the business service, obtaining the traffic status of the business service, and scheduling business messages in the message queue based on whether the business service has stopped receiving access request traffic as indicated by the traffic status, message waste is prevented, thereby effectively improving message utilization.
[0126] See Figure 6 , Figure 6 This is a flowchart illustrating the business processing method provided in the embodiments of this application. Figure 2 , will combine Figure 6 The step 201 shown will be explained. The business processing method provided in this application embodiment can be implemented by the server or the terminal alone. The following will take the implementation by the server alone as an example to explain the business processing method provided in this application embodiment from the perspective of management service.
[0127] In step 201, during the process of sending an access request to the business service, in response to a service switching instruction, the access request is switched to the second business service.
[0128] In some embodiments, the service switching instruction is used to trigger the first service service to generate a stop instruction when there is a target access request among the access requests received by the first service service that has not been responded to by the first service service.
[0129] In some embodiments, the stop instruction is used to trigger the first service to stop acquiring messages for responding to the access request and not to respond to the target access request.
[0130] In some embodiments, the service switching instruction may be generated by the management service when a business service fails or the business service is overloaded. In this case, by generating the service switching instruction, the access request is switched to a second business service in response to the service switching instruction. The service switching instruction may also be generated in response to the triggering of the administrator, that is, the administrator actively switches the business service of the access request.
[0131] In some embodiments, before sending the access request to the first service, the service may be determined by: receiving the access request from the service program; and determining the candidate service whose service performance is greater than a performance threshold from among multiple candidate service services as the first service that needs to respond to the access request.
[0132] In some embodiments, the aforementioned service performance may include service processing capacity, service response time, service throughput, service load, service availability, service scalability, service concurrency, and service resource utilization. Service processing capacity refers to the maximum number of requests or data that a business service can process per unit of time, typically related to factors such as CPU speed, memory size, storage capacity, and network bandwidth. Service response time refers to the time required for a business service to return a response after receiving a request. A shorter response time indicates stronger service processing capacity and a better user experience. Service throughput refers to the amount of data or requests that a business service successfully processes per unit of time. Throughput is one of the important indicators for measuring service performance. Service load refers to the workload currently being processed by the business service. Excessive load may lead to a decrease in service performance and needs to be adjusted through load balancing strategies. Service availability refers to the ability of a business service to continuously provide services. Highly available services mean that they can recover quickly in the event of a failure, ensuring service continuity.
[0133] As an example, see Figure 4 The management service 40 receives the access request from the application 30 and determines the first service that needs to respond to the access request as the candidate service whose service performance is greater than the performance threshold among multiple candidate service services (e.g., service service 41, service service 42, service service 43 and service service 44).
[0134] In this way, by selecting candidate services whose performance exceeds the performance threshold, the system can ensure that access requests are responded to by services capable of efficient processing, thereby improving overall processing efficiency. Access requests can be allocated based on the actual performance of services, avoiding assignment to low-performance services that may not respond promptly, thus optimizing resource allocation and utilization. Selecting higher-performance services to handle access requests helps ensure service response speed and stability, thereby improving user satisfaction. When the system needs to be scaled up, new business services can be added based on performance thresholds, helping the system quickly adapt to increased business volume. Running the system on higher-performance services reduces maintenance and troubleshooting costs caused by performance issues. Requests will not be assigned to services with performance below the threshold, thus avoiding unnecessary resource allocation and reducing resource waste.
[0135] In some embodiments, after the access request is switched to the second service, the following processing may also be performed: in response to the second service being unable to respond to the access request, the access request is switched from the second service to the first service.
[0136] In some embodiments, after the access request is switched to the second service, the second service may be unable to respond to the access request due to service failures or other reasons. In this case, the management service may switch the access request from the second service to the first service in response to the inability of the second service to respond to the access request, so as to ensure the response to the access request.
[0137] Thus, when the second service cannot respond to access requests, the request flow can be switched back to the original service in a timely manner, which helps maintain service continuity and improves system reliability. This enables rapid fault response, allowing for quick recovery to the original service when a new service is detected as unable to handle requests, enhancing fault recovery capabilities. Through the switchback operation, the system avoids resource waste caused by the inability of the second service to handle requests, ensuring efficient resource utilization. Ensuring that access requests are processed on a high-performance service helps guarantee service quality and stability. User requests receive timely responses, and the user experience is not significantly affected even during service switching. The load can be dynamically adjusted based on the actual operating status of the business services; if the new service cannot handle the request, the system can quickly redistribute the load to the original service.
[0138] The following will describe an exemplary application of the embodiments of this application in a real business processing scenario.
[0139] Consider a specific scenario: Application A relies on the Kafka SDK to consume messages for business processing, and is deployed using two Pods on Kubernetes. Now, a new version of Application A needs to be released. This new version is deployed to the two Pods, and traffic to the old version's two Pods is shut down, while traffic to the new version's two Pods is turned on. If the new version's verification fails, it can be quickly rolled back to the old version. In this case, the old version's two Pods are not deleted; only their traffic is shut down. The requirement is that when the old version's Pods have their traffic shut down, they should also stop consuming Kafka messages. This solution can achieve this. This application enables Kubernetes to synchronously change the application's Kafka message consumption behavior when switching Pod traffic. It ensures that the Pod with its traffic shut down will not compete with the normally providing Kafka messages. It also avoids erroneous data caused by the old version's Pods continuing to consume Kafka messages even when their traffic is shut down, leading to different behaviors between the old and new versions when a new version of the application is released.
[0140] In some embodiments, see Figure 7 , Figure 7 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 1 When deploying application A to a Kubernetes environment using containers, application A needs to explicitly specify loading the Kafka proxy consumer plugin developed in this application embodiment. This plugin is implemented based on Java Instrumentation bytecode enhancement technology. When application A starts, the Kafka proxy consumer plugin automatically scans the Kafka client SDK and replaces the original Kafka client's consumer API class with the proxy consumer class of the Kafka proxy consumer plugin. Thus, when application A subscribes to a Kafka Topic and consumes messages, the Kafka proxy consumer plugin will determine whether to actually subscribe to the Kafka Topic or consume messages based on the current Pod's traffic status. #Startup command for application A, / opt / ext / kafkaConsumerAgent.jar is the path where the Kafka proxy consumer plugin is located java-javaagent: / opt / ext / kafkaConsumerAgent.jar is the JAR file of application A. At this time, when application A starts, the original method call stack for connecting to Kafka and consuming messages is changed. The Kafka agent consumption plugin continuously listens to the UnixSocket at / var / run / agentListner.sock in the local path, and receives traffic switching instructions from the current Pod to dynamically enable or disable the process to consume Kafka messages.
[0141] In some embodiments, see Figure 8 , Figure 8This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 2 When the Pod deployed for application A starts successfully, the Kafka agent consumer plugin will not consume messages in the Kafka queue by default. The KafkaConsumerController (implemented based on Kubernetes custom controller functionality) provided in this embodiment needs to notify the Kafka agent consumer plugin before it will actually consume messages in the Kafka queue. The KafkaConsumerController continuously monitors the endpoint status of services 1 and 2 corresponding to application A. When an endpoint becomes open to traffic, the KafkaConsumerController will use the Kubernetes API to start consuming messages in the Kafka Topic from the kafkaConsumerAgent in the Pod corresponding to that endpoint (e.g., application A-consumer in service 1, application A-consumer in service 2). Figure 8 After the application is started, the Pod does not have any traffic enabled, and the Kafka broker consumption plugin does not consume messages by default.
[0142] In some embodiments, # / var / run / agentListner.sock is the address that the Kafka agent consumer plugin listens on, and open=true means that Kafka consumption is enabled. curl --unix-socket / var / run / agentListner.sock ocalhost / kafkaConsumer / switch? open=true.
[0143] In some embodiments, see Figure 9 , Figure 9 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 3Traffic to Service 1 is open, while traffic to Service 2 is not. When the endpoint in Service 1 appears in the list of endpoints provided by Application A, meaning traffic will be dispatched to Service 1, the consumer controller detects the change in Application A's endpoint and notifies the consumer control plugin in Service 1 to start consuming messages from the Kafka Topic. The notification method is also a UnixSocket communication mechanism. The KafkaConsumerController uses the Kubernetes API to execute the curl command in the Pod to connect to ` / var / run / agentListner.sock` and send the command: `# / var / run / agentListner.sock is the address that the Kafka agent consumer plugin listens on, open=true` means to enable Kafka consumption. `curl --unix-socket / var / run / agentListner.sock localhost / kafkaConsumer / switch? open=true`
[0144] In some embodiments, see Figure 10 , Figure 10 This is a schematic diagram of the business processing method provided in the embodiments of this application. Figure 4When the endpoint in Pod1 is removed from the list of endpoints provided by application A, meaning traffic dispatch to Pod1 is stopped, the KafkaConsumerController detects the change in application A's endpoint and notifies the kafkaConsumerAgent in Pod1 to stop consuming messages from the Kafka Topic. The notification method uses the UnixSocket communication mechanism. The KafkaConsumerController executes a curl command in the Pod via the Kubernetes API to connect to ` / var / run / agentListner.sock` and send the command: `# / var / run / agentListner.sock is the address listened to by the Kafka agent consumption plugin, open=false means stop Kafka consumption; curl --unix-socket / var / run / agentListner.sock localhost / kafkaConsumer / switch? open=false`. Deploying a custom KafkaConsumerController to the Kubernetes cluster means the KafkaConsumerController will continuously listen to the application's endpoint, and when traffic to the Pod changes, the endpoint will also change. When an application is deployed using Kubernetes, the KafkaConsumerAgent plugin needs to be specified in the startup parameters. This plugin listens on a specified UnixSocket path to receive notifications. When the application's Pod traffic changes, the endpoint changes. Upon detecting this change, the KafkaConsumerController will notify the KafkaConsumerAgent plugin via UnixSocket communication in the corresponding Pod through the Kubernetes API server to adjust its Kafka message consumption behavior.
[0145] This application enables Kubernetes to synchronously change the behavior of applications consuming Kafka messages when switching traffic to a Pod. This ensures that Pods with traffic shut down do not compete with Pods that are still providing services for Kafka messages. It also avoids data errors caused by older Pods continuing to consume Kafka messages even when traffic is shut down, leading to different behaviors between the old and new versions when a new version of the application is released. It is non-intrusive to the application code, using Java Instrumentation bytecode enhancement technology to enhance the application's Kafka SDK runtime agent (i.e., the kafkaConsumerAgent mentioned above), allowing developers to achieve the desired effect without modifying their code. The KafkaConsumerController, developed using Kubernetes' custom controller functionality, can monitor changes to the endpoint corresponding to the Pod in real time. Events indicating changes in Pod traffic are immediately notified to the KafkaConsumerController, which in turn uses the Kubernetes API to notify the kafkaConsumerAgent to change its Kafka message consumption behavior. This synchronous, real-time change management consumes fewer resources and aligns better with cloud-native technology stacks and concepts. The KafkaConsumerAgent plugin in this application uses the UnixSocket communication method to listen for notifications of Kafka consumption status switching. This method differs from the common TcpSocket communication method, offering higher transmission efficiency and greater compatibility, and avoiding conflicts with the network ports used by the application itself. Based on this principle, the application scope is not limited to Kafka message middleware; other types of middleware such as RabbitMQ and ActiveMQ can also achieve similar results.
[0146] Thus, during the process of a business service responding to an application's access request, if the access request switches to a second business service and the business service receives a target access request that has not been responded to, a stop command is generated. This stop command triggers the first business service to stop acquiring messages for responding to the access request and not to respond to the target access request. Therefore, while the business service is responding to the application's access request, and the access request switches to the second business service, the business service might respond to the target access request. However, since the business service has no access request, even if it responds to the target access request, it cannot provide a response result, leading to message waste. By generating a stop command to trigger the first business service to stop acquiring messages for responding to the access request and not to respond to the target access request, the waste of messages is stopped, thereby effectively improving message utilization.
[0147] It is understood that in the embodiments of this application, data such as messages are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0148] The following description continues to illustrate the exemplary structure of the service processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the service processing device 455 in the memory 450 may include: a detection module, used to detect the traffic status of the service and obtain the traffic status of the service, wherein the traffic status is used to indicate whether the service stops receiving access request traffic; and a response module, used to schedule service messages in the message queue based on the traffic status.
[0149] In some embodiments, the detection module is further configured to determine the traffic status as the service receiving the access request traffic if the service is a service responding to the access request; and to determine the traffic status as the service ceasing to receive the access request traffic if the service is not a service responding to the access request.
[0150] In some embodiments, the response module is further configured to, in response to the traffic reception status instructing the service to stop receiving the access request traffic, identify the access requests in the access request traffic and obtain an identification result; and, in response to the identification result indicating that there is a target access request in the access request that has not been responded to by the service, stop scheduling the service messages in the message queue.
[0151] In some embodiments, the response module is further configured to, in response to the identification result indicating that there is a target access request in the access request that has not been responded to by the business service, determine whether there is a reference access request in the access request that has been responded to by the business service; if there is a reference access request in the access request that has been responded to by the business service, determine the response progress of the business service to each of the reference access requests; if the response progress of each of the reference access requests indicates that the business service has completed responding to the reference access request, stop scheduling business messages in the message queue.
[0152] In some embodiments, the above-described business processing apparatus further includes: a completion module, configured to, if the response progress indicates that the business service has not completed responding to the reference access request, determine the unresolved reference access request as a candidate access request; and respond to the candidate access request based on the business message until the response to the candidate access request is completed.
[0153] In some embodiments, the above-described completion module is further configured to, in response to the identification result indicating that there is no target access request among the access requests that has not been responded to by the business service, determine the response progress of each access request received by the business service; and for each access request, if the response progress of the access request indicates that the business service has not completed the response to the access request, then respond to the access request based on the business message until the response to the access request is completed.
[0154] In some embodiments, the above-described business processing apparatus further includes: a determining module, configured to obtain the response progress of the business service to the access request, and if the response progress indicates that the access request has not been responded to by the business service, then determine the access request as the target access request.
[0155] The following description continues to illustrate the exemplary structure of the service processing apparatus 555 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 3 As shown, the software modules stored in the service processing device 555 of the memory 550 may include: a switching module, used to switch the access request to a second service in response to a service switching instruction during the process of sending an access request to a service; the service switching instruction is used to trigger the first service to generate a stop instruction when there is a target access request that is not responded to by the first service among the access requests received by the first service; the stop instruction is used to trigger the first service to stop acquiring messages for responding to the access request and not respond to the target access request.
[0156] In some embodiments, the switching module is further configured to receive an access request from a business program; and to determine the candidate business service whose service performance is greater than a performance threshold from among multiple candidate business services as the first business service that currently needs to respond to the access request.
[0157] In some embodiments, the switching module is further configured to switch the access request from the second service to the first service in response to the second service being unable to respond to the access request.
[0158] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the business processing method described in this application embodiment.
[0159] This application provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they cause the processor to perform the business processing method provided in this application, for example... Figure 5 The business processing method is shown.
[0160] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of electronic devices including one or any combination of the above-mentioned memories.
[0161] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0162] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0163] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0164] In summary, the embodiments of this application have the following beneficial effects:
[0165] (1) By performing traffic status detection on the business service, the traffic status of the business service is obtained. The traffic status is used to indicate whether the business service has stopped receiving access request traffic. Based on the traffic status, the business messages in the message queue are scheduled. Thus, when the business service is responding to the access request of the application and the access request is switched to the second business service, the business service may respond to the target access request. However, since the business service has no access request, even if the business service responds to the target access request, it cannot send back the response result, which leads to the waste of messages. By performing traffic status detection on the business service, the traffic status of the business service is obtained. Based on whether the business service has stopped receiving access request traffic as indicated by the traffic status, the business messages in the message queue are scheduled to prevent the waste of messages, thereby effectively improving the utilization rate of messages.
[0166] (2) During the process of a business service responding to an application's access request, if the access request is switched to a second business service, the business service cannot respond to the access request that has not been received. If there is a target access request that has not been responded to by the business service among the access requests received by the business service, the business service may respond to the target access request, which will lead to continued message scheduling. However, since the business service cannot feed back the response result of the target business request to the management service at this time, the message is wasted. By generating a stop instruction, the first business service is triggered to stop obtaining the message used to respond to the access request and does not respond to the target access request, so as to stop the waste of messages and effectively improve the message utilization rate.
[0167] (3) By identifying the target business service that needs to respond to the access request, the system can avoid unnecessary processing and resource waste. This means that only the relevant business service will be activated to process the request, rather than all services. If the current business service is the target business service, the system confirms that the access request has not switched to a second business service. This helps ensure that the request is processed continuously on a single service, avoiding potential problems caused by the request jumping between different services. If the current business service is not the target business service, the system can promptly determine that the request flow has switched to a second business service. This helps to quickly respond to changes in system load or failures, thereby maintaining service availability and stability. Through this logic, the system can avoid processing the same request flow repeatedly. If a request flow has already been processed on another service, the current service will not process it again, thus preventing data inconsistency and resource waste.
[0168] (4) By monitoring response progress, the business service can ensure that each responded access request is fully processed and responded to. If the business service has not yet completed the response to a reference access request, the request will be marked as a candidate access request to ensure that it can continue to be processed. The candidate access request is processed based on the information already obtained, which means that resources are fully utilized and will not be wasted due to incomplete processing of requests. The service can continue to process candidate access requests without interrupting the current processing flow, which can reduce the downtime of the business service and improve processing efficiency.
[0169] (5) The stop command can promptly notify the message provider to stop sending messages to the current business service, preventing unnecessary resource scheduling, especially when the service no longer needs these resources. When a business service is unable to continue processing requests due to failure or other reasons, the stop command can quickly trigger resource reallocation, which helps to quickly recover and maintain service continuity. The stop command, in conjunction with the resource reallocation mechanism, helps to balance the system load and avoid situations where some services are overloaded while others are idle. By sending the target access request to a second business service, it can be ensured that even if some business services cannot continue to work, the service can continue to be provided seamlessly, guaranteeing the continuity and reliability of business services.
[0170] (6) When an access request switches back to the original business service from the second business service, the recovery command helps optimize the load distribution of the entire system, preventing some services from being overloaded while others are idle. Through the recovery command, business services acquire resources only when needed, which helps reduce resource waste and improve resource utilization. It can quickly respond to service status changes, allowing business services to recover quickly and improving system availability. The recovery command mechanism enables business services to recover quickly from failures, enhancing the system's fault recovery capability. The recovery command supports elastic scaling when facing different workloads, allowing the system to adapt to different business needs.
[0171] (7) By identifying the target business service, it becomes clear which services should be responsible for responding to specific access requests. This helps avoid confusion of responsibilities among services and duplication or omission in request processing. If a business service confirms that it is the target business service, it can ensure that access requests are correctly routed to the service that should handle them, thereby optimizing request allocation and routing. When a business service confirms that it is not the target business service, it can avoid processing request flows that are not its responsibility, reducing unnecessary computation and network overhead. Ensuring that only the target business service handles specific request flows can avoid conflicts and competition between multiple services, improving the overall processing efficiency of the system. By correctly switching and distributing access requests, more effective load balancing can be achieved, preventing some services from being overloaded while others remain idle.
[0172] (8) By selecting candidate services with performance exceeding the performance threshold, the system ensures that access requests are handled by services capable of efficient processing, thereby improving overall processing efficiency. Access requests can be allocated based on the actual performance of the service, avoiding allocation to services with lower performance that may not respond promptly, thus optimizing resource allocation and utilization. Selecting higher-performance services to handle access requests helps ensure service response speed and stability, thereby improving user satisfaction. When the system needs to be expanded, new business services can be added based on the performance threshold, helping the system quickly adapt to business growth. Running the system on higher-performance services reduces maintenance and troubleshooting costs caused by performance issues. Requests will not be allocated to services with performance below the threshold, thus avoiding unnecessary resource allocation and reducing resource waste.
[0173] (9) When the second service cannot respond to access requests, the request flow can be switched back to the original service in a timely manner, which helps maintain service continuity and improves system reliability. This enables rapid fault response and quick recovery to the original service when a new service is detected as unable to handle the request, enhancing fault recovery capabilities. Through the switchback operation, the system avoids resource waste caused by the inability of the second service to handle requests, ensuring that resources are used effectively. Ensuring that access requests can be processed on a high-performance service helps guarantee service quality and stability. User requests receive timely responses, and the user experience is not significantly affected even in the event of a service switch. The load can be dynamically adjusted according to the actual operating status of the service; if the new service cannot handle the request, the system can quickly redistribute the load to the original service.
[0174] (10) This application enables Kubernetes to synchronously change the behavior of the application consuming Kafka messages when switching traffic to a Pod. This ensures that Pods with their traffic shut down will not compete with Pods that are providing services normally for Kafka messages. It also avoids erroneous data caused by the different behaviors of the old and new versions of the application when a new version is released, where the old version of the Pod has shut down its traffic but is still consuming Kafka messages. It is non-intrusive to the application code. By using Java's Instrumentation bytecode enhancement technology to enhance the runtime agent of the Kafka SDK (i.e., the kafkaConsumerAgent mentioned above) that the application depends on, developers can achieve the desired effect without modifying the code. The KafkaConsumerController, developed using Kubernetes' custom controller function, can monitor changes to the endpoint corresponding to the Pod in real time. Events that change the Pod's traffic can be immediately notified to the KafkaConsumerController. Furthermore, the KafkaConsumerController also uses the Kubernetes API to notify the kafkaConsumerAgent to change its behavior of consuming Kafka messages. The synchronous changes are real-time, with less resource consumption, which is more in line with the cloud-native technology stack and concept.
[0175] (11) By accurately defining the responsibilities and traffic status of business services, resource allocation can be effectively optimized and system performance improved. Traffic is correctly directed to the business services responsible for responding to access requests, ensuring the specialization and efficiency of services, thereby reducing unnecessary service processing burdens. At the same time, for non-responsive services, the reception of access request traffic is blocked in a timely manner, which not only avoids the waste of service resources, but also enhances security and stability, ensuring the reasonable flow of traffic and overall operational efficiency.
[0176] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A business processing method, characterized in that, The method includes: If the service is a service that responds to an access request, then the traffic status of the service is determined to be that the service is receiving access request traffic; if the service is not a service that responds to an access request, then the traffic status is determined to be that the service has stopped receiving access request traffic. In response to the traffic status indicating that the service stops receiving the access request traffic, the service identifies the access requests in the access request traffic and obtains the identification result. In response to the identification result indicating that there is a target access request in the access request that has not been responded to by the service, the scheduling of service messages in the message queue is stopped; and After the service stops scheduling service messages in the message queue, in response to the access request, the service switches back from the second service to the service and generates a recovery command.
2. The method according to claim 1, characterized in that, The response to the identification result indicating that there is a target access request in the access request that has not been responded to by the business service, and the cessation of scheduling business messages in the message queue, includes: In response to the identification result indicating that there is a target access request in the access request that has not been responded to by the business service, determine whether there is a reference access request in the access request that has been responded to by the business service; If there is a reference access request among the access requests that has already been responded to by the business service, then the response progress of the business service to each of the reference access requests is determined. If the response progress of each of the aforementioned reference access requests indicates that the service has completed responding to the reference access request, then the scheduling of service messages in the message queue is stopped.
3. The method according to claim 2, characterized in that, After determining the response progress of the business service to each of the reference access requests, the method further includes: If the response progress indicates that the service has not completed its response to the reference access request, then the reference access request that has not been completed is identified as a candidate access request. In response to the candidate access request, the system responds to the candidate access request based on the business message until the response to the candidate access request is completed.
4. The method according to claim 1, characterized in that, After responding to the traffic status indication that the service should stop receiving the access request traffic, identifying the access requests in the access request traffic, and obtaining the identification result, the method further includes: In response to the identification result indicating that there is no target access request among the access requests that has not been responded to by the business service, the response progress of each access request received by the business service is determined; For each of the access requests, if the response progress of the access request indicates that the service has not completed responding to the access request, then the service will respond to the access request based on the service message until the response to the access request is completed.
5. The method according to claim 1, characterized in that, Before performing response identification on the access requests in the access request traffic and obtaining the identification result, the method further includes: Obtain the response progress of the business service to the access request. If the response progress indicates that the access request has not been responded to by the business service, then the access request is identified as the target access request.
6. A business processing apparatus, characterized in that, The device includes: The detection module is used to determine the traffic status of the service as receiving access request traffic if the service is a service that responds to the access request; and to determine the traffic status as the service that stops receiving the access request traffic if the service is not a service that responds to the access request. The response module is configured to: respond to the traffic status indicating that the service stops receiving the access request traffic; identify the access requests in the access request traffic and obtain an identification result; stop scheduling service messages in the message queue in response to the identification result indicating that there are target access requests in the access requests that have not been responded to by the service; and generate a recovery instruction after the service stops scheduling service messages in the message queue in response to the access request switching back from the second service to the service.
7. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the business processing method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement the business processing method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program or computer-executable instructions, characterized in that, When the computer program or computer-executable instructions are executed by the processor, they implement the business processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
System and method for safely stopping service
CN116662030A