Information processing method and device, server cluster, electronic equipment and medium
Patent Information
- Application Number
- CN202310774753.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2043-06-28
AI Technical Summary
[0003]目前,主流的应用服务器均不支持动态扩展线程池资源,当出现交易流量突增或交易流量分配不均造成个别服务器线程池资源紧张甚至用尽时,受限于负载均衡策略,无法第一时间将交易流量更多地分配到空闲服务器上,缺少这种动态调整负载的能力导致应用服务器应急能力较弱
[0081] According to an eighth aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described above.
Smart Images

Figure CN116743754B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of information processing technology and cloud computing technology, and more specifically to an information processing method, apparatus, server cluster, electronic device and medium. Background Technology
[0002] A thread pool is a thread management technique that utilizes pooling principles. Its primary purpose is to reuse threads, conveniently manage threads and tasks, and decouple thread creation from task execution. Thread pools can be created to reuse already created threads, reducing the resource consumption caused by frequent thread creation and destruction. Application servers mainly rely on thread pool resources to handle client requests. Thread pool resources are dedicated resources for this server, and their capacity largely determines the application server's performance capacity in handling client requests. The size of the thread pool is typically estimated through simulated performance testing and configured before the business system goes live.
[0003] Currently, mainstream application servers do not support dynamically expanding thread pool resources. When there is a sudden surge in transaction traffic or uneven distribution of transaction traffic, causing some servers to experience thread pool resource shortages or even exhaustion, the load balancing strategy cannot immediately allocate more transaction traffic to idle servers. The lack of this ability to dynamically adjust the load results in weak emergency response capabilities for application servers.
[0004] The information disclosed in this section is only for understanding the background of the inventive concept of the present invention. Therefore, the above information may include information that does not constitute prior art. Summary of the Invention
[0005] In view of the above problems, according to a first aspect of the present invention, an embodiment of the present invention provides an information processing method applied to a first server, the method comprising:
[0006] Get transaction requests from the client;
[0007] Obtain the current utilization rate of the thread pool corresponding to the first server, and compare the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server.
[0008] In response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, a broadcast message is generated according to the transaction request, and the broadcast message is broadcast to multiple other servers different from the first server, wherein the multiple other servers are servers in the same server cluster as the first server and of the same type as the first server;
[0009] Obtain the response information from the second server in response to the broadcast information, wherein the second server is one of the plurality of other servers;
[0010] Based on the response information, the transaction request is forwarded to the second server; and
[0011] Obtain the processing result of the transaction request from the second server and send the processing result back to the client.
[0012] According to some exemplary embodiments, the first server and the plurality of other servers belong to the same server list;
[0013] The method further includes: sending registration information of the first server, the registration information including server type, server IP address and server UDP port; and obtaining a server list, the server list including server type, server IP address and server UDP port of multiple servers, wherein the multiple servers in the server list have the same server type, and the multiple servers include the first server and the multiple other servers.
[0014] According to some exemplary embodiments, broadcasting the broadcast information to multiple other servers different from the first server includes: broadcasting the broadcast information based on the server IP address and server UDP port of multiple other servers in the server list.
[0015] According to some exemplary embodiments, generating broadcast information based on the transaction request includes: generating a broadcast object based on the transaction request, wherein the broadcast object includes a transaction request object, characteristic values of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object. The characteristic values of the transaction request object are a part of the broadcast information.
[0016] According to some exemplary embodiments, after broadcasting the broadcast information to a plurality of other servers different from the first server, the method further includes:
[0017] The lock object of the broadcast object is controlled to enter a waiting state; and
[0018] In response to the activation signal, the lock object of the broadcast object is awakened.
[0019] According to some exemplary embodiments, the broadcast information includes: the server IP address of the first server, the server UDP port, and the characteristic value of the transaction request object.
[0020] According to some exemplary embodiments, obtaining the response information of the second server to the broadcast information further includes:
[0021] While the lock object of the broadcast object is in a waiting state, listen for request information from the plurality of other servers;
[0022] In response to receiving a request from one of the other servers, the request information is obtained;
[0023] Determine whether the request information is a response information; and
[0024] In response to the request information being a response, the response information of the second server to the broadcast information is obtained, wherein the response information includes the server IP address, server UDP port, and characteristic values of the transaction request object of the second server.
[0025] According to some exemplary embodiments, obtaining the response information of the second server to the broadcast information further includes:
[0026] Based on the characteristic value of the transaction request object in the response information, determine the broadcast object corresponding to that characteristic value; and
[0027] Based on the response information, assign values to the IP address and port of the response object in the broadcast object.
[0028] According to some exemplary embodiments, waking up the lock object of the broadcast object in response to an activation signal includes: sending a first activation signal to the lock object of the broadcast object in response to assigning values to the IP address and port of the response object in the broadcast object, so as to wake up the lock object of the broadcast object.
[0029] According to some exemplary embodiments, the method further includes:
[0030] Based on the broadcast time in the broadcast object, determine whether this broadcast is a timeout broadcast; and
[0031] In response to the fact that this broadcast is a timeout broadcast, the broadcast status in the broadcast object is set to timeout status.
[0032] According to some exemplary embodiments, waking up the lock object of the broadcast object in response to an activation signal includes:
[0033] In response to setting the broadcast state in the broadcast object to a timeout state, a second activation signal is sent to the lock object of the broadcast object to wake up the lock object of the broadcast object.
[0034] According to some exemplary embodiments, the method further includes:
[0035] If the request information is not a response information, determine whether the request information is a broadcast information;
[0036] In response to the request being a broadcast message, assess the current utilization rate of the thread pool corresponding to the first server; and
[0037] If the current utilization rate of the thread pool corresponding to the first server exceeds the utilization rate threshold of the thread pool corresponding to the first server, the request information will not be responded to.
[0038] According to some exemplary embodiments, in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, generating broadcast information according to the transaction request, and broadcasting the broadcast information to multiple other servers different from the first server, specifically includes:
[0039] In response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, the request header of the transaction request is obtained;
[0040] The request header in response to the transaction request includes a broadcast count field; the value of the broadcast count field in the transaction request is compared with a broadcast count threshold; and
[0041] If the value of the broadcast count field in the transaction request does not exceed the broadcast count threshold, a broadcast message is generated according to the transaction request and broadcast to multiple other servers different from the first server.
[0042] According to some exemplary embodiments, the step of generating broadcast information based on the transaction request and broadcasting the broadcast information to multiple other servers different from the first server in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server further includes:
[0043] In response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, the request header of the transaction request is obtained; and
[0044] The request header in response to the transaction request does not include a broadcast count field. Based on the transaction request, broadcast information is generated and broadcast to multiple other servers different from the first server.
[0045] According to some exemplary embodiments, after waking up the lock object of the broadcast object in response to an activation signal, the method further includes:
[0046] Check the broadcast status in the broadcast object;
[0047] In response to the broadcast state in the broadcast object not being a timeout state, obtain the request header of the transaction request;
[0048] Check whether the request header of the transaction request includes a broadcast count field;
[0049] In response to the transaction request header not including a broadcast count field, a broadcast count field is added to the transaction request header, and the value of the broadcast count field is set to 1; and
[0050] The request header in response to the transaction request includes a broadcast count field, and the value of the broadcast count field in the transaction request is incremented by one.
[0051] According to a second aspect of the present invention, an information processing method is also provided, applied to a second server, the method comprising:
[0052] Listen for request information from multiple other servers, wherein the multiple other servers are servers that are in the same server cluster as the second server and are of the same type as the second server;
[0053] In response to receiving a request from a first server among the plurality of other servers, the request information is obtained, wherein the first server is one of the plurality of other servers;
[0054] Determine whether the request information is a broadcast message;
[0055] In response to the request being broadcast, the current utilization rate of the thread pool corresponding to the second server is assessed.
[0056] In response to the fact that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server, a response message is sent to the first server;
[0057] Receive transaction requests forwarded by the first server; and
[0058] The transaction request is processed, and the processing result is sent to the first server.
[0059] According to a third aspect of the present invention, an information processing method is also provided, applied to a server cluster including a first server and a second server, the method comprising:
[0060] The first server receives a transaction request from the client;
[0061] The first server obtains the current utilization rate of the thread pool corresponding to the first server, and the first server compares the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server.
[0062] In response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, the first server generates broadcast information according to the transaction request, and the first server broadcasts the broadcast information to a plurality of other servers different from the first server, wherein the plurality of other servers are servers that are in the same server cluster as the first server and are of the same type as the first server.
[0063] In response to detecting a broadcast message from the first server, the second server obtains the broadcast message, wherein the second server is one of the plurality of other servers;
[0064] In response to the broadcast information, the second server assesses the current utilization rate of the thread pool corresponding to the second server;
[0065] In response to the fact that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server, the second server sends a response message to the first server;
[0066] The first server obtains the response information from the second server in response to the broadcast information;
[0067] Based on the response information, the first server forwards the transaction request to the second server;
[0068] The second server receives the transaction request forwarded by the first server;
[0069] The second server processes the transaction request and sends the processing result to the first server; and
[0070] The first server obtains the processing result of the second server on the transaction request and feeds back the processing result to the client.
[0071] According to a fourth aspect of the present invention, a server cluster is also provided, the server cluster including a first server and a second server, wherein the first server is configured to perform the method as described in the first aspect above, and the second server is configured to perform the method as described in the second aspect above.
[0072] According to a fifth aspect of the present invention, an information processing apparatus is also provided, applied to a first server, the apparatus comprising:
[0073] The transaction request acquisition module is used to acquire transaction requests from clients;
[0074] The comparison module is used to obtain the current utilization rate of the thread pool corresponding to the first server and compare the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server.
[0075] The broadcast module is used to respond to the fact that the current utilization rate of the thread pool corresponding to the first server exceeds the utilization rate threshold of the thread pool corresponding to the first server, generate broadcast information according to the transaction request, and broadcast the broadcast information to multiple other servers different from the first server, wherein the multiple other servers are servers that are in the same server cluster as the first server and are of the same type as the first server;
[0076] The response information acquisition module is used to acquire the response information of the second server in response to the broadcast information, wherein the second server is one of the plurality of other servers;
[0077] A forwarding module is configured to forward the transaction request to the second server based on the response information; and
[0078] The result acquisition module is used to acquire the processing result of the second server on the transaction request and to feed back the processing result to the client.
[0079] According to a sixth aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method as described above.
[0080] According to a seventh aspect of the present invention, a computer-readable storage medium is provided having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method described above.
[0081] According to an eighth aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described above.
[0082] The above one or more embodiments have the following advantages or beneficial effects: when the thread pool utilization of a certain server is high, transaction requests can be dynamically distributed to servers with relatively idle resources through a broadcast mechanism, thereby achieving the purpose of dynamically adjusting the load. Attached Figure Description
[0083] The above-described features, other objects, and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:
[0084] Figure 1 The diagram illustrates an application scenario of the information processing method according to an embodiment of the present invention, specifically a client-server cluster application scenario.
[0085] Figure 2A The illustration shows an exemplary system architecture to which the information processing method according to an embodiment of the present invention can be applied.
[0086] Figure 2B Schematic illustration Figure 2A The diagram shows the processing flow of the registry center in the system architecture.
[0087] Figure 3 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown.
[0088] Figure 4 The illustration schematically shows a swimlane diagram of an information processing method performed in a system according to some exemplary embodiments of the present invention.
[0089] Figure 5 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown, the information processing method being applied to a first server.
[0090] Figure 6 The flowchart illustrating the wait-to-wake process in an information processing method according to some exemplary embodiments of the present invention is shown.
[0091] Figure 7 The flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown in a first wake-up case.
[0092] Figure 8 The flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown in a second wake-up scenario.
[0093] Figure 9 A flowchart illustrating an information processing method according to some other exemplary embodiments of the present invention is shown.
[0094] Figure 10 A flowchart illustrating an information processing method according to some further exemplary embodiments of the present invention is shown.
[0095] Figure 11A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown, the information processing method being applied to a second server.
[0096] Figure 12 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the registration unit in the system architecture.
[0097] Figure 13 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the load unit in the system architecture.
[0098] Figure 14 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the broadcast unit in the system architecture.
[0099] Figure 15 A swimlane diagram illustrating the execution of the information processing method according to an embodiment of the present invention on various units is shown schematically.
[0100] Figure 16 A schematic block diagram of an information processing apparatus according to an embodiment of the present invention is shown.
[0101] Figure 17 The schematic diagram illustrates a structural block diagram of an information processing apparatus according to some other exemplary embodiments of the present invention.
[0102] Figure 18 The schematic diagram illustrates a structural block diagram of an information processing apparatus according to some further exemplary embodiments of the present invention.
[0103] Figure 19 A block diagram of an electronic device suitable for implementing an information processing method according to an embodiment of the present invention is shown schematically. Detailed Implementation
[0104] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.
[0105] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0106] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0107] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).
[0108] In the technical solution of this invention, the acquisition, storage and application of user personal information all comply with the provisions of relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.
[0109] First, the technical terms used in this article are explained and clarified as follows.
[0110] A client, also known as a user terminal, is a program that provides local services to a client, corresponding to a server. Except for some applications that run only locally, they are generally installed on ordinary client machines and need to work in conjunction with the server. With the development of the Internet, commonly used client applications include web browsers used for the World Wide Web, email clients for sending and receiving emails, and instant messaging client software. These types of applications require corresponding servers and service programs on the network to provide the services, such as database services and email services.
[0111] A server, also known as a server-side or service provider, provides "services" to clients, receives and stores data or requests sent by clients, responds to and processes requests, and sends data back to clients.
[0112] A distributed system is a system consisting of a group of computer nodes that communicate through a network and coordinate their work to accomplish a common task. Distributed systems emerged to use inexpensive, ordinary machines to perform computational and storage tasks that a single computer cannot. Its goal is to utilize more machines to process more data.
[0113] A cluster, in English, is a technology that connects multiple servers together over a network, enabling them to function like or appear as a single computer.
[0114] A thread pool is a thread management technique that utilizes pooling principles. Its main purpose is to reuse threads, conveniently manage threads and tasks, and decouple thread creation from task execution. Thread pools can be created to reuse already created threads, reducing the resource consumption caused by frequently creating and destroying threads.
[0115] Broadcast: Within the same network reach, a network device communicates with all devices within the network. For example, in a server cluster, this is a one-to-all communication mode between servers.
[0116] HTTP: Hypertext Transfer Protocol, is a simple request-response protocol that typically runs on top of TCP. It specifies what messages a client might send to a server and what responses it might receive.
[0117] An IP address (Internet Protocol Address) is a standardized address format provided by the IP protocol. It assigns a logical address to every network and every host on the Internet, thus masking the differences in physical addresses.
[0118] UDP, short for User Datagram Protocol, is a connectionless transport layer protocol in the OSI (Open Systems Interconnection) reference model. It provides a simple, unreliable, transaction-oriented message delivery service. Like TCP, UDP handles data packets, and both reside in the transport layer above IP in the OSI model. UDP supports network applications that require data transfer between computers. Many client / server network applications, including network video conferencing systems, require the use of UDP.
[0119] Currently, application servers primarily rely on thread pool resources to handle client requests. These thread pool resources are dedicated to the server, and their capacity largely determines the application server's performance in processing client requests. The size of the thread pool is typically estimated through simulated performance testing and configured before the business system goes live. Most mainstream application servers do not support dynamically expanding thread pool resources. When a sudden surge in transaction traffic or uneven distribution of transaction traffic causes thread pool resources to become strained or even exhausted on some servers, the load balancing strategy cannot immediately allocate more transaction traffic to idle servers. This lack of dynamic load adjustment capability results in weak emergency response capabilities for application servers.
[0120] Based on this, embodiments of the present invention provide an information processing method. In some embodiments, the information processing method can be applied to a first server, the method comprising: obtaining a transaction request from a client; obtaining the current utilization rate of the thread pool corresponding to the first server, and comparing the current utilization rate of the thread pool corresponding to the first server with a utilization rate threshold of the thread pool corresponding to the first server; in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, generating broadcast information according to the transaction request, and broadcasting the broadcast information to a plurality of other servers different from the first server, wherein the plurality of other servers are servers in the same server cluster as the first server and of the same type as the first server; obtaining response information from a second server to the broadcast information, wherein the second server is one of the plurality of other servers; forwarding the transaction request to the second server according to the response information; and obtaining the processing result of the second server on the transaction request, and feeding back the processing result to the client. In embodiments of the present invention, when the thread pool utilization rate of a certain server is high, the transaction request can be dynamically distributed to servers with relatively idle resources for processing through a broadcast mechanism, thereby achieving the purpose of dynamically adjusting the load. In particular, it is advantageous in situations of sudden surges in transaction requests or server expansion, as it helps business systems quickly achieve balanced resource utilization through load redistribution.
[0121] In some embodiments, the information processing method can be applied to a second server. The method includes: listening to request information from multiple other servers, wherein the multiple other servers are servers in the same server cluster as the second server and of the same type as the second server; in response to listening to request information from a first server among the multiple other servers, acquiring the request information, wherein the first server is one of the multiple other servers; determining whether the request information is broadcast information; and in response to the request information being broadcast information, evaluating the current utilization rate of the thread pool corresponding to the second server; and in response to the current utilization rate of the thread pool corresponding to the second server not exceeding the utilization rate threshold of the thread pool corresponding to the second server, sending response information to the first server; receiving a transaction request forwarded by the first server; and processing the transaction request and sending the processing result to the first server. In embodiments of the present invention, when the thread pool utilization rate of a certain server is high, the broadcast mechanism can be used to control the distribution of transaction requests to servers with relatively idle resources, thereby achieving the purpose of dynamically adjusting the load. Particularly advantageously, in cases of a sudden increase in transaction requests or server expansion, it helps the business system quickly achieve a balance in resource utilization through load reallocation.
[0122] In some embodiments, the information processing method can be applied to a server cluster including a first server and a second server. The method includes: the first server receiving a transaction request from a client; the first server receiving the current utilization rate of a thread pool corresponding to the first server, and the first server comparing the current utilization rate of the thread pool corresponding to the first server with a utilization rate threshold of the thread pool corresponding to the first server; in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, the first server generating broadcast information according to the transaction request, and the first server broadcasting the broadcast information to a plurality of other servers different from the first server, wherein the plurality of other servers are servers in the same server cluster as the first server and of the same type as the first server; in response to listening to the broadcast information from the first server... The second server receives the broadcast information, wherein the second server is one of the plurality of other servers; in response to the broadcast information, the second server assesses the current utilization rate of the thread pool corresponding to the second server; and in response that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server, the second server sends a response information to the first server; the first server receives the response information of the second server in response to the broadcast information; according to the response information, the first server forwards the transaction request to the second server; the second server receives the transaction request forwarded by the first server; the second server processes the transaction request and sends the processing result to the first server; and the first server obtains the processing result of the transaction request from the second server and feeds back the processing result to the client. In an embodiment of the present invention, when the thread pool utilization rate of a certain server is high, the transaction request can be dynamically distributed to a server with relatively idle resources through the broadcast mechanism, thereby achieving the purpose of dynamically adjusting the load. Particularly advantageously, in the case of a sudden increase in transaction requests or server expansion, it helps the business system to quickly achieve a balance in resource utilization through load reallocation. In the embodiments of the present invention, the limitations of single server resources are overcome, the load capacity of all servers is utilized to the maximum extent, the continuity of business processing is guaranteed when individual server resources are scarce, and the success rate of the entire business system in processing requests can be effectively improved.
[0123] It should be noted that the information processing method and apparatus provided in the embodiments of the present invention can be applied to the fields of cloud computing and distributed technology, as well as the financial field.
[0124] Figure 1The diagram illustrates an application scenario of the information processing method according to an embodiment of the present invention, specifically a client-server cluster application scenario. It should be noted that... Figure 1 The examples shown are merely examples of scenarios where embodiments of the present invention can be applied, to help those skilled in the art understand the technical content of the present invention, but do not mean that embodiments of the present invention cannot be used in other devices, systems, environments or scenarios.
[0125] like Figure 1 As shown, application scenario 100 according to this embodiment may include a terminal device (i.e., client) 101, a network 102, and servers 103, 104, and 105. Network 102 serves as a medium for providing communication links between the terminal device 101 and servers 103, 104, and 105, and between the servers 103, 104, and 105. Network 102 may include various connection types, such as wired or wireless communication links, or fiber optic cables.
[0126] Users can use terminal device 101 to interact with servers 103, 104, and 105 via network 102 to receive or send messages, etc. Various communication client applications can be installed on terminal device 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0127] Terminal device 101 can be various electronic devices with a display screen and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0128] Servers 103, 104, and 105 can be servers that provide various services, such as a backend management server that supports the website browsed by the user using terminal device 101 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0129] It should be noted that the information processing method provided in the embodiments of the present invention can be executed by at least one of servers 103, 104, and 105. Correspondingly, the information processing device provided in the embodiments of the present invention can generally be located on at least one of servers 103, 104, and 105. The information processing method provided in the embodiments of the present invention can also be executed by other servers or server clusters that are different from servers 103, 104, and 105 and capable of communicating with terminal device 101 and / or servers 103, 104, and 105. Correspondingly, the information processing device provided in the embodiments of the present invention can also be located in other servers or server clusters that are different from servers 103, 104, and 105 and capable of communicating with terminal device 101 and / or servers 103, 104, and 105.
[0130] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0131] Figure 2A The illustration schematically depicts an exemplary system architecture to which the information processing method according to embodiments of the present invention can be applied. In an exemplary embodiment, the information processing method can be applied to a server cluster, for example, the server cluster can have a distributed system architecture. It should be noted that... Figure 2A The examples shown are merely examples of system architectures to which the methods of the embodiments of the present invention can be applied, in order to help those skilled in the art understand the technical content of the present invention, but do not mean that the embodiments of the present invention cannot be used in other system architectures.
[0132] like Figure 2A As shown, the system architecture 200 according to this embodiment may include multiple servers 103, 104, 105 and a registration center 210. It should be noted that... Figure 2A The example shows three servers 103-105, but this does not imply a limitation on the number of servers in the embodiments of the present invention. In the embodiments of the present invention, the number of servers can be arbitrary; for example, more than two servers, more than ten servers, or more than one hundred servers can be set. The embodiments of the present invention do not impose any particular limitation on the number of servers.
[0133] Servers 103, 104, and 105 can run various software, applications, or programs. Servers 103, 104, and 105 can communicate and connect with each other in various ways, such as, but not limited to, wired connections, wireless connections, signaling connections, and connections via the Internet. Multiple servers 103, 104, and 105 can be used to implement one or more services, such as, but not limited to, financial-related services, with each service corresponding to a transaction.
[0134] Registration center 210 is used to configure and manage each server 103, 104, and 105. Registration center 210 may include one or more computers. Registration center 210 can communicate with each server 103, 104, and 105 in various ways, including but not limited to wired connections, wireless connections, signaling connections, and connections via the Internet.
[0135] like Figure 2A As shown, each server 103, 104, and 105 may include its own transaction broadcasting device. Specifically, the transaction broadcasting device may include a registration unit 220, a load unit 230, and a broadcasting unit 240.
[0136] In implementing the information processing method provided in this embodiment of the invention, the registration center 210 can be responsible for receiving and storing the registration information sent by the registration units 220 of each server, responding with a list of all registration information of the same server type to the registration units 220 of each server, and periodically checking the registration information and cleaning up expired information. For example, the registration information may include server type, server IP address, external service UDP port, and the time of last sending of liveness information.
[0137] Registration unit 220 is responsible for registering its server with registration center 210 and obtaining a list of servers of the same type. Registration unit 220 starts when its assigned server starts, reads the configuration from the server's configuration file, periodically registers its server's registration information with registration center 210, and receives a list of servers of the same type from registration center 210. For example, the configuration may include information such as server type, external service HTTP port, external service UDP port, registration center address, broadcast count threshold, broadcast timeout, thread pool utilization threshold, and registration information update interval.
[0138] Load unit 230 is responsible for intercepting transaction requests received by the event selector. It determines whether to broadcast the transaction based on the current thread pool utilization and the number of times the request has been broadcast. If the transaction is broadcast, it is assigned to the broadcast unit for processing; otherwise, it is assigned to its respective server for processing.
[0139] Broadcast unit 240 is responsible for sending and responding to broadcasts, receiving broadcast information allocated by load unit 230 and broadcasting the broadcast information, receiving broadcast response information from other servers, forwarding transactions after broadcasting, waiting for processing results and returning them to load unit 230; after receiving broadcast requests from broadcast units of other servers, it evaluates the thread pool utilization rate of this server, and if the utilization rate meets the requirements, it responds to the broadcast request.
[0140] Figure 2B Schematic illustration Figure 2A The diagram shows the processing flow of the registry center in the system architecture.
[0141] Combined with reference Figure 2A and Figure 2B The processing flow of the registration center 210 may include operations (i.e. steps) S201 to S209.
[0142] In operation S201, the registration center 210 is started and the registration center configuration file is read. For example, the registration center configuration file may include information such as HTTP port, registration information expiration time, and check interval.
[0143] When operating S202, start the HTTP listener program according to the configured HTTP port.
[0144] In operation S203, the registration information management thread is started, and the registration information is checked according to the configured registration information expiration time and check time.
[0145] In operation S204, the registration center 210 receives registration information sent by the registration units 220 of each server 103, 104, and 105.
[0146] For example, the registration information may include server type, server IP, external service UDP port, and the time when the last liveness information was sent.
[0147] In operation S205, the server list is updated. Specifically, based on the server type and server IP in the submitted registration information, the server list is checked to see if there is any registered information. If it exists, the time of the last transmission of liveness information is updated using the current reception time. If it does not exist, the registration information is categorized and stored according to the server type in the submitted registration information, and the current transmission time is recorded.
[0148] In operation S206, all registration information of servers of the same type are obtained according to the server type in the submitted registration information, and returned to registration unit 220 in the form of a response request.
[0149] In operation S207, the registration information management thread periodically checks the registration information in the list of registered servers one by one.
[0150] In operation S208, the time interval from the current time to the last time each registration information was sent with its survival information is calculated. If the time interval is greater than the registration information expiration time, the registration information is deleted; if the time interval is less than the registration information expiration time, no action is taken.
[0151] After the S209 operation is completed, it will go into hibernation according to the configured check interval.
[0152] In the embodiments of the present invention, the registration information of each server in the server list can be updated periodically through the above registration process, ensuring that the registration information of each server remains up-to-date. In particular, it is advantageous to update the list of servers of the same type periodically, which is beneficial for subsequent information broadcasting.
[0153] The following will be based on Figure 1 The application scenarios described and Figure 2A and Figure 2B The described system architecture, through Figures 3 to 15 The information processing method provided by the embodiments of the present invention will be described in detail.
[0154] Figure 3 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown. Figure 4 The illustration schematically shows a swimlane diagram of an information processing method performed in a system according to some exemplary embodiments of the present invention.
[0155] like Figure 3 and Figure 4 As shown, the information processing method 300 according to this embodiment may include operations S301 to S311. The information processing method 300 can be applied to... Figure 1 and Figure 2A In the server cluster shown.
[0156] It should be noted that the server cluster may include n servers, where n is a positive integer greater than or equal to 2. In the following embodiments, for ease of description, two servers are exemplarily described, referred to as a first server and a second server, where the first server is an example of a server sending a broadcast, and the second server is an example of a server responding to a broadcast. However, such a description should not be construed as a limitation on the embodiments of the present invention. In other embodiments, the server cluster may include multiple servers sending broadcasts and multiple servers responding to broadcasts. For example, in the server cluster, each server may act as both a server sending a broadcast and a server responding to a broadcast.
[0157] For example, such as Figure 1 and Figure 2A As shown, server 103 can be the first server, and server 104 can be the second server.
[0158] In operation S301, the first server 103 receives a transaction request from the client 101. It should be noted that "transaction request" here refers to any request sent by the client to the server for processing, such as a payment transaction request, a data processing request, or an information provision request.
[0159] Specifically, client 101 can send a transaction request, and the load unit 230 of the first server 103 can intercept the transaction request received by the event selector. For example, the event selector can be an NIO Selector. In Java, NIO stands for Synchronous Non-blocking. The server implementation mode is that one thread handles multiple requests. That is, connection requests sent by clients are registered to a multiplexer, and the multiplexer processes I / O requests when it finds a connection. A single thread can call a multiplexer (e.g., a Selector in Java) to listen for I / O requests from multiple clients. Once an I / O request is received, the corresponding function is called to handle it. NIO excels at managing multiple requests with one thread, which helps save system resources.
[0160] In operation S302, the first server 103 obtains the current utilization rate of the thread pool corresponding to the first server 103, and the first server 103 compares the current utilization rate of the thread pool corresponding to the first server 103 with the utilization rate threshold of the thread pool corresponding to the first server 103.
[0161] In embodiments of the present invention, each server has its own corresponding thread pool, and the current utilization rate of its corresponding thread pool can be monitored in real time. Similar to CPU utilization and memory utilization, the current utilization rate of the thread pool can be expressed as a percentage.
[0162] For example, a thread pool utilization threshold can be set for each server's corresponding thread pool. The thread pool utilization threshold can be set according to the specific application scenario of the server. For example, the thread pool utilization threshold can be set to 60%, 70%, 75%, 80%, 90%, or 95%, etc.
[0163] In operation S303, in response to the current utilization rate of the thread pool corresponding to the first server 103 exceeding the utilization rate threshold of the thread pool corresponding to the first server 103, the first server 103 generates broadcast information according to the transaction request, and the first server 103 broadcasts the broadcast information to a plurality of other servers different from the first server 103, wherein the plurality of other servers are servers that are in the same server cluster as the first server 103 and are of the same type as the first server 103.
[0164] For example, in Figure 1 and Figure 2A In the embodiment shown, servers 103 to 105 can be in the same server cluster.
[0165] For example, in a network environment, servers can be categorized into file servers, database servers, application servers, web servers, etc., based on the type of services they provide. In some exemplary embodiments, in Figure 1 and Figure 2A In the illustrated embodiment, servers 103-105 may be in the same server cluster, and servers 103-105 may be of the same type, for example, they may all be application servers. In this embodiment, servers 104 and 105 are servers in the same server cluster as the first server 103 and of the same type as the first server 103.
[0166] In this operation, after comparison, it is determined that the current utilization rate of the thread pool corresponding to the first server 103 exceeds the utilization rate threshold of the thread pool corresponding to the first server 103, and it is estimated that the resources of the first server 103 are insufficient to handle the transaction request. In this case, the first server 103 needs to broadcast the transaction request information to find a server with relatively idle resources to handle the transaction request.
[0167] In some exemplary embodiments of the present invention, the broadcast information may include: the server IP address of the first server 103, the server UDP port, and the characteristic value of the transaction request object. For example, the characteristic value of the transaction request object may be a 16-bit random code.
[0168] In this embodiment, the broadcast information only includes the server IP address, server UDP port, and characteristic values of the transaction request object, and does not include the transaction request itself. The transaction request itself contains a large amount of data, and broadcasting it directly would consume a lot of network bandwidth. The server IP address, server UDP port, and characteristic values of the transaction request object contain relatively small amounts of data, and broadcasting them as broadcast information in this embodiment helps to save network resources.
[0169] In operation S304, in response to listening to broadcast information from the first server 103, the second server 104 obtains the broadcast information, wherein the second server 104 is one of the plurality of other servers.
[0170] For example, the second server 104 can start UDP listening according to the configured UDP port for external services. When it hears broadcast information from the first server 103, the second server 104 obtains the broadcast information.
[0171] Specifically, in the server cluster, each of the other servers starts UDP listening on its configured external service UDP port. When a broadcast message from the first server 103 is detected, all servers, including the second server 104, acquire the broadcast message. In this case, the first server 103 can select the server that responds first and then forward the transaction request to that server. For example, the second server 104 is the first server to respond.
[0172] In operation S305, in response to the broadcast information, the second server 104 assesses the current utilization rate of the thread pool corresponding to the second server 104.
[0173] In operation S306, in response to the fact that the current utilization rate of the thread pool corresponding to the second server 104 does not exceed the utilization rate threshold of the thread pool corresponding to the second server, the second server 104 sends a response message to the first server 103.
[0174] In an embodiment of the present invention, after the second server 104 receives the broadcast information, it evaluates the current utilization rate of the corresponding thread pool. The second server 104 only sends a response message to the first server 103 if the current utilization rate of the thread pool corresponding to the second server 104 does not exceed the utilization rate threshold. If the current utilization rate of the thread pool corresponding to the second server 104 exceeds the utilization rate threshold, the second server 104 does not send a response message to the first server 103; that is, the second server 104 does not respond to the broadcast information sent by the first server 103.
[0175] For example, the utilization threshold of the thread pool corresponding to the second server 104 can be set according to the specific application scenario of the server. For example, the utilization threshold of the thread pool corresponding to the second server 104 can be set to 60%, 70%, 75%, 80%, 90%, or 95%, etc.
[0176] In some exemplary embodiments, the second server 104 sends a response message to the first server 103 only when the current utilization rate of the thread pool corresponding to the second server 104 is less than a preset threshold value for the utilization rate of the thread pool corresponding to the second server 104. For example, the preset value can be 10%, 20%, 30%, 40%, etc. That is, the current utilization rate of the thread pool corresponding to the second server 104 is not only less than the utilization rate threshold value for the thread pool corresponding to the second server 104, but also significantly lower than the utilization rate threshold value for the thread pool corresponding to the second server 104, i.e., the thread pool corresponding to the second server 104 has sufficient idle resources. Only then does the second server 104 send a response message to the first server 103.
[0177] In this embodiment, by evaluating the idle resources of the second server, it can be ensured that the server providing the response information has sufficient idle resources to process the transaction request, thereby avoiding the phenomenon of the transaction request being forwarded multiple times or repeatedly between servers. In this way, the processing efficiency of transaction requests can be improved.
[0178] As described above, the broadcast information may include: the server IP address of the first server 103, the server UDP port, and the characteristic value of the transaction request object. When the current utilization rate of the thread pool corresponding to the second server 104 is less than a preset threshold value for the utilization rate of the thread pool corresponding to the second server 104, the second server 104 may generate a response information based on the broadcast information, and then send the response information to the first server 103 based on the server IP address and server UDP port of the first server 103 in the broadcast information.
[0179] In operation S307, the first server 103 obtains the response information of the second server 104 to the broadcast information.
[0180] For example, the response information may include the server IP address of the second server 104, the server UDP port, and the characteristic value of the transaction request object. Specifically, the second server 104 can generate a response information based on the broadcast information, whereby the broadcast information includes the characteristic value of the transaction request object. When generating the response information, the characteristic value of the transaction request object can be added to the response information. In this way, through the medium of the characteristic value of the transaction request object, the first server 103 can determine the specific transaction request targeted by the response information returned by the second server 104.
[0181] In operation S308, based on the response information, the first server 103 forwards the transaction request to the second server 104.
[0182] In an embodiment of the present invention, the response information may include the server IP address and server UDP port of the second server 104. When the first server 103 receives the response information from the second server 104, it indicates that the thread pool corresponding to the second server 104 has idle resources and can process the transaction request. In this case, the first server 103 forwards the transaction request to the second server 104 according to the server IP address and server UDP port of the second server 104 included in the received response information, so that the second server 104 can process the transaction request.
[0183] In an embodiment of the present invention, when the thread pool corresponding to the first server 103 does not have sufficient resources to process transaction requests from clients, firstly, the characteristic information of the transaction request is broadcast in a one-to-many manner through a broadcast mechanism. For example, the "characteristic information of the transaction request" here may include the characteristic values of the transaction request object. Then, after receiving a response from a server with idle resources, the transaction request is transmitted one-to-one through a forwarding mechanism so that a server with idle resources can process the transaction request. The data volume of the transaction request is greater than the data volume of the characteristic information of the transaction request. Therefore, in an embodiment of the present invention, in the initial broadcast mechanism, the one-to-many broadcast is of the characteristic information of the transaction request with a smaller data volume; in the later forwarding mechanism, the one-to-one transmission is of the transaction request with a larger data volume. By adopting a broadcast + forwarding mechanism, it is beneficial to reduce the network bandwidth consumption, thereby saving network resources and improving overall processing efficiency.
[0184] In operation S309, the second server 104 receives a transaction request forwarded by the first server 103.
[0185] In operation S310, the second server 104 processes the transaction request and sends the processing result to the first server 103.
[0186] In operation S311, the first server 103 obtains the processing result of the second server 104 on the transaction request and feeds back the processing result to the client 101.
[0187] In this embodiment of the invention, since it has been determined during the previous broadcast phase that the second server 104 has sufficient idle resources to process transaction requests, and since the second server 104 and the first server 103 are of the same type, the second server 104 can directly process the transaction request after receiving it forwarded by the first server 103, and then directly send the processing result back to the first server 103. This mechanism design allows the second server 104 to process the transaction request immediately upon receipt, which improves response speed. In other words, the time the first server 103 spends waiting for the second server 104 to return the processing result is shorter, thus improving the overall processing efficiency of the entire server cluster.
[0188] In embodiments of the present invention, when the thread pool utilization of a certain server is high, transaction requests can be dynamically distributed to servers with less resource usage through a broadcast mechanism, achieving the goal of dynamically adjusting the load. Particularly advantageously, in cases of a sudden surge in transaction requests or server expansion, this helps the business system quickly achieve balanced resource utilization through load redistribution. In embodiments of the present invention, the limitations of single-server resources are overcome, maximizing the utilization of the load capacity of all servers, ensuring the continuity of business processing even when individual servers are under resource constraints, and effectively improving the success rate of request processing for the entire business system.
[0189] Figure 5 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown, the information processing method being applied to a first server.
[0190] like Figure 5 As shown, the information processing method 500 according to this embodiment may include operations S501 to S506. The information processing method 500 can be applied to... Figure 1 and Figure 2A The first server shown, that is, the information processing method 500 can be applied to the server that sends broadcast information.
[0191] In operation S501, a transaction request is received from client 101.
[0192] It should be noted that "transaction request" here refers to any request sent by the client to the server for processing, such as a payment transaction request, a data processing request, or an information provision request.
[0193] Specifically, the load unit 230 of the first server 103 can intercept transaction requests received by the event selector. For example, the event selector can be an NIO Selector.
[0194] In operation S502, the current utilization rate of the thread pool corresponding to the first server 103 is obtained, and the current utilization rate of the thread pool corresponding to the first server 103 is compared with the utilization rate threshold of the thread pool corresponding to the first server 103.
[0195] In operation S503, in response to the current utilization rate of the thread pool corresponding to the first server 103 exceeding the utilization rate threshold of the thread pool corresponding to the first server 103, a broadcast message is generated according to the transaction request, and the broadcast message is broadcast to a plurality of other servers different from the first server, wherein the plurality of other servers are servers that are in the same server cluster as the first server 103 and are of the same type as the first server 103.
[0196] In some exemplary embodiments of the present invention, the broadcast information may include: the server IP address of the first server 103, the server UDP port, and the characteristic value of the transaction request object. For example, the characteristic value of the transaction request object may be a 16-bit random code.
[0197] In some exemplary embodiments of the present invention, in operation S503, generating broadcast information according to the transaction request includes: generating a broadcast object according to the transaction request, wherein the broadcast object includes a transaction request object, a feature value of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object.
[0198] In this paper, the term "object" can be understood as a representation of objects in the real world. Specifically, an object is a unified entity composed of data describing its attributes and a set of operations applied to that data. For example, a transaction request object can be understood as a unified entity composed of data describing the attributes of a transaction request and a set of operations applied to that data; a broadcast object can be understood as a unified entity composed of data describing the attributes of a broadcast message and a set of operations applied to that data; a response object can be understood as a unified entity composed of data describing the attributes of a response server and a set of operations applied to that data; and a lock object of a broadcast object can be understood as a unified entity composed of data describing the attributes of the lock of the broadcast object and a set of operations applied to that data.
[0199] In this embodiment, encapsulating broadcast-related information through objects facilitates the management and updating of broadcast-related information, thereby improving the implementation of the broadcast mechanism.
[0200] In this embodiment, the broadcast information only includes the server IP address, server UDP port, and characteristic values of the transaction request object, and does not include the transaction request itself. The transaction request itself contains a large amount of data, and broadcasting it directly would consume a lot of network bandwidth. The server IP address, server UDP port, and characteristic values of the transaction request object contain relatively small amounts of data, and broadcasting them as broadcast information in this embodiment helps to save network resources.
[0201] In operation S504, the response information of the second server 104 to the broadcast information is obtained, wherein the second server 104 is one of the plurality of other servers.
[0202] In some exemplary embodiments of the present invention, the response information may include the server IP address of the second server 104, the server UDP port, and the characteristic value of the transaction request object. Specifically, the second server 104 can generate a response information based on the broadcast information, wherein the broadcast information includes the characteristic value of the transaction request object, and the characteristic value of the transaction request object can be added to the response information when generating the response information. In this way, through the medium of the characteristic value of the transaction request object, the first server 103 can determine the specific transaction request targeted by the response information returned by the second server 104.
[0203] In operation S505, based on the response information, the transaction request is forwarded to the second server 104.
[0204] In an embodiment of the present invention, the response information may include the server IP address and server UDP port of the second server 104. When the first server 103 receives the response information from the second server 104, it indicates that the thread pool corresponding to the second server 104 has idle resources and can process the transaction request. In this case, the first server 103 forwards the transaction request to the second server 104 according to the server IP address and server UDP port of the second server 104 included in the received response information, so that the second server 104 can process the transaction request.
[0205] In an embodiment of the present invention, when the thread pool corresponding to the first server 103 does not have sufficient resources to process transaction requests from clients, firstly, the characteristic information of the transaction request is broadcast in a one-to-many manner through a broadcast mechanism. For example, the "characteristic information of the transaction request" here may include the characteristic values of the transaction request object. Then, after receiving a response from a server with idle resources, the transaction request is transmitted one-to-one through a forwarding mechanism so that a server with idle resources can process the transaction request. The data volume of the transaction request is greater than the data volume of the characteristic information of the transaction request. Therefore, in an embodiment of the present invention, in the initial broadcast mechanism, the one-to-many broadcast is of the characteristic information of the transaction request with a smaller data volume; in the later forwarding mechanism, the one-to-one transmission is of the transaction request with a larger data volume. By adopting a broadcast + forwarding mechanism, it is beneficial to reduce the network bandwidth consumption, thereby saving network resources and improving overall processing efficiency.
[0206] In operation S506, the processing result of the transaction request by the second server 104 is obtained, and the processing result is fed back to the client.
[0207] In embodiments of the present invention, when the thread pool utilization of a certain server is high, transaction requests can be dynamically distributed to servers with relatively idle resources for processing, thereby achieving the purpose of dynamic load adjustment. In particular, it is advantageous to help the business system quickly achieve a balance of resource utilization through load redistribution in the event of a sudden increase in transaction requests or server expansion.
[0208] In some exemplary embodiments of the present invention, the first server 103 and the plurality of other servers belong to the same server list. For example, servers 103, 104, and 105 may belong to the same server list.
[0209] In some exemplary embodiments of the present invention, the information processing method 500 may further include: sending registration information of the first server 103, the registration information including server type, server IP address and server UDP port; and obtaining a server list, the server list including server type, server IP address and server UDP port of multiple servers, wherein the multiple servers in the server list have the same server type.
[0210] Servers in the same server list are of the same type. In subsequent broadcast mechanisms, this server list can be used to broadcast to each server in the same list. Specifically, the server list also stores the server IP addresses and UDP ports of each server of the same type. In subsequent broadcast mechanisms, broadcasts can be conveniently performed to servers of the same type based on their server IP addresses and UDP ports.
[0211] In other words, in an embodiment of the present invention, during operation S503, broadcasting the broadcast information to a plurality of other servers different from the first server may include: broadcasting the broadcast information according to the server IP address and server UDP port of the plurality of other servers in the server list.
[0212] In embodiments of the present invention, a server list can be maintained through the registration process between the registration center and the registration units of each server. Furthermore, the registration information of each server in the server list can be updated periodically through a timed update mechanism. Particularly advantageously, this timed updated server list allows for convenient broadcasting to servers of the same type, ensuring the smooth implementation of the broadcast mechanism.
[0213] In some exemplary embodiments of the present invention, after broadcasting the broadcast information to a plurality of other servers different from the first server, for example, after operation S503 and before operation S504, the information processing method 500 may further include a wait-to-wake-up process.
[0214] Figure 6 A flowchart illustrating a wait-to-wake-up process in an information processing method according to some exemplary embodiments of the present invention is shown schematically. For example... Figure 6 As shown, the wake-up waiting process may include operations S601 to S602.
[0215] In operation S601, the lock object of the broadcast object is controlled to enter a waiting state. That is, after the first server 103 broadcasts the broadcast information to multiple other servers different from the first server 103, the lock object of the broadcast object is controlled to enter a waiting state.
[0216] In operation S602, in response to the activation signal, the lock object of the broadcast object is woken up.
[0217] In this embodiment, after the broadcast, the server's lock object enters a waiting state and is awakened by an activation signal. This facilitates asynchronous processing between the server that broadcasts and other servers, thereby saving server processing resources.
[0218] In an exemplary embodiment of the present invention, the activation signal can be generated in at least two cases. In a first case, the first server 103 receives a response message to the broadcast information and generates a first activation signal to wake up the lock object of the broadcast object. In a second case, if the broadcast times out, a second activation signal is generated to wake up the lock object of the broadcast object.
[0219] The flow of the information processing method in these two cases will be described in detail below with reference to the accompanying drawings.
[0220] Figure 7 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown in a first wake-up scenario. For example... Figure 7 As shown, in the first wake-up scenario, the information processing method may include operations S701 to S704.
[0221] In operation S701, while the lock object of the broadcast object is in a waiting state, request information from the plurality of other servers is listened for.
[0222] Specifically, taking the first server 103 as an example, when the lock object of the broadcast object of the first server 103 is in a waiting state, the first server 103 can continuously listen for request information from multiple other servers through its listening port. For example, other servers such as servers 104 and 105 may send request information to the first server 103, and their request information can be heard by the listening port of the first server 103.
[0223] In operation S702, in response to the detection of request information from the plurality of other servers, the request information is obtained.
[0224] In this operation, when the listening port of the first server 103 detects request information from multiple other servers 104 and 105, the first server 103 will acquire that request information. For example, when the listening port of the first server 103 detects request information from one server 104, the first server 103 will acquire that request information; when the listening port of the first server 103 detects request information from two servers 104 and 105, the first server 103 will acquire the request information from each of the two servers 104 and 105 respectively; when the listening port of the first server 103 detects request information from even more other servers, the first server 103 will acquire the request information from each of the more than one other server.
[0225] In operation S703, it is determined whether the request information is a response information.
[0226] In this operation, after receiving the request information, the first server 103 will determine whether the received request information is a response information according to the format of the response information.
[0227] In operation S704, in response to the request information being a response information, the response information of the second server to the broadcast information is obtained, wherein the response information includes the server IP address of the second server, the server UDP port, and the characteristic value of the transaction request object.
[0228] In some exemplary embodiments, in operation S704, obtaining the response information of the second server in response to the broadcast information may include: determining the broadcast object corresponding to the feature value of the transaction request object in the response information; and assigning values to the IP address and port of the response object in the broadcast object according to the response information.
[0229] In other words, the broadcast information, the broadcast object, and the response information all include the feature value of the transaction request object. In the embodiments of the present invention, the feature value of the transaction request object is used as a medium to realize the correspondence between the three. After obtaining the response information from the second server 104, the first server 103 uses the feature value of the transaction request object as a medium to determine the broadcast object corresponding to the response information, and then assigns the server IP address and server UDP port of the second server 104 in the response information to the IP address and response port of the response object in the broadcast object, respectively. In this way, the response information can be "obtained" and the key information in the response information (i.e., the server IP address and server UDP port of the second server 104) can be stored in the broadcast object, which helps to facilitate the subsequent forwarding of the transaction request.
[0230] In this embodiment, when the first server 103 receives a response message for the broadcast information, it generates a first activation signal to wake up the lock object of the broadcast object. Specifically, operation S602 may include: in response to assigning values to the IP address and port of the response object in the broadcast object, sending a first activation signal to the lock object of the broadcast object to wake up the lock object of the broadcast object.
[0231] In this embodiment, after the broadcast, the server's lock object enters a waiting state. After receiving a response, it is awakened by an activation signal. This facilitates asynchronous processing between the server that broadcasts and other servers, thereby saving server processing resources.
[0232] Figure 8A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown in a second wake-up scenario. For example... Figure 8 As shown, in the first wake-up scenario, the information processing method may include operations S801 to S802.
[0233] In operation S801, it is determined whether the current broadcast is a timeout broadcast based on the broadcast time in the broadcast object.
[0234] Specifically, the broadcast object includes the broadcast time, that is, the time when the first server 103 sends the broadcast, and the configuration file of the registration unit 220 of the first server 103 is configured with a broadcast timeout. The first server 103 will periodically judge each broadcast object in the broadcast list. If the time interval between the broadcast time of the broadcast object and the current time exceeds the configured broadcast timeout, the broadcast object is judged to be a timeout broadcast.
[0235] In operation S802, in response to the fact that this broadcast is a timeout broadcast, the broadcast status in the broadcast object is set to the timeout state.
[0236] In this embodiment, when the broadcast state in the broadcast object is set to a timeout state, a second activation signal is generated to wake up the lock object of the broadcast object. Specifically, operation S602 may include: in response to setting the broadcast state in the broadcast object to a timeout state, sending a second activation signal to the lock object of the broadcast object to wake up the lock object of the broadcast object.
[0237] In the subsequent execution process, the first server 103 will determine the broadcast status in the broadcast object. If the broadcast status is a timeout status, it will return a rejection message, that is, no other server can process the transaction request corresponding to this broadcast. At this time, you can wait for the first server 103 to continue processing, or you can return a processing failure message to the client.
[0238] In this embodiment, the server periodically checks each broadcast object in the broadcast list. If the time interval between the broadcast time of a broadcast object and the current time exceeds the configured broadcast timeout, the broadcast object is determined to be a timed-out broadcast. In other words, the server can periodically monitor broadcast timeouts and remove timed-out broadcasts from the broadcast list, thus ensuring that genuinely needed transaction requests are broadcast.
[0239] Return to reference Figure 7 The information processing method may further include operations S705 to S708.
[0240] In operation S705, in response to the fact that the request information is not a response information, it is determined whether the request information is a broadcast information.
[0241] In other words, in this embodiment of the invention, when the lock object of the broadcast object is in a waiting state, the first server 103 listens for request information from the plurality of other servers. This request information may be a response from another server to a broadcast message sent by the first server 103, a broadcast message from another server requesting transaction processing, or other types of information. In this embodiment, if the request information listened to by the first server 103 is not a response from another server to a broadcast message sent by the first server 103, it will further determine whether the information is a broadcast message sent by another server.
[0242] In operation S706, in response to the request information being broadcast, the current utilization rate of the thread pool corresponding to the first server is evaluated.
[0243] In operation S707, in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, the request information is not responded to.
[0244] In this embodiment, if the request information received by the first server 103 is a broadcast message from another server, the first server 103 will assess the current utilization rate of its thread pool. In this case, if the current utilization rate of the thread pool corresponding to the first server 103 exceeds the utilization rate threshold of the thread pool corresponding to the first server 103, the request information will not be responded to.
[0245] Optionally, in operation S708, in response to the fact that the current utilization rate of the thread pool corresponding to the first server does not exceed the utilization rate threshold of the thread pool corresponding to the first server, the server responds to the request information and sends a response information to the server that broadcast the request information.
[0246] In this embodiment, within the server cluster, each server's UDP listening port listens for various types of information, such as both response and broadcast messages. This allows a server's thread pool to provide feedback when it has available resources, helping resource-constrained servers process transaction requests. This design improves the utilization of the entire server cluster's computing resources, thereby enhancing its overall information processing capabilities.
[0247] In some exemplary embodiments of the present invention, before generating broadcast information for broadcasting, the information processing method may further include operations such as determining whether the transaction request to be broadcast has been broadcast before and determining whether the number of times the transaction request to be broadcast has been broadcast before exceeds a broadcast count threshold.
[0248] Figure 9A flowchart illustrating an information processing method according to some other exemplary embodiments of the present invention is shown schematically. For example... Figure 9 As shown, the information processing method may include operations S901 to S904. Specifically, the above-mentioned operation S503 may further include operations S901 to S904.
[0249] In operation S901, in response to the current utilization rate of the thread pool corresponding to the first server 103 exceeding the utilization rate threshold of the thread pool corresponding to the first server 103, the request header of the transaction request is obtained.
[0250] In operation S902, the request header of the transaction request includes a broadcast count field, and the value of the broadcast count field in the transaction request is compared with the broadcast count threshold.
[0251] In operation S903, in response to the fact that the value of the broadcast count field in the transaction request does not exceed the broadcast count threshold, broadcast information is generated according to the transaction request and broadcast to multiple other servers different from the first server.
[0252] In operation S904, in response to the transaction request, the request header does not include a broadcast count field. Based on the transaction request, broadcast information is generated and broadcast to multiple other servers different from the first server.
[0253] In this embodiment, before generating and broadcasting the broadcast information, the transaction request is evaluated. If the transaction request has already been broadcast multiple times (e.g., exceeding the broadcast count threshold), then the transaction request is not broadcast again. If the transaction request has not been broadcast before (e.g., its request header does not contain a broadcast count field) or has not been broadcast multiple times (e.g., not exceeding the broadcast count threshold), then the broadcast information is generated and broadcast. The inventors have discovered that some clients repeatedly submit transaction requests. By setting a broadcast count threshold, repeatedly submitted transaction requests can be prevented from repeatedly consuming network bandwidth resources, thus ensuring the rational utilization of network and server resources.
[0254] In some exemplary embodiments of the present invention, the information processing method may set the broadcast count field.
[0255] Figure 10 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown schematically. For example... Figure 10 As shown, the information processing method may include operations S1001 to S1005. Operations S1001 to S1005 may be executed after the lock object of the broadcast object is woken up in response to an activation signal.
[0256] In operation S1 001, check the broadcast status in the broadcast object.
[0257] In operation S1002, in response to the broadcast status in the broadcast object not being a timeout state, the request header of the transaction request is obtained, wherein the request header includes a broadcast count field.
[0258] In operation S1003, check whether the request header of the transaction request includes a broadcast count field.
[0259] In operation S1004, in response to the fact that the request header of the transaction request does not include a broadcast count field, a broadcast count field is added to the request header of the transaction request, and the value of the broadcast count field is set to 1.
[0260] In operation S1005, in response to the request header of the transaction request including a broadcast count field, the value of the broadcast count field in the transaction request is incremented by one.
[0261] By executing operations S1001 to S1005, the broadcast count field in the request header of the transaction request can be set. Specifically, after the first server 103 successfully broadcasts the transaction request, if the transaction request has not been broadcast before, a broadcast count field can be added to the request header of the transaction request, and the value of the broadcast count field can be set to 1; if the transaction request has been broadcast before, the value of the broadcast count field in the transaction request can be incremented by one. In this way, the value of the broadcast count field will be updated in real time after each successful broadcast of the transaction request. In conjunction with the aforementioned broadcast count threshold judgment, this can prevent repeatedly submitted transaction requests from repeatedly occupying network bandwidth resources, which is conducive to ensuring the rational utilization of network resources and server resources.
[0262] Figure 11 A flowchart illustrating an information processing method according to some exemplary embodiments of the present invention is shown, the information processing method being applied to a second server.
[0263] like Figure 11 As shown, the information processing method 1100 according to this embodiment may include operations S1101 to S1107. The information processing method 1100 can be applied to... Figure 1 and Figure 2A The second server shown means that the information processing method 1100 can be applied to a server that receives broadcast information.
[0264] In operation S1101, request information from multiple other servers is listened for, wherein the multiple other servers are servers that are in the same server cluster as the second server and are of the same type as the second server.
[0265] In operation S1102, in response to receiving a request from a first server among the plurality of other servers, the request information is obtained, wherein the first server is one of the plurality of other servers.
[0266] In operation S1103, it is determined whether the request information is broadcast information.
[0267] In operation S1104, in response to the request information being broadcast information, the current utilization rate of the thread pool corresponding to the second server is evaluated.
[0268] In operation S1105, in response to the fact that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server, a response message is sent to the first server.
[0269] In operation S1106, a transaction request forwarded by the first server is received.
[0270] In operation S1107, the transaction request is processed, and the processing result is sent to the first server.
[0271] In embodiments of the present invention, when the thread pool utilization of a certain server is high, transaction requests can be dynamically distributed to servers with relatively idle resources for processing, thereby achieving the purpose of dynamic load adjustment. In particular, it is advantageous to help the business system quickly achieve a balance of resource utilization through load redistribution in the event of a sudden increase in transaction requests or server expansion.
[0272] Below, in conjunction with Figure 2A The system architecture shown exemplifies the operation of the information processing method according to embodiments of the present invention in various units of the server. It should be noted that the following description is only for illustrative purposes. Figure 2A The system architecture shown is an exemplary description and is not intended to limit the embodiments of the present invention. It should be understood that when the system architecture changes, the operation of the information processing method according to the embodiments of the present invention in the various units of the server may also change accordingly.
[0273] Figure 12 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the registration unit in the system architecture. Figure 13 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the load unit in the system architecture. Figure 14 Schematic illustration Figure 2A A schematic flowchart illustrating the operation of the broadcast unit in the system architecture. Figure 15 A swimlane diagram illustrating the execution of the information processing method according to an embodiment of the present invention on various units is shown schematically.
[0274] Combined with reference Figures 12 to 15 The registration unit 220 may include operations S1201 to S1210.
[0275] In operation S1201, the registration unit 220 is started.
[0276] In operation S1202, the configuration file of the server (which can be any one of servers 103, 104, and 105, for example, the first server 103) is read. For example, the configuration file may include information such as server type, external service HTTP port, external service UDP port, registration center address, broadcast count threshold, broadcast timeout, thread pool utilization threshold, and time interval for updating registration information.
[0277] In operation S1203, load unit 230 is started to intercept the NIO Selector method.
[0278] In operation S1204, the broadcast unit 240 is started to start UDP listening according to the configured external server UDP port.
[0279] In operation S1205, obtain the HTTP port for the server's external services.
[0280] In operation S1206, an asynchronous registration thread is started to send and receive registration information.
[0281] Operation S1207 has finished booting.
[0282] In operation S1208, the asynchronous registration thread submits registration information to the registration center 210 based on the read registration center address.
[0283] In operation S1209, the registration server list received from the registration center 210 is saved.
[0284] When operating S1210, it goes into hibernation according to the configured time interval for updating registration information, and after hibernation ends, it starts the next registration information upload.
[0285] Combined with reference Figures 12 to 15 The load unit 230 may include operations S1301 to S1307.
[0286] During operation S1301, load unit 230 intercepts the transaction request received by NIO Selector.
[0287] In operation S1302, the current utilization rate of the server's thread pool is obtained, and it is determined whether the current utilization rate is greater than the configured thread pool utilization rate threshold.
[0288] In operation S1303, if the current utilization rate is greater than the configured thread pool utilization rate threshold, the HTTP request header of the transaction request is retrieved.
[0289] In operation S1304, the request is directly assigned to the broadcast unit for processing in the following two cases: the first case is that the request header does not contain a broadcast count field, and the second case is that the request header contains a broadcast count field but does not exceed the configured broadcast count threshold.
[0290] In operation S1305, wait for and obtain the processing result of broadcast unit 240 and return it to the client.
[0291] In operation S1306, if the request header contains a broadcast count field and the value of the broadcast count field exceeds the configured broadcast count threshold, the request will be rejected.
[0292] In operation S1307, if the current utilization rate is less than the configured thread pool utilization rate threshold, the transaction request is directly assigned to the server for processing without being broadcast.
[0293] Combined with reference Figures 12 to 15 The broadcast unit 240 may include operations S1401 to S1423. In this embodiment, the broadcast unit 240 may include a request processing module 2410, a broadcast object monitoring module 2420, and a listening request processing module 2430.
[0294] During operation S1401, broadcast unit 240 receives a request from load unit 230 for allocation.
[0295] In operation S1402, a broadcast object is generated based on the request information and added to the broadcast list. The broadcast object includes the transaction request object, the characteristic value of the transaction request object (e.g., a 16-bit random code), the lock object of the broadcast object, the broadcast time, the broadcast status, the IP address of the broadcast response object, and the port of the broadcast response object.
[0296] In operation S1403, the server list of registration unit 220 is obtained, and broadcasts are made according to the server IP address and UDP port in the server list. The broadcast information includes the server IP address, UDP port and characteristic value of the transaction request object.
[0297] In operation S1404, after the broadcast ends, the system enters a waiting state where the broadcast object holds the lock, waiting for the lock object's wake-up signal.
[0298] After being awakened by the lock wake-up signal in operation S1405, the broadcast status of the current broadcast object is determined.
[0299] In operation S1406, if the broadcast status is timeout, a rejection message is returned.
[0300] In operation S1407, if the broadcast status is normal, the HTTP request headers in the current request are retrieved.
[0301] In operation S1408, if the HTTP request header contains a broadcast count field, then increment the value of the broadcast count field by 1.
[0302] In operation S1409, if the HTTP header does not contain a broadcast count field, then add a broadcast count field and assign it a value of 1.
[0303] In operation S1410, the IP address and port of the broadcast response object in the current broadcast object are obtained, and the transaction request is forwarded to the server that sent the response information.
[0304] In operation S1411, wait for and obtain the processing result returned by the broadcast response server.
[0305] In operation S1412, the processing result is returned to the load unit 230.
[0306] In operation S1413, the broadcast monitoring module checks each broadcast object in the broadcast list one by one.
[0307] In operation S1414, if the time interval between the current time and the broadcast object exceeds the configured broadcast timeout, it is considered a timed-out broadcast, and the broadcast status field of this broadcast object is set to timeout.
[0308] In operation S1415, the lock object of the broadcast object is acquired and an activation signal is sent.
[0309] During operation S1416, the UDP listening port of broadcast unit 240 receives the request information and determines whether the type of the request information is a response request.
[0310] In operation S1417, if the request information is a response information, then the response information is obtained. The response information contains information such as the characteristic value of the broadcast object, the IP address of the response server, and the UDP port of the response server.
[0311] In operation S1418, based on the characteristic value of the broadcast object in the response information, the corresponding broadcast object is searched in the broadcast list, and the response server IP address and response server UDP port are assigned to the broadcast object.
[0312] In operation S1419, an activation signal is sent to the lock object in the broadcast object.
[0313] In operation S1420, if the type of the received request information is determined to be broadcast information, the current thread pool utilization rate is evaluated.
[0314] In operation S1421, if the current thread pool utilization rate is less than the thread pool utilization rate threshold, a response message is sent to the broadcast server. The response message contains information such as the characteristic value of the broadcast object, the IP address of the response server, and the UDP port of the response server.
[0315] In operation S1422, if the current thread pool utilization rate is greater than the threshold, the request information will not be responded to.
[0316] In operation S1423, if the type of the received request message is determined to be neither broadcast nor response information, the message is discarded.
[0317] Figure 16 A schematic block diagram of an information processing apparatus according to an embodiment of the present invention is shown.
[0318] like Figure 16 As shown, the information processing device 1600 according to this embodiment can be applied to the first server 103. The information processing device 1600 may include a transaction request acquisition module 1601, a comparison module 1602, a broadcast module 1603, a response information acquisition module 1604, a forwarding module 1605, and a result acquisition module 1606.
[0319] The transaction request acquisition module 1601 is used to acquire transaction requests from clients. In some embodiments, the transaction request acquisition module 1601 can be used to perform the operation S501 described above, which will not be repeated here.
[0320] The comparison module 1602 is used to obtain the current utilization rate of the thread pool corresponding to the first server, and compare the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server. In some embodiments, the comparison module 1602 can be used to perform the operation S502 described above, which will not be repeated here.
[0321] The broadcast module 1603 is configured to: in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, generate broadcast information according to the transaction request, and broadcast the broadcast information to a plurality of other servers different from the first server, wherein the plurality of other servers are servers in the same server cluster as the first server and of the same type as the first server. In some embodiments, the broadcast module 1603 may be used to perform the operation S503 described above, which will not be repeated here.
[0322] The response information acquisition module 1604 is used to acquire the response information of the second server in response to the broadcast information, wherein the second server is one of the plurality of other servers. In some embodiments, the response information acquisition module 1604 may be used to perform the operation S504 described above, which will not be repeated here.
[0323] The forwarding module 1605 is used to forward the transaction request to the second server according to the response information. In some embodiments, the forwarding module 1605 may be used to perform the operation S505 described above, which will not be repeated here.
[0324] The result acquisition module 1606 is used to acquire the processing result of the second server on the transaction request and to feed back the processing result to the client. In some embodiments, the result acquisition module 1606 may be used to perform the operation S506 described above, which will not be repeated here.
[0325] In some exemplary embodiments, the first server 103 and the plurality of other servers (e.g., servers 104, 105) may belong to the same server list.
[0326] Figure 17 The schematic diagram illustrates a structural block diagram of an information processing apparatus according to some other exemplary embodiments of the present invention.
[0327] like Figure 17 As shown, the information processing device 1600 according to this embodiment can be applied to the first server 103. The information processing device 1600 may include a transaction request acquisition module 1601, a comparison module 1602, a broadcast module 1603, a response information acquisition module 1604, a forwarding module 1605, a result acquisition module 1606, a registration information sending module 1607, and a server list acquisition module 1608.
[0328] It should be noted that the transaction request acquisition module 1601, comparison module 1602, broadcast module 1603, response information acquisition module 1604, forwarding module 1605, and result acquisition module 1606 can be referred to in conjunction with the above. Figure 16 The description will not be repeated here.
[0329] The registration information sending module 1607 is used to send the registration information of the first server, which includes the server type, server IP address and server UDP port.
[0330] The server list acquisition module 1608 is used to acquire a server list, which includes the server type, server IP address and server UDP port of multiple servers. In the server list, the multiple servers have the same server type.
[0331] In some exemplary embodiments, the broadcast module 1603 may also broadcast the broadcast information based on the server IP address and server UDP port of multiple other servers in the server list.
[0332] In some exemplary embodiments, the broadcast module 1603 can also be used to: generate a broadcast object according to the transaction request, wherein the broadcast object includes a transaction request object, a feature value of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object.
[0333] In some exemplary embodiments, the information processing device 1600 may further include a lock control module 1609. The lock control module 1609 is configured to: control the lock object of the broadcast object to enter a waiting state; and wake up the lock object of the broadcast object in response to an activation signal.
[0334] In some exemplary embodiments, the broadcast information includes: the server IP address of the first server, the server UDP port, and the characteristic value of the transaction request object.
[0335] In some exemplary embodiments, the response information acquisition module 1604 is further configured to: listen for request information from the plurality of other servers when the lock object of the broadcast object is in a waiting state; acquire the request information in response to the acquisition of the request information from the plurality of other servers; determine whether the request information is response information; and acquire the response information of the second server to the broadcast information in response to the request information being response information, wherein the response information includes the server IP address, server UDP port, and feature value of the transaction request object of the second server.
[0336] In some exemplary embodiments, the response information acquisition module 1604 is further configured to: determine the broadcast object corresponding to the feature value of the transaction request object in the response information; and assign values to the IP address and port of the response object in the broadcast object according to the response information.
[0337] In this embodiment, the lock control module 1609 is configured to: in response to assigning values to the IP address and port of the response object in the broadcast object, send a first activation signal to the lock object of the broadcast object to wake up the lock object of the broadcast object.
[0338] In some exemplary embodiments, the information processing device 1600 may further include a timeout control module 1610. The timeout control module 1610 may be used to: determine whether the current broadcast is a timeout broadcast based on the broadcast time in the broadcast object; and in response to the current broadcast being a timeout broadcast, set the broadcast status in the broadcast object to a timeout state.
[0339] In this embodiment, the lock control module 1609 is configured to: in response to setting the broadcast state in the broadcast object to a timeout state, send a second activation signal to the lock object of the broadcast object to wake up the lock object of the broadcast object.
[0340] In some exemplary embodiments, the information processing device 1600 may further include a broadcast information processing module 1611. The broadcast information processing module 1611 is configured to: determine whether the request information is a broadcast information in response to the request information not being a response information; assess the current utilization rate of the thread pool corresponding to the first server in response to the request information being a broadcast information; and not respond to the request information in response to the current utilization rate of the thread pool corresponding to the first server exceeding a utilization rate threshold for the thread pool corresponding to the first server.
[0341] In some exemplary embodiments, the broadcast module 1603 is further configured to: in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, obtain the request header of the transaction request; in response to the request header of the transaction request including a broadcast count field, compare the value of the broadcast count field in the transaction request with the broadcast count threshold; and in response to the value of the broadcast count field in the transaction request not exceeding the broadcast count threshold, generate broadcast information according to the transaction request, and broadcast the broadcast information to a plurality of other servers different from the first server.
[0342] In some exemplary embodiments, the broadcast module 1603 is further configured to: in response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, obtain the request header of the transaction request; and in response to the request header of the transaction request not including a broadcast count field, generate broadcast information according to the transaction request, and broadcast the broadcast information to a plurality of other servers different from the first server.
[0343] In some exemplary embodiments, the information processing device 1600 may further include a broadcast count setting module 1612. The broadcast count setting module 1612 is configured to: check the broadcast status in the broadcast object; in response to the broadcast status in the broadcast object not being a timeout status, obtain the request header of the transaction request, wherein the request header includes a broadcast count field; check whether the request header of the transaction request includes a broadcast count field; in response to the request header of the transaction request not including a broadcast count field, add a broadcast count field to the request header of the transaction request and set the value of the broadcast count field to 1; and in response to the request header of the transaction request including a broadcast count field, increment the value of the broadcast count field in the transaction request by one.
[0344] Figure 18 The schematic diagram illustrates a structural block diagram of an information processing apparatus according to some further exemplary embodiments of the present invention.
[0345] like Figure 18 As shown, the information processing device 1800 according to this embodiment can be applied to the second server 104. The information processing device 1800 may include a listening module 1801, a request information acquisition module 1802, a judgment module 1803, an evaluation module 1804, a response information sending module 1805, a receiving module 1806, and a result feedback module 1807.
[0346] The listening module 1801 is used to listen for request information from multiple other servers, wherein the multiple other servers are servers that are in the same server cluster as the second server and are of the same type as the second server.
[0347] The request information acquisition module 1802 is used to acquire the request information in response to listening to the request information from the first server among the plurality of other servers, wherein the first server is one of the plurality of other servers.
[0348] The judgment module 1803 is used to determine whether the request information is broadcast information.
[0349] The evaluation module 1804 is used to evaluate the current utilization rate of the thread pool corresponding to the second server in response to the request information being broadcast information.
[0350] The response information sending module 1805 is used to send response information to the first server in response to the fact that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server.
[0351] The receiving module 1806 is used to receive transaction requests forwarded by the first server.
[0352] The result feedback module 1807 is used to process the transaction request and send the processing result to the first server.
[0353] Figure 19 A block diagram of an electronic device suitable for implementing an information processing method according to an embodiment of the present invention is shown schematically.
[0354] like Figure 19 As shown, an electronic device 1900 according to an embodiment of the present invention includes a processor 1901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1902 or a program loaded from a storage portion 1908 into a random access memory (RAM) 1903. The processor 1901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)). The processor 1901 may also include onboard memory for caching purposes. The processor 1901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0355] RAM 1903 stores various programs and data required for the operation of electronic device 1900. Processor 1901, ROM 1902, and RAM 1903 are interconnected via bus 1904. Processor 1901 executes various operations of the method flow according to embodiments of the present invention by executing programs in ROM 1902 and / or RAM 1903. It should be noted that the programs may also be stored in one or more memories other than ROM 1902 and RAM 1903. Processor 1901 may also execute various operations of the method flow according to embodiments of the present invention by executing programs stored in said one or more memories.
[0356] According to an embodiment of the present invention, the electronic device 1900 may further include an input / output (I / O) interface 1905, which is also connected to a bus 1904. The electronic device 1900 may also include one or more of the following components connected to the I / O interface 1905: an input section 1906 including a keyboard, mouse, etc.; an output section 1907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1908 including a hard disk, etc.; and a communication section 1909 including a network interface card such as a LAN card, modem, etc. The communication section 1909 performs communication processing via a network such as the Internet. A drive 1910 is also connected to the I / O interface 1905 as needed. A removable medium 1911, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1910 as needed so that computer programs read from it can be installed into the storage section 1908 as needed.
[0357] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.
[0358] According to embodiments of the present invention, a computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of the present invention, a computer-readable storage medium may include one or more memories other than ROM 1902 and / or RAM 1903 described above.
[0359] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of the present invention.
[0360] When the computer program is executed by the processor 1901, it performs the functions defined in the system / apparatus of this invention. According to embodiments of the invention, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0361] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 1909, and / or installed from a removable medium 1911. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0362] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1909, and / or installed from the removable medium 1911. When the computer program is executed by the processor 1901, it performs the functions defined in the system of this embodiment of the invention. According to embodiments of the invention, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0363] According to embodiments of the present invention, program code for executing the computer programs provided in the embodiments of the present invention can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0364] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0365] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.
Claims
1. An information processing method, applied to a first server, characterized in that, The method includes: Get transaction requests from the client; Obtain the current utilization rate of the thread pool corresponding to the first server, and compare the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server. In response to the current utilization rate of the thread pool corresponding to the first server exceeding the utilization rate threshold of the thread pool corresponding to the first server, a broadcast message is generated according to the transaction request, and the broadcast message is broadcast to multiple other servers different from the first server, wherein the multiple other servers are servers in the same server cluster as the first server and of the same type as the first server; Obtain the response information from the second server in response to the broadcast information, wherein the second server is one of the plurality of other servers; Based on the response information, the transaction request is forwarded to the second server; and Obtain the processing result of the second server on the transaction request, and feed the processing result back to the client; The step of generating broadcast information according to the transaction request includes: generating a broadcast object according to the transaction request, wherein the broadcast object includes a transaction request object, a feature value of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object, and the broadcast information includes: the server IP address of the first server, the server UDP port, and the feature value of the transaction request object; After broadcasting the broadcast information to multiple other servers different from the first server, the method further includes: controlling the lock object of the broadcast object to enter a waiting state; and waking up the lock object of the broadcast object in response to an activation signal; The response information includes the server IP address of the second server, the server UDP port, and the characteristic value of the transaction request object; the characteristic value of the transaction request object included in the response information is used to determine the corresponding broadcast object.
2. The method according to claim 1, characterized in that, The first server and the plurality of other servers belong to the same server list; The method further includes: sending registration information of the first server, the registration information including server type, server IP address and server UDP port; and obtaining a server list, the server list including server type, server IP address and server UDP port of multiple servers, wherein the multiple servers in the server list have the same server type, and the multiple servers include the first server and the multiple other servers.
3. The method according to claim 2, characterized in that, The broadcasting of the broadcast information to multiple other servers different from the first server includes: The broadcast information is broadcast based on the server IP addresses and server UDP ports of multiple other servers in the server list.
4. The method according to claim 1, characterized in that, The step of obtaining the response information from the second server in response to the broadcast information also includes: While the lock object of the broadcast object is in a waiting state, listen for request information from the plurality of other servers; In response to receiving a request from one of the other servers, the request information is obtained; Determine whether the request information is a response information; In response to the request information being a response, the response information of the second server to the broadcast information is obtained, wherein the response information includes the server IP address, server UDP port, and characteristic value of the transaction request object of the second server; Based on the characteristic value of the transaction request object in the response information, determine the broadcast object corresponding to that characteristic value; and Based on the response information, assign values to the IP address and port of the response object in the broadcast object.
5. The method according to claim 4, characterized in that, The step of waking up the lock object of the broadcast object in response to the activation signal includes: In response to assigning values to the IP address and port of the response object in the broadcast object, a first activation signal is sent to the lock object of the broadcast object to wake up the lock object of the broadcast object.
6. The method according to claim 1, characterized in that, The method further includes: Based on the broadcast time in the broadcast object, determine whether this broadcast is a timeout broadcast; and In response to the fact that this broadcast is a timeout broadcast, the broadcast status in the broadcast object is set to timeout status; The step of waking up the lock object of the broadcast object in response to the activation signal includes: In response to setting the broadcast state in the broadcast object to a timeout state, a second activation signal is sent to the lock object of the broadcast object to wake up the lock object of the broadcast object.
7. The method according to claim 4, characterized in that, The method further includes: If the request information is not a response information, determine whether the request information is a broadcast information; In response to the request being a broadcast message, assess the current utilization rate of the thread pool corresponding to the first server; and If the current utilization rate of the thread pool corresponding to the first server exceeds the utilization rate threshold of the thread pool corresponding to the first server, the request information will not be responded to.
8. The method according to claim 5, characterized in that, The step of generating broadcast information based on the transaction request and broadcasting the broadcast information to multiple other servers different from the first server specifically includes: Obtain the request header of the transaction request; In response to the request header including a broadcast count field, the value of the broadcast count field is compared with a broadcast count threshold; and In response to the fact that the value of the broadcast count field does not exceed the broadcast count threshold, a broadcast message is generated according to the transaction request and broadcast to multiple other servers different from the first server.
9. The method according to claim 8, characterized in that, The step of generating broadcast information based on the transaction request and broadcasting the broadcast information to multiple other servers different from the first server further includes: Obtain the request header of the transaction request; and In response to the absence of a broadcast count field in the request header, a broadcast message is generated based on the transaction request and broadcast to multiple other servers different from the first server.
10. The method according to claim 5, characterized in that, After waking up the lock object of the broadcast object in response to the activation signal, the method further includes: Check the broadcast status in the broadcast object; In response to the broadcast state in the broadcast object not being a timeout state, obtain the request header of the transaction request; Check if the request header includes a broadcast count field; In response to the absence of a broadcast count field in the request header, a broadcast count field is added to the request header, and the value of the broadcast count field is set to 1; and In response to the request header including a broadcast count field, increment the value of the broadcast count field by one.
11. An information processing method applied to a second server, characterized in that, The method includes: Listen for request information from multiple other servers, wherein the multiple other servers are servers that are in the same server cluster as the second server and are of the same type as the second server; In response to receiving a request from a first server among the plurality of other servers, the request information is obtained, wherein the first server is one of the plurality of other servers; Determine whether the request information is a broadcast message; In response to the request being broadcast, the current utilization rate of the thread pool corresponding to the second server is assessed. In response to the fact that the current utilization rate of the thread pool corresponding to the second server does not exceed the utilization rate threshold of the thread pool corresponding to the second server, a response message is sent to the first server; Receive transaction requests forwarded by the first server; and The transaction request is processed, and the processing result is sent to the first server; The broadcast information is generated by the first server based on the transaction request; the first server is specifically used to generate a broadcast object based on the transaction request. The broadcast object includes a transaction request object, a feature value of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object. The broadcast information includes: the server IP address of the first server, the server UDP port, and the feature value of the transaction request object. The first server is configured to: after broadcasting the broadcast information to a plurality of other servers different from the first server, control the lock object of the broadcast object to enter a waiting state; and wake up the lock object of the broadcast object in response to an activation signal; The response information includes the server IP address of the second server, the server UDP port, and the characteristic value of the transaction request object; The first server is configured to: determine the broadcast object corresponding to the feature value of the transaction request object in the response information.
12. A server cluster, comprising a first server and a second server, characterized in that, The first server is configured to perform the method as described in any one of claims 1-10, and the second server is configured to perform the method as described in claim 11.
13. An information processing apparatus, applied to a first server, characterized in that, The device includes: The transaction request acquisition module is used to acquire transaction requests from clients; The comparison module is used to obtain the current utilization rate of the thread pool corresponding to the first server and compare the current utilization rate of the thread pool corresponding to the first server with the utilization rate threshold of the thread pool corresponding to the first server. The broadcast module is used to respond to the fact that the current utilization rate of the thread pool corresponding to the first server exceeds the utilization rate threshold of the thread pool corresponding to the first server, generate broadcast information according to the transaction request, and broadcast the broadcast information to multiple other servers different from the first server, wherein the multiple other servers are servers that are in the same server cluster as the first server and are of the same type as the first server; The response information acquisition module is used to acquire the response information of the second server in response to the broadcast information, wherein the second server is one of the plurality of other servers; A forwarding module is configured to forward the transaction request to the second server based on the response information; and The result acquisition module is used to acquire the processing result of the second server on the transaction request and to feed the processing result back to the client; The broadcast module is used to generate a broadcast object according to the transaction request. The broadcast object includes a transaction request object, a feature value of the transaction request object, a lock object of the broadcast object, a broadcast time, a broadcast status, an IP address of the response object, and a port of the response object. The broadcast information includes: the server IP address of the first server, the server UDP port, and the feature value of the transaction request object. A lock control module is configured to control the lock object of the broadcasting object to enter a waiting state after broadcasting the broadcast information to multiple other servers different from the first server; and to wake up the lock object of the broadcasting object in response to an activation signal. The response information includes the server IP address of the second server, the server UDP port, and the characteristic value of the transaction request object; the characteristic value of the transaction request object included in the response information is used to determine the corresponding broadcast object.
14. An electronic device comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 11.
15. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 11.
16. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Load monitoring method and device of distributed storage system
CN106469018A
Identity authentication method and device, storage medium and electronic equipment
CN115600177A
Real-time dynamic positioning method and device, vehicle-mounted unit and storage medium
CN116224375A