Business processing method and device, electronic equipment, storage medium and program product
By detecting traffic status of the service and scheduling service messages in the message queue, the low utilization problem caused by the original service service to continue scheduling messages after switching access requests is solved, and more efficient message utilization and resource allocation are achieved.
Patent Information
- Application Number
- CN202411472649.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-10-21
AI Technical Summary
In the cluster system, the original service service continues to schedule messages after switching the access request to the target service service, resulting in low message utilization.
By detecting the traffic status of the service, it is determined whether the service service stops receiving access request traffic, and schedules the service messages in the message queue based on this status.
It effectively improves the utilization rate of messages, prevents message waste, and ensures the rational allocation and utilization of resources.
Smart Images

Figure CN119697180A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a business processing method, device, electronic device, storage medium and program product. Background Art
[0002] Cluster technology is a technology that 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 managed and scheduled in a unified manner. It is used to handle services in various big data scenarios, thereby improving the scalability and reliability of services. In order to ensure that services in big data scenarios can run normally, cluster systems usually store massive amounts of data to support various services in big data scenarios.
[0003] In the related art, after the access request is switched from the original business service to the target business service, the original business service will still continue to schedule messages, resulting in a low utilization rate of the messages. Summary of the invention
[0004] The embodiments of the present application provide a business processing method, device, electronic device, computer-readable storage medium and computer program product, which can effectively improve the utilization rate of messages.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a service processing method, including:
[0007] Performing flow status detection on the business service to obtain the flow status of the business service, wherein the flow status is used to indicate whether the business service stops receiving access request flow;
[0008] Based on the traffic status, the service messages in the message queue are scheduled.
[0009] The present application provides a service processing device, including:
[0010] A detection module, used to detect the flow status of the business service to obtain the flow status of the business service, wherein the flow status is used to indicate whether the business service stops receiving access request flow;
[0011] The response module is used to schedule the service messages in the message queue based on the traffic status.
[0012] An embodiment of the present application provides an electronic device, including:
[0013] A memory for storing computer executable instructions or computer programs;
[0014] The processor is used to implement the business processing method provided in the embodiment of the present application when executing the computer executable instructions or computer programs stored in the memory.
[0015] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute and implement the business processing method provided in the embodiment of the present application.
[0016] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the business processing method described above in the embodiment of the present application.
[0017] The embodiments of the present application have the following beneficial effects:
[0018] By performing traffic status detection on the business service, the traffic status of the business service is obtained, and the traffic status is used to indicate whether the business service stops receiving access request traffic; based on the traffic status, the business messages in the message queue are scheduled, so that when the business service responds 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, but because the business service has no access request, even if the business service responds to the target access request, it cannot feedback the response result, resulting in message waste. By performing traffic status detection on the business service, the traffic status of the business service is obtained, and whether the business service indicated by the traffic status stops receiving access request traffic, the business messages in the message queue are scheduled to prevent message waste, thereby effectively improving message utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of the architecture of the business processing system provided in an embodiment of the present application;
[0020] Figure 2 is a schematic diagram of the structure of an electronic device for business processing provided in an embodiment of the present application;
[0021] Figure 3 is a schematic diagram of the structure of an electronic device for business processing provided in an embodiment of the present application;
[0022] Figure 4 It is a schematic diagram of the architecture of the distributed service system provided in the embodiment of the present application;
[0023] Figure 5 This is a flow chart of the business processing method provided in the embodiment of the present application. Figure 1 ;
[0024] Figure 6 This is a flow chart of the business processing method provided in the embodiment of the present application. Figure 2 ;
[0025] Figure 7 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 1 ;
[0026] Figure 8 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 2 ;
[0027] Fig. 9 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 3 ;
[0028] Fig.10 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 4 . DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0030] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be 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" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0033] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0034] 1) Business service: Business service usually refers to a component or service that undertakes a specific business processing function. It is responsible for performing corresponding logical processing according to the access request, such as data verification, business logic calculation, data storage, etc. A business service may be a module inside the application or an external service.
[0035] 2) Application: refers to a program running on a computer operating system that can provide specific functions or services to users. Applications are usually written by developers using programming languages and converted 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.). An application 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 collaborative software modules that together provide complex functions and services. The design and development of applications need to consider factors such as user needs, usability, performance, security, and maintainability.
[0036] 3) Access Request Flow: refers to the process in which a user sends a request to an application through a browser, and the application processes the request through a business service and returns a response. Specifically, an access request includes the following steps: User input: a user enters a URL or submits a form through a browser to generate a web request. Send a request: the user's browser sends the request to the web server. Business service processing: after the web server receives the request, it may need to go through multiple business service processes to perform permission verification, data processing, etc. Send a response: after the business service processing is completed, the response is returned to the web server. Return result: the web server returns the response result to the user's browser. Display: after the browser receives the response, it renders and displays it according to the content of the response (such as an HTML page).
[0037] 4) Pod: 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 usually contains one or more containers, as well as some shared resources for communication and storage between containers. The containers in a Pod share the same network interface and storage volumes, which means they can communicate with each other through localhost and can access the same storage resources. Pod has its own life cycle, including states such as creation, running, pause, resume, and termination. Pod is used to deploy and manage applications. It is the basic unit for Kubernetes to schedule and manage computing tasks.
[0038] 5) Cluster technology: It is a technology that 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 managed and scheduled in a unified manner. It is used to handle services in various big data scenarios, thereby improving the scalability and reliability of services. In order to ensure that services in big data scenarios can run normally, cluster systems usually store massive amounts of data to support various services in big data scenarios.
[0039] 6) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0040] 7) Distributed system: refers to a distributed file system designed to run on commodity hardware. It has a lot in common with existing distributed file systems, but at the same time, it is also very different from other distributed file systems. HDFS is a highly fault-tolerant system that is suitable for deployment on cheap machines. HDFS can provide high-throughput data access and is very suitable for applications on large data sets. HDFS relaxes some POSIX constraints to achieve the purpose of streaming file system data. HDFS has the characteristics of high fault tolerance and is designed to be deployed on low-cost hardware. It also provides high throughput to access application data and is suitable for applications with large data sets. HDFS relaxes POSIX requirements so that streaming access can be achieved to data in the file system.
[0041] 8) Cloud Technology: Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, image websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0042] During the implementation of the embodiments of the present application, the applicant discovered that the related technology has the following problems:
[0043] In the related art, after the access request is switched from the original business service to the target business service, the original business service will still continue to schedule messages, resulting in a low utilization rate of the messages.
[0044] The embodiments of the present application provide a business processing method, device, electronic device, computer-readable storage medium and computer program product, which can effectively improve the utilization rate of messages. The following describes an exemplary application of the business processing system provided by the embodiments of the present application.
[0045] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the business processing system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0046] The terminal 400 is used for the user to use the client 410, and the display interface of the application is displayed on the graphical interface 410-1 (the graphical interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0047] In some embodiments, server 200 can be an independent physical server, or a server cluster or business system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN), and big data and artificial intelligence platforms. Terminal 400 can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart TV, smart watch, car terminal, etc., but is not limited to this. The electronic device provided in the embodiment of the present application can be implemented as a terminal or as a server. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application.
[0048] In some embodiments, the server 200 detects the traffic status of the business service, obtains the traffic status of the business service, and sends the traffic status of the business service to the terminal 400. The terminal 400 schedules the business messages in the message queue based on the traffic status.
[0049] In other embodiments, the terminal 400 performs flow status detection on the business service, obtains the flow status of the business service, and sends the flow status of the business service to the server 200. The server 200 schedules the business messages in the message queue based on the flow status.
[0050] In other embodiments, the embodiments of the present application can be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0051] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0052] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 for business processing provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2The electronic device 500 shown 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 achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .
[0053] The 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., where 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 memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 430.
[0055] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0056] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0057] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing 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. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0059] In some embodiments, the service processing device provided in the embodiments of the present application may be implemented in software. Figure 2 The service processing device 455 stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a detection module 4551 and a response module 4552. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0060] See also Figure 3 , Figure 3 is a schematic diagram of the structure of an electronic device for business processing provided by an embodiment of the present application, wherein: Figure 3 The electronic device 600 shown may be Figure 1 The server 200 or the terminal 400 in Figure 3 The electronic device 600 shown 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 achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 3 Various buses are labeled as bus system 540 .
[0061] The 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., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0062] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 530.
[0063] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0064] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0065] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing 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. Exemplary network interfaces 520 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0067] In some embodiments, the service processing device provided in the embodiments of the present application may be implemented in software. Figure 3 The service processing device 555 stored in the memory 550 is shown, which can be software in the form of programs and plug-ins, etc., including the following software modules: a switching module 5551, which is logical and can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0068] In other embodiments, the business processing device provided in the embodiments of the present application can be implemented in hardware. As an example, the business processing device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the business processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt 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 embodiment of the present application by running a computer program or a computer executable instruction. For example, the computer program can be a native program (e.g., a dedicated business processing program) or a software module in the operating system, for example, a business processing module that can be embedded in any program (such as an instant messaging client, an album program, an electronic map client, a navigation client); for example, it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0070] The service processing method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the server or terminal provided in the embodiment of the present application.
[0071] In some embodiments, the service processing method provided in the embodiments of the present application can be applied to a distributed service system. Figure 4 , Figure 4 Schematic diagram of the architecture of the distributed service system provided in the embodiment of the present application. The distributed service system provided in the embodiment of the present application 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 a management service 40 , a business service 41 , a business service 42 , a business service 43 , a business service 44 and a resource service 45 .
[0072] See also Figure 5 , Figure 5 This is a flow chart of the business processing method provided in the embodiment of the present application. Figure 1 , will combine Figure 5 Steps 101 to 102 are shown for illustration. The business processing method provided in the embodiment of the present application can be implemented independently by a server or a terminal. The following will take the implementation of the server alone as an example to illustrate the business processing method provided in the embodiment of the present application from the perspective of business services.
[0073] In step 101, a flow status detection is performed on a business service to obtain the flow status of the business service.
[0074] In some embodiments, the traffic status is used to indicate whether the business service stops receiving access request traffic.
[0075] In some embodiments, business service, business service generally refers to a component or service that undertakes a specific business processing function. It is responsible for performing corresponding logic processing according to the access request, such as data verification, business logic calculation, data storage, etc. The business service may be a module inside the application or an external service.
[0076] In some embodiments, the above step 101 can be implemented as follows: if the business service is a business service that responds to the access request, the traffic state is determined as the business service receiving the access request traffic; if the business service is not a business service that responds to the access request, the traffic state is determined as the business service stopping receiving the access request traffic.
[0077] In some embodiments, if the business service is designed to respond to a specific access request (that is, this service is an appropriate service to handle this type of request), then the traffic state is determined to be "Business service receives access request traffic, which means that the traffic will be directed to the business service and the requests will be processed by it. In this state, the business service should be active, able to handle incoming requests, and can manage the flow of these traffic to ensure that the service can respond correctly.
[0078] In some embodiments, if the business 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 business 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 business service may not be active, or it may be configured not to respond to such requests. This may involve redirecting traffic, or simply dropping requests that are not relevant to the service.
[0079] In this way, by accurately defining the responsibilities and traffic status of business services, we can effectively optimize resource allocation and improve system performance, correctly direct traffic to business services responsible for responding to access requests, ensure the specificity and efficiency of services, and thus reduce unnecessary service processing burdens. At the same time, for non-responsive services, timely blocking their access request traffic can avoid waste of service resources, enhance security and stability, and ensure the reasonable flow of traffic and overall operating efficiency.
[0080] In step 102, the service messages in the message queue are scheduled based on the traffic status.
[0081] In some embodiments, the above step 102 can be implemented in the following manner: in response to the traffic reception status indicating that the business service stops receiving access request traffic, responds to the access request in the access request traffic and identifies the identification result; in response to the identification result indicating that there are target access requests in the access request that have not been responded to by the business service, stops scheduling the business messages in the message queue.
[0082] In some embodiments, the above-mentioned response identification of the access requests in the access request traffic to obtain the identification result can be achieved in the following way: for each access request in the access request traffic, obtaining response information of the access request, the response information is used to indicate whether the access request is accessed by the business service; based on the response information of each access request, determining the identification result.
[0083] In some embodiments, the above-mentioned determination of the identification result based on the response information of each access request can be achieved in the following manner: if there is response information of the access request indicating 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 there is no response information of the access request indicating 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 the above-mentioned response identification of the access request in the access request traffic is obtained and the identification result is obtained, the following processing can 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 determining the access request as the target access request.
[0085] In some embodiments, the above-mentioned response identification of access requests in the access request traffic to obtain an identification result can be achieved in the following way: if the number of the target access requests is at least one, the identification result is determined as the existence of 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 access request from an application, in response to the access request, a switch is made to a second business service, that is, the first business service stops receiving access request traffic, and the access request received by the first business service (that is, the access request in the access request traffic described above) contains target access requests that have not been responded to by the first business service (that is, the identification result described above indicates that there are target access requests in the access request that have not been responded to by the business service), and a stop instruction is generated.
[0087] In some embodiments, the stop instruction is used to trigger the first business service to stop obtaining messages for responding to the access request and not respond to the target access request, that is, the stop instruction stops scheduling business 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 the access request that has not been received. Among the access requests received by the first business service, there is a target access request that has not been responded to by the first business service. In this case, the business service may respond to the target access request, thereby continuing to schedule messages. However, at this time, since the business service has no access request, the business service cannot feed back the response result of the target business request to the management service, thereby resulting in waste of messages. By generating a stop instruction to trigger the first business service to stop obtaining messages for responding to access requests and not respond to the target access request, waste of messages is stopped, thereby effectively improving the utilization rate of messages.
[0089] In some embodiments, business service, business service generally refers to a component or service that undertakes a specific business processing function. It is responsible for performing corresponding logic processing according to the access request, such as data verification, business logic calculation, data storage, etc. The business service may be a module inside the application or an external service.
[0090] In some embodiments, an application refers to a program running on a computer operating system that can provide specific functions or services to users. Applications are usually written by developers using programming languages and converted 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.). An application 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 collaborative software modules that together provide complex functions and services. The design and development of applications need to consider factors such as user needs, usability, performance, security, and maintainability.
[0091] In some embodiments, access request (Access Request Flow): refers to the process in which a user sends a request to an application through a browser, the application processes the request through a business service, and returns a response. Specifically, the access request includes the following steps: User input, the user enters a URL or submits a form through a browser to generate a web request. Send a request, the user's browser sends the request to the web server. Business service processing, after the web server receives the request, it may need to go through multiple business service processes to perform permission verification, data processing, etc. Send a response, after the business service processing is completed, the response is returned to the web server. Return result, the web server returns the response result to the user's browser. Display, after the browser receives the response, it renders and displays it according to the content of the response (such as an HTML page).
[0092] As an example, see Figure 4 Taking business service 41 as an example, a 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 stops receiving access request traffic.
[0093] As an example, see Figure 4 Taking business service 41 as an example, in 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, for example, business service 42, business service 43 and business service 44) in response to the access request, and the access request received by the first business service 41 contains a target access request that has not been responded to by the first business service 41, and business service 41 generates a stop instruction.
[0094] In this way, in the process of the business service responding to the access request of the application, when the access request is switched to the second business service, the business service cannot respond to the access request that has not been received. Among the access requests received by the business service, there is a target access request that has not been responded to by the business service. In this way, the business service may respond to the target access request, thereby continuing to schedule messages. However, since the business service cannot feed back the response result of the target business request to the management service at this time, it leads to waste of messages. By generating a stop instruction to trigger the first business service to stop obtaining messages for responding to the access request, and not respond to the target access request, so as to stop wasting messages, thereby effectively improving the utilization rate of messages.
[0095] In some embodiments, during the process of the first business service responding to the access request of the application, it can also be determined whether the access request is switched to the second business service in the following manner: determining at least one target business service that currently needs to respond to the access request; if the first business service is the target business service, determining that the access request has not been switched to the second business service; if the first business service is not the target business service, determining that the access request is switched to the second business service.
[0096] In some embodiments, since at least one target business service that currently needs to respond to the access request is the end point 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 end point to which the access request needs to flow, so that it can be determined whether the access request is switched to the second business service. When the business service is not the end point to which the access request needs to flow, it is determined that the access request has been switched to the second business service. When the business service is not the end point to which the access request needs to flow, it is determined that the access request has not been switched to the second business service.
[0097] In this way, by determining the target business service that currently needs to respond to the access request, the system can avoid unnecessary processing and resource waste. This means that only relevant business services 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 been switched to the second business service, which helps ensure that the request is processed continuously on a single service and avoids 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 been switched to the second business service, which helps to quickly respond to system load changes or failures, thereby maintaining service availability and stability. Through this logic, the system can avoid repeated processing of the same request flow. If a request flow has been processed on other services, the current service will not process it again, which can prevent 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 business service, stopping scheduling the business messages in the message queue can be achieved in the following way: 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, determining 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, determining the response progress of the business service to each reference access request; if the response progress of each reference access request indicates that the business service has completed the response to the reference access request, stopping scheduling the business messages in the message queue.
[0099] In some embodiments, the above-mentioned switching to the second business service in response to the access request, and the presence of target access requests that have not been responded to by the first business service in the access requests received by the first business service, generating a stop instruction can be implemented as follows: in response to the access request switching to the second business service, and the presence of target access requests that have not been responded to by the first business service in the access requests received by the first business service (that is, the business service described above), determining whether there is a reference access request that has been responded to by the first business service in the access requests received by the first business service; if there is at least one reference access request that has been responded to by the first business service in the access requests received by the first business service, determining the response progress of the first business service to each reference access request; if the response progress of each reference access request indicates that the first business service has completed the response to the reference access request, stopping scheduling the business messages in the message queue.
[0100] In some embodiments, the reference access request responded to by the business service includes the reference access request completed by the business service response and the reference access request not completed by the business service response.
[0101] In some embodiments, when an access request switches to a second business service, and the access requests received by the first business service contain a target access request that has not been responded to by the first business service, the access requests received by the business service may contain a reference access request that has been responded to by the first business service. Since a stop instruction will cause the business service to be unable to obtain a message, resulting in an inability to respond to the reference access request, it is necessary to complete the response to the second business service and then generate a stop instruction to ensure that the response to the reference access request can proceed normally.
[0102] In some embodiments, the response progress is used to indicate that the business service has completed responding to the reference access request.
[0103] In some embodiments, after determining the response progress of the first business service (i.e., the business service described above) to each of the reference access requests, the following processing may also be performed: if there is a response progress of the reference access request indicating that the first business service (i.e., the business service described above) has not completed the response 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 business message until the response to the reference access request is completed; if the first business service has completed the response to each of the candidate access requests, then the scheduling of the business messages in the message queue is stopped.
[0104] In some embodiments, if there is a response progress of the reference access request indicating that the first business service has not completed the response to the reference access request, it is necessary to complete the response to the candidate access request before generating a stop instruction, that is, to respond to the reference access request based on the business 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 no longer needs to use messages. At this time, stop resources are generated, which effectively reduces the waste of messages on the one hand, and ensures that all access requests that have started responding can complete the response in the business service on the other hand.
[0106] In this way, by detecting the response progress, the business service can ensure that each access request that has been responded to can be 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. Based on the message that has been obtained, the candidate access request will continue to be processed, which means that resources are fully utilized and will not be wasted due to incomplete processing of requests. The service can continue to process the candidate access request without interrupting the current processing flow, which can reduce the downtime of the business service and improve processing efficiency.
[0107] In some embodiments, after generating a stop instruction, the following processing may also be performed: sending the stop instruction to the message provider of the message, wherein the stop instruction is used to trigger the message provider to stop sending the message to the first business service and send the target access request to the second business service.
[0108] In some embodiments, the business service sends a stop instruction to the message provider of the message, so that the message provider stops sending messages to the business service, and sends the target access request that has not been responded to by the business service to the second business 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 instruction to the message provider (resource service 45) of the message. The stop instruction 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] In this way, the stop instruction can promptly notify the message provider to stop sending messages to the current business service, preventing unnecessary scheduling of resources, especially when the service no longer needs these resources. When a business service is unable to continue processing requests due to a failure or other reasons, the stop instruction can quickly trigger the reallocation of resources, which helps to quickly restore and continue services. The stop instruction, together with the resource reallocation mechanism, helps to balance the system load and avoid situations where some services are overloaded while other services are idle. By sending the target access request to the second business service, it can be ensured that the service can continue to be provided seamlessly even when some business services cannot continue to work, ensuring the continuity and reliability of business services.
[0111] In some embodiments, in response to the traffic reception status indicating that the business service stops receiving access request traffic, the access requests in the access request traffic are responded to and identified to obtain the identification result, and the following processing can also be performed: in response to the identification result indicating that there is no target access request in the access request 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 access request, if the response progress of the access request indicates that the business service has not completed the response to the access request, the access request is responded to based on the business message until the response to the access request is completed.
[0112] In some embodiments, in the process of the first business service (i.e., the business service described above) responding to the access request of the application, the following processing can also be performed: in response to the access request, switching to the second business service, and the access requests received by the first business service do not contain the target access request that has not been responded to by the first business service, determining the response progress of each access request received by the first business service; for each access request, if the response progress of the access request indicates that the first business service has not completed the response to the access request, responding to the access request based on the business message until the response to the access request is completed; if the first business service has completed the response to each access request, generating a resource rejection instruction.
[0113] In some embodiments, the resource rejection instruction is used to trigger the first business service to stop obtaining a message for responding to the access request.
[0114] In some embodiments, when the access request is switched to the second business service, and the access requests received by the first business service do not contain the target access request that has not been responded to by the first business service, the business service has started responding to all received access requests, but it is not known whether the business service has completed responding to all access requests. At this time, by determining the response progress of each received business request, if the business service has completed responding to all access requests, a resource rejection instruction can be generated to trigger the first business service to stop obtaining messages for responding to the access requests.
[0115] In some embodiments, after the resource rejection instruction is generated, the resource rejection instruction is sent to the management service so that the management service stops sending messages for responding to access requests to the business service.
[0116] As an example, see Figure 4 Taking the business service 43 as an example, after the business service 43 generates a resource rejection instruction, the business service 43 sends a message to the management service 40 for responding to the access request.
[0117] In some embodiments, after the first business service stops obtaining messages for responding to the access request, the following processing may also be performed: while the first business service stops responding to the access request of the application, a recovery instruction is generated in response to the access request switching from the second business service to the first business service; the recovery instruction is used to trigger the first business service to resume obtaining messages for responding to the access request and respond to the access request switched to the first business service.
[0118] In some embodiments, while the first business service stops responding to the access request of the application, in response to the access request, the second business service switches to the first business service. At this time, the business service needs to resume responding to the access request. Since the business service stops responding to the access request of the application, the business service has stopped obtaining messages for responding to the access request, but needs to resume responding to the access request. Therefore, it is necessary to resume obtaining messages for responding to the request flow, and generate a recovery instruction to trigger the first business service to resume obtaining messages for responding to the access request and respond to the access request switched to the first business service.
[0119] In this way, when the access request switches from the second business service back to the original business service, the recovery instruction helps optimize the load distribution of the entire system, avoiding overloading of some services while other services are idle. Through the recovery instruction, the business service obtains resources only when needed, which helps to reduce resource waste and improve resource utilization. The ability to quickly respond to service status changes allows business services to resume services in a short time, improving system availability. The recovery instruction mechanism enables business services to quickly recover from failures, enhancing the system's fault recovery capabilities. Recovery instructions support elastic scaling when facing different workloads, allowing the system to adapt to different business needs.
[0120] In some embodiments, while the first business service stops responding to the access request of the application, the following processing may also be performed: determining at least one target business service that currently needs to respond to the access request; if the first business service is the target business service, determining that the access request is switched from the second business service to the first business service; if the first business service is not the target business service, determining that the access request is not switched from the second business service to the first business service.
[0121] In some embodiments, during the above-mentioned process of stopping responding to the access request of the application, a service acquisition request can be sent to the management service to enable the management service to 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 business service is the target business service, it means that the business service can receive the access request. At this time, it can be determined that the access request is switched from the second business service to the first business service.
[0123] In some embodiments, if the first business service is not the target business service, it means that the business service cannot receive the access request. In this case, it can be determined that the access request is not switched from the second business service to the first business service.
[0124] In this way, by determining the target business service, it is clear which services should be responsible for responding to specific access requests, which helps avoid confusion of responsibilities between services and duplication or omissions in request processing. If the business service confirms that it is the target business service, it can ensure that the access request is correctly routed to the service that should handle it, thereby optimizing the distribution and routing of requests. When a business service confirms that it is not the target business service, it can avoid processing request flows that it is not responsible for, reducing ineffective computing and network overhead. Ensuring that only the target business service handles specific request flows can avoid conflicts and competition between multiple services and improve the overall processing efficiency of the system. By correctly switching and allocating access requests, more effective load balancing can be achieved to avoid overloading some services while other services are idle.
[0125] In this way, the traffic status of the business service is detected, and the traffic status is used to indicate whether the business service stops receiving access request traffic; based on the traffic status, the business messages in the message queue are scheduled. In this way, when the business service responds 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 feedback the response result, resulting in a waste of messages. The traffic status of the business service is detected, and the traffic status of the business service is obtained. Whether the business service indicated by the traffic status stops receiving access request traffic is determined, and the business messages in the message queue are scheduled to prevent the waste of messages, thereby effectively improving the utilization rate of messages.
[0126] See also Figure 6 , Figure 6 This is a flow chart of the business processing method provided in the embodiment of the present application. Figure 2 , will combine Figure 6 Step 201 is shown for explanation. The business processing method provided in the embodiment of the present application can be implemented by a server or a terminal alone. The following will take the implementation of the server alone as an example to explain the business processing method provided in the embodiment of the present application from the perspective of management service.
[0127] In step 201, in the process of sending an access request to a business service, in response to a service switching instruction, the access request is switched to a second business service.
[0128] In some embodiments, the service switching instruction is used to trigger the first business service to generate a stop instruction when there is a target access request that is not responded to by the first business service among the access requests received by the first business service.
[0129] In some embodiments, the stop instruction is used to trigger the first business service to stop obtaining a message 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 load is too large. At this time, a service switching instruction is generated, and in response to the service switching instruction, the access request is switched to the second business service. The service switching instruction may also be generated in response to a trigger by a management personnel, that is, the management personnel actively switches the business service of the access request.
[0131] In some embodiments, before sending the access request to the first business service, the business service can also be determined in the following manner: receiving an access request from a business program; and determining a candidate business service whose service performance is greater than a performance threshold among multiple candidate business services as the first business service that currently needs to respond to the access request.
[0132] In some embodiments, the above-mentioned service performance may include service processing capacity, service response time, service throughput, service load, service availability, service scalability, service concurrency and service resource utilization, etc. Service processing capacity refers to the maximum amount of requests or data that a business service can process per unit time, which is usually 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 receive a request and return a response. The shorter the response time, the stronger the processing capacity of the service and the better the user experience. Service throughput refers to the amount of data or the number of requests successfully processed by a business service per unit time. Throughput is one of the important indicators for measuring service performance. Service load refers to the amount of work currently being processed by a business service. Excessive load may cause service performance to degrade, which needs to be adjusted through load balancing strategies. Service availability refers to the ability of a business service to continue to provide services. High-availability services mean that they can be quickly restored when a failure occurs to ensure service continuity.
[0133] As an example, see Figure 4 The management service 40 receives the access request from the application 30, and determines a candidate business service (e.g., business service 42) whose service performance is greater than a performance threshold among multiple candidate business services (e.g., business service 41, business service 42, business service 43, and business service 44) as the first business service that currently needs to respond to the access request.
[0134] In this way, by screening out candidate business services with performance greater than the performance threshold, the system can ensure that access requests are responded to by services that can be processed efficiently, thereby improving overall processing efficiency. Access requests can be allocated based on the actual performance of the service, avoiding allocating requests to services with low performance that may not respond in time, and optimizing resource allocation and utilization. Selecting services with higher performance to process access requests helps to ensure the response speed and stability of the service, thereby improving user satisfaction with the service. When the system needs to expand capacity, new business services can be added based on the performance threshold, which helps the system quickly adapt to the growth of business volume. The system runs on services with higher performance, which can reduce maintenance and troubleshooting costs caused by performance issues. Requests will not be allocated to services with performance below the threshold, thus avoiding scheduling resources in unnecessary places and reducing resource waste.
[0135] In some embodiments, after the access request is switched to the second business service, the following processing may be further performed: in response to the second business service being unable to respond to the access request, the access request is switched from the second business service to the first business service.
[0136] In some embodiments, after the access request is switched to the second business service, the second business service may be unable to respond to the access request due to a service failure or other reasons. At this time, the management service can switch the access request from the second business service to the first business service in response to the second business service being unable to respond to the access request to ensure a response to the access request.
[0137] In this way, when the second business service cannot respond to the access request, the request flow can be switched back to the original business service in a timely manner, which helps maintain service continuity and improves system reliability. It enables rapid response to faults and can quickly restore to the original service when it detects that the new service cannot handle the request, enhancing fault recovery capabilities. Through the switchback operation, the system avoids the waste of resources caused by the inability of the second business service to handle it, ensuring that resources are used effectively. Ensuring that access requests can be processed on services with good performance helps to ensure the quality and stability of the service. User requests can be responded to in a timely manner, and even in the event of service switching, the user experience will not be greatly affected. The load can be dynamically adjusted according to the actual operating status of the business service. If the new service cannot handle it, the system can quickly redistribute the load to the original service.
[0138] The following is an explanation of an exemplary application of an embodiment of the present application in an actual business processing application scenario.
[0139] Imagine a specific scenario where application A relies on Kafka's SDK to consume messages for business processing, and two Pods are deployed using Kubernetes. At present, a new version of application A needs to be released, and the new version is released to the other two Pods. Then the traffic of the two Pods of the old version is closed, and the traffic of the two Pods of the new version is opened. If the new version of the application fails to be verified, it can be quickly rolled back to the old version. At this time, the two Pods of the old version are not deleted, but the traffic is closed. To meet the requirement that the old version of the Pod stops consuming Kafka messages when the traffic is closed, the solution of this application can be used. This application enables Kubernets to synchronously change the behavior of the application consuming Kafka messages when switching traffic to the Pod. It ensures that the Pod that closes the traffic of the application will not seize the Kafka messages with the Pod that provides services normally. It also avoids the scenario where the old version of the Pod closes the traffic but still consumes Kafka messages, resulting in erroneous data caused by different behaviors of the new and old versions.
[0140] In some embodiments, see Figure 7 , Figure 7 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 1 When using a container to deploy application A in a Kubernetes environment, application A needs to explicitly specify the loading of the Kafka proxy consumption plug-in developed in the embodiment of this application. The plug-in is implemented based on Java's Instrumentation bytecode enhancement technology. When application A starts, the Kafka proxy consumption plug-in will automatically scan the SDK of the Kafka client and replace the original Kafka client's consumption API class with the proxy consumption class of the Kafka proxy consumption plug-in. In this way, when application A subscribes to Kafka's Topic and consumes messages, the Kafka proxy consumption plug-in will decide whether to actually subscribe to Kafka's Topic or consume messages based on the current Pod's traffic switch status. #Application A startup command, / opt / ext / kafkaConsumerAgent.jar is the path where the Kafka proxy consumption plug-in is located java-javaagent: / opt / ext / kafkaConsumerAgent.jar application A's jar package. At this time, when application A starts, the original method call stack for connecting to Kafka and consuming messages is. The Kafka agent consumption plug-in will continue to listen to the UnixSocket of / var / run / agentListner.sock in the local path, and receive the flow switch instruction of the current Pod to dynamically turn on the switch for the process to consume Kafka messages.
[0141] In some embodiments, see Figure 8 , Figure 8This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 2 When the deployed Pod of application A is started, the process starts successfully. At startup, the Kafka proxy consumption plug-in will not consume the messages in the Kafka queue by default. The KafkaConsumerController provided in the embodiment of the present application (implemented based on the Kubernetes custom Controller function) is required to notify the Kafka proxy consumption plug-in so that it can actually consume the messages in the Kafka queue. The KafkaConsumerController will always monitor the endpoint status of service 1 and service 2 corresponding to application A. When one endpoint becomes open to traffic, the KafkaConsumerController will use the Kubernetes API to start consuming messages in Kafka's Topic through the kafkaConsumerAgent in the Pod corresponding to the endpoint (for example, application A-consumer in service 1 and application A-consumer in service 2). Figure 8 After the application is started, the traffic is not opened for the Pods, and the Kafka proxy consumer plug-in does not consume messages by default.
[0142] In some embodiments, # / var / run / agentListner.sock is the address monitored by the Kafka agent consumer plug-in, open=true means turning on Kafka consumption, curl --unix-socket / var / run / agentListner.sock ocalhost / kafkaConsumer / switch? open=true.
[0143] In some embodiments, see Fig. 9 , Fig. 9 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 3, the traffic of service 1 is open, and the traffic of service 2 is not open. When the endpoint in service 1 appears in the endpoint list of application A, that is, when traffic will be distributed to service 1, the consumption control monitors the change of application A's endpoint and notifies the consumption control plug-in in service 1 to start consuming the messages in Kafka's Topic. The notification method is also the UnixSocket communication mechanism. KafkaConsumerController will execute the curl command in the Pod through the Kubernetes API to connect to / var / run / agentListner.sock to send instructions: # / var / run / agentListner.sock is the address listened by the Kafka agent consumption plug-in, open = true means to open Kafka consumption curl--unix-socket / var / run / agentListner.sock localhost / kafkaConsumer / switch? open = true.
[0144] In some embodiments, see Fig.10 , Fig.10 This is a schematic diagram of the principle of the business processing method provided in the embodiment of the present application. Figure 4When the endpoint in Pod1 is removed from the list of endpoints that provide services for application A, that is, when the traffic dispatched to Pod1 is closed, KafkaConsumerController monitors that the endpoint of application A has changed, and notifies the kafkaConsumerAgent in Pod1 to stop consuming messages in Kafka's Topic. The notification method is also the UnixSocket communication mechanism. KafkaConsumerController will execute the curl command in the Pod through the Kubernetes API to connect to / var / run / agentListner.sock to send instructions: # / var / run / agentListner.sock is the address that the Kafka agent consumption plug-in listens to, open=false means to close Kafka consumption; curl--unix-socket / var / run / agentListner.sock localhost / kafkaConsumer / switch? open=false. Deploy the custom KafkaConsumerController controller to the Kubernetes cluster. The KafkaConsumerController controller will always monitor the application endpoint. When the traffic of the Pod is switched, the endpoint will also change. When the application is deployed using Kubernetes, you need to specify the loading of the Kafka proxy consumption plug-in kafkaConsumerAgent in the startup parameters. The Kafka proxy consumption plug-in will listen to the specified UnixSocket path to receive notifications. When the application's Pod traffic is switched, the endpoint will change. After the KafkaConsumerController controller monitors this change, it will notify the Kafka proxy consumption plug-in kafkaConsumerAgent to change the behavior of consuming Kafka messages through UnixSocket communication in the corresponding Pod through the Kubernetes API server.
[0145] This application enables Kubernetes to change the behavior of consuming Kafka messages when switching traffic to Pod. It ensures that the Pod that closes the traffic of the application will not grab the Kafka messages from the Pod that provides services normally. It also avoids the scenario where the old version of the Pod closes the traffic but still consumes Kafka messages, resulting in erroneous data caused by different behaviors of the new and old versions in the scenario of releasing a new version of the application. It does not invade the application code. It uses Java's Instrumentation bytecode enhancement technology to enhance the SDK runtime agent of Kafka (the above-mentioned kafkaConsumerAgent) that the application depends on, so that developers can use this application to achieve the effect without modifying the code. The KafkaConsumerController developed using the custom contoller function of Kubernetes can monitor the changes of the endpoint corresponding to the Pod in real time. The event of the Pod traffic change can be immediately notified to the KafkaConsumerController, and the KafkaConsumerController also uses the Kubernetes API to notify the kafkaConsumerAgent to change the behavior of consuming Kafka messages. The synchronous changes are real-time, and the resource usage is also less, which is more in line with the cloud-native technology stack and concept. The Kafka agent consumption plug-in kafkaConsumerAgent in this application uses the UnixScoket communication method to listen for notifications of switching Kafka consumption status. This method is different from the common TcpSocket communication method, with higher transmission efficiency and compatibility, and will not conflict with the network port used by the application itself. Based on the principle, the application scope of this application is not limited to Kafka message middleware, and other types of middleware such as RabbitMQ and ActiveMQ can also achieve similar effects.
[0146] In this way, during the process of the business service responding to the access request of the application, in response to the access request, switching to the second business service, and there is a target access request that has not been responded to by the business service in the access request received by the business service, a stop instruction is generated, and the stop instruction is used to trigger the first business service to stop obtaining the message used to respond to the access request and not respond to the target access request. In this way, during the process of the business service 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, but because the business service has no access request, even if the business service responds to the target access request, it cannot feedback the response result, thereby resulting in a waste of messages. By generating a stop instruction, the first business service is triggered to stop obtaining the message used to respond to the access request and not respond to the target access request to stop wasting messages, thereby effectively improving the utilization rate of messages.
[0147] It is understandable that in the embodiments of the present application, when messages and other related data are involved, when the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0148] The following further describes an exemplary structure of the service processing device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example Figure 2 As shown, the software modules stored in the business processing device 455 of the memory 450 may include: a detection module, used to detect the traffic status of the business service to obtain the traffic status of the business service, and the traffic status is used to indicate whether the business service stops receiving access request traffic; a response module, used to schedule the business messages in the message queue based on the traffic status.
[0149] In some embodiments, the above-mentioned detection module is also used to determine the traffic state as the business service receiving the access request traffic if the business service is a business service that responds to the access request; if the business service is not a business service that responds to the access request, determine the traffic state as the business service stops receiving the access request traffic.
[0150] In some embodiments, the above-mentioned response module is also used to respond to the traffic reception status indicating that the business service stops receiving the access request traffic, respond to the access request in the access request traffic and identify the identification result; in response to the identification result indicating that there are target access requests in the access request that have not been responded to by the business service, stop scheduling the business messages in the message queue.
[0151] In some embodiments, the above-mentioned response module is also used to determine whether there is a reference access request that has been responded to by the business service in the access request in response to the identification result indicating that there is a target access request that has not been responded to by the business service; if there is a reference access request that has been responded to by the business service in the access request, determine the response progress of the business service to each reference access request; if the response progress of each reference access request indicates that the business service has completed the response to the reference access request, stop scheduling the business messages in the message queue.
[0152] In some embodiments, the above-mentioned business processing device also includes: a completion module, which is used to determine the reference access request that has not been responded to as a candidate access request if the response progress indicates that the business service has not completed the response to the reference access request; for the candidate access request, 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 completion module is further used to determine the response progress of each access request received by the business service in response to the identification result indicating that there is no target access request in the access request that has not been responded to by the business service; 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, 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-mentioned business processing device also includes: a determination module, used 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, the access request is determined as the target access request.
[0155] The following further describes an exemplary structure of the service processing device 555 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example Figure 3 As shown, the software modules stored in the business processing device 555 of the memory 550 may include: a switching module, which is used to switch the access request to the second business service in response to a service switching instruction during the process of sending an access request to the business service; the service switching instruction is used to trigger the first business service to generate a stop instruction when there is a target access request that has not been responded to by the first business service in the access request received by the first business service; the stop instruction is used to trigger the first business service to stop obtaining the message used to respond to the access request, and not respond to the target access request.
[0156] In some embodiments, the switching module is further used to receive an access request from a business program; and determine a candidate business service whose service performance is greater than a performance threshold 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 business service to the first business service in response to the second business service being unable to respond to the access request.
[0158] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the business processing method described above in the embodiment of the present application.
[0159] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the business processing method provided by the embodiment of the present application, for example, Figure 5 The business processing method 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 storage, optical disk, or CD-ROM; or it may be various electronic devices including one or any combination of the above memories.
[0161] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script 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 a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0162] As an example, computer-executable instructions may, but do not necessarily, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as 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 coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0163] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0164] In summary, the embodiments of the present application have the following beneficial effects:
[0165] (1) By detecting the traffic status of the business service, the traffic status of the business service is obtained. The traffic status is used to indicate whether the business service stops receiving access request traffic; based on the traffic status, the business messages in the message queue are scheduled. In this way, when the business service responds 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 feedback the response result, resulting in message waste. By detecting the traffic status of the business service, the traffic status of the business service is obtained. Whether the business service indicated by the traffic status stops receiving access request traffic, the business messages in the message queue are scheduled to prevent message waste, thereby effectively improving message utilization.
[0166] (2) In the process of the business service responding to the access request of the application, when the access request is switched to the second business service, the business service cannot respond to the access request that has not been received. Among the access requests received by the business service, there is a target access request that has not been responded to by the business service. In this case, the business service may respond to the target access request, thereby continuing to schedule messages. However, since the business service cannot feed back the response result of the target business request to the management service at this time, it leads to waste of messages. 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 to stop wasting messages, thereby effectively improving the utilization rate of messages.
[0167] (3) By determining the target business service that currently needs to respond to the access request, the system can avoid unnecessary processing and resource waste. This means that only relevant business services 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 been switched to the second business service, which helps ensure that the request is processed continuously on a single service and avoids 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 been switched to the second business service, which helps to quickly respond to system load changes or failures, thereby maintaining service availability and stability. Through this logic, the system can avoid repeated processing of the same request flow. If a request flow has been processed on other services, the current service will not process it again, which can prevent data inconsistency and resource waste.
[0168] (4) By detecting the response progress, the business service can ensure that each access request that has been responded to can be 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 will continue to be processed based on the message that has been 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 the candidate access request 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 scheduling of resources, especially when the service no longer needs these resources. When a business service is unable to continue processing requests due to a failure or other reasons, the stop command can quickly trigger the reallocation of resources, which helps to quickly restore and continue the service. The stop command, together with the resource reallocation mechanism, helps to achieve system load balancing and avoid situations where some services are overloaded while other services are idle. By sending the target access request to the second business service, it can be ensured that the service can continue to be provided seamlessly even when some business services are unable to continue working, ensuring the continuity and reliability of the business service.
[0170] (6) When the access request switches from the second business service back to the original business service, the recovery instruction helps optimize the load distribution of the entire system to avoid overloading some services while other services are idle. Through the recovery instruction, the business service obtains resources only when needed, which helps to reduce resource waste and improve resource utilization. The ability to quickly respond to service status changes allows business services to resume service in a short period of time, improving system availability. The recovery instruction mechanism enables business services to quickly recover from failures, enhancing the system's fault recovery capabilities. Recovery instructions support elastic scaling when facing different workloads, allowing the system to adapt to different business needs.
[0171] (7) By determining the target business service, it is clear which services should be responsible for responding to specific access requests, which helps avoid confusion of responsibilities between services and duplication or omissions in request processing. If the business service confirms that it is the target business service, it can ensure that the access request is correctly routed to the service that should handle it, thereby optimizing the distribution and routing of requests. When the business service confirms that it is not the target business service, it can avoid processing request flows that it is not responsible for, reducing ineffective computing and network overhead. Ensuring that only the target business service handles specific request flows can avoid conflicts and competition between multiple services and improve the overall processing efficiency of the system. By correctly switching and allocating access requests, more effective load balancing can be achieved to avoid overloading some services while other services are idle.
[0172] (8) By screening out candidate business services whose performance is greater than the performance threshold, the system can ensure that access requests are responded to by services that can be processed efficiently, thereby improving overall processing efficiency. Access requests can be allocated based on the actual performance of the service, avoiding allocating requests to services with lower performance that may not respond in time, thereby optimizing resource allocation and utilization. Selecting services with higher performance to process access requests helps ensure the response speed and stability of the service, thereby improving user satisfaction with the service. When the system needs to expand capacity, new business services can be added based on the performance threshold, which helps the system quickly adapt to the growth of business volume. The system runs on services with higher performance, which can reduce maintenance and troubleshooting costs caused by performance issues. Requests will not be allocated to services with performance below the threshold, thereby avoiding scheduling resources in unnecessary places and reducing resource waste.
[0173] (9) When the second business service cannot respond to the access request, the request flow can be switched back to the original business service in a timely manner, which helps maintain service continuity and improves system reliability. This enables rapid response to faults and rapid recovery to the original service when it is detected that the new service cannot handle the request, thus enhancing fault recovery capabilities. Through the switchback operation, the system avoids the waste of resources caused by the inability of the second business service to handle the request and ensures that resources are used effectively. Ensuring that access requests can be processed on services with good performance helps to ensure the quality and stability of the service. User requests can be responded to in a timely manner, and even in the event of service switching, the user experience will not be greatly affected. The load can be dynamically adjusted according to the actual operating status of the business service. If the new service cannot handle the request, the system can quickly reallocate the load to the original service.
[0174] (10) This application enables Kubernetes to change the behavior of consuming Kafka messages when switching traffic to Pod. This ensures that the Pod that closes the traffic of the application will not compete with the Pod that provides services normally for Kafka messages. This also avoids the situation where the old version of the Pod closes the traffic but still consumes Kafka messages in the scenario where a new version of the application is released, resulting in erroneous data caused by different behaviors of the new and old versions. There is no intrusion into the application code. The use of Java's Instrumentation bytecode enhancement technology for the Kafka SDK runtime agent (i.e. the above-mentioned kafkaConsumerAgent) that the application depends on allows developers to use this application to achieve the effect without modifying the code. The KafkaConsumerController developed using the custom contoller function of Kubernetes can monitor the changes of the endpoint corresponding to the Pod in real time. The event of Pod traffic change can be immediately notified to the KafkaConsumerController, and the KafkaConsumerController also uses the Kubernetes API to notify the kafkaConsumerAgent to change the behavior of consuming Kafka messages. The synchronous changes are real-time, and the resource usage is also less, 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, we can effectively optimize resource allocation and improve system performance, and correctly direct traffic to business services responsible for responding to access requests, ensuring the specificity and efficiency of services, thereby reducing unnecessary service processing burdens. At the same time, for non-responsive services, timely blocking their access request traffic can avoid waste of service resources, enhance security and stability, and ensure the rational flow of traffic and overall operating efficiency.
[0176] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A business processing method, characterized in that: The method comprises: Performing flow status detection on the business service to obtain the flow status of the business service, wherein the flow status is used to indicate whether the business service stops receiving access request flow; Based on the traffic status, the service messages in the message queue are scheduled.
2. The method according to claim 1, characterized in that The detecting the flow status of the business service to obtain the flow status of the business service includes: If the business service is a business service that responds to the access request, determining the traffic state as the business service receiving the access request traffic; If the business service is not a business service that responds to the access request, the traffic state is determined as the business service stopping receiving the access request traffic.
3. The method according to claim 1, characterized in that: The scheduling of the service messages in the message queue based on the traffic reception state includes: In response to the traffic reception status indicating that the business service stops receiving the access request traffic, responding to and identifying the access request in the access request traffic to obtain an 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 business service, scheduling of the business message in the message queue is stopped.
4. The method according to claim 3, characterized in that In response to the identification result indicating that there is a target access request that has not been responded to by the business service in the access request, stopping scheduling the business message 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, determining whether there is a reference access request in the access request that has been responded to by the business service; If there are reference access requests that have been responded to by the business service in the access requests, determining 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, then the scheduling of the business message in the message queue is stopped.
5. The method according to claim 4, 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 business service has not completed the response to the reference access request, the reference access request that has not been responded to is determined as a candidate access request; For the candidate access request, respond to the candidate access request based on the service message until the response to the candidate access request is completed.
6. The method according to claim 3, characterized in that: In response to the traffic reception status indicating that the business service stops receiving the access request traffic, responding to and identifying the access request in the access request traffic, and after obtaining the identification result, the method further includes: In response to the identification result indicating that there is no target access request in the access requests that has not been responded to by the business service, determining a response progress of each of the access requests received by the business service; For each of the access requests, if the response progress of the access request indicates that the business service has not completed the response to the access request, the access request is responded to based on the business message until the response to the access request is completed.
7. The method according to claim 3, characterized in that Before identifying the response to the access request in the access request traffic and obtaining the identification result, the method further includes: The response progress of the business service to the access request is obtained, and if the response progress indicates that the access request has not been responded to by the business service, the access request is determined as the target access request.
8. A service processing device, characterized in that: The device comprises: A detection module, used to detect the flow status of the business service to obtain the flow status of the business service, wherein the flow status is used to indicate whether the business service stops receiving access request flow; The response module is used to schedule the service messages in the message queue based on the traffic status.
9. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; The processor is used to implement the business processing method described in any one of claims 1 to 7 when executing the computer executable instructions or computer programs stored in the memory.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the business processing method according to any one of claims 1 to 7 is implemented.
11. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the business processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Service management method, device and equipment and computer readable medium
CN112995017A
Service processing method and device
CN113760533A
Data control method and device, electronic equipment and computer readable storage medium
CN115118782A
Traffic scheduling method and device, electronic equipment and storage medium
CN115865932A
Business data processing method and device, equipment and medium
CN116567083A