WO2021258753A1 - Service processing method and apparatus, and electronic device and storage medium - Google Patents

Service processing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2021258753A1
WO2021258753A1 PCT/CN2021/077022 CN2021077022W WO2021258753A1 WO 2021258753 A1 WO2021258753 A1 WO 2021258753A1 CN 2021077022 W CN2021077022 W CN 2021077022W WO 2021258753 A1 WO2021258753 A1 WO 2021258753A1
Authority
WO
WIPO (PCT)
Prior art keywords
connection
long
type
pool
web service
Prior art date
Application number
PCT/CN2021/077022
Other languages
French (fr)
Chinese (zh)
Inventor
朱文龙
Original Assignee
广东浪潮智慧计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广东浪潮智慧计算技术有限公司 filed Critical 广东浪潮智慧计算技术有限公司
Publication of WO2021258753A1 publication Critical patent/WO2021258753A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Definitions

  • This application relates to the field of computer technology, and more specifically, to a business processing method and device, an electronic device, and a computer-readable storage medium.
  • each module of all nodes in the cluster is connected to a single Rabbitmq (Rabbit Message Queue, Rabbit A program-to-program communication method developed by the company)
  • Rabbitmq Revit Message Queue, Rabbit A program-to-program communication method developed by the company
  • a message service of the service node maintains a long connection.
  • other business modules are basically in an inactive state.
  • the module connection is in an empty running state, which wastes connection resources.
  • each module processes the request, they temporarily apply to create a new connection to send the processing result.
  • a new connection is created.
  • the resource overhead is large. When the number of nodes and modules is large, it will cause a single Rabbitmq service node. a lot of pressure.
  • the purpose of this application is to provide a service processing method and device, an electronic device, and a computer-readable storage medium, which reduces the pressure on a single Rabbitmq node, reduces the connection creation time, and improves the message flow speed.
  • this application provides a service processing method, including:
  • the second type of connection pool stores pre-established connections. Long connection for sending.
  • the using the first target persistent connection to send the web service request to a corresponding functional module for processing includes:
  • the web service request is sent to the functional module through the first target persistent connection, so that the functional module can process the web service request.
  • it also includes:
  • the method further includes:
  • it also includes:
  • the adding or releasing a long connection in the connection pool at a preset time node in combination with the time curve includes:
  • the adding or releasing a long connection in the connection pool at a preset time node in combination with the time curve includes:
  • connection pool is added or released at a preset time node in combination with the time curve and the actual pressure data.
  • this application provides a service processing device, including:
  • the request receiving module is used to receive web service requests issued by the client;
  • the first selection module is configured to select a first target persistent connection in an idle state from a first type of connection pool, and the first type of connection pool stores a pre-established persistent connection for receiving;
  • a request sending module configured to use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
  • the second selection module is configured to select a second target persistent connection in an idle state from the second type of connection pool, and return the processing result to the client through the second target persistent connection, the second type of connection Pre-established long connections for sending are stored in the pool.
  • an electronic device including:
  • Memory used to store computer programs
  • the processor is used to implement the steps of any service processing method disclosed above when executing the computer program.
  • this application provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium. step.
  • a service processing method provided by this application includes: receiving a web service request issued by a client; Pre-established persistent connections for receiving are stored in the pool; using the first target persistent connection, the web service request is sent to the corresponding functional module for processing, and the processing result corresponding to the web service request is obtained; Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection.
  • the second type of connection pool stores pre-established connections. Long connection for sending.
  • the first type of connection pool in this application saves pre-established long connections for unified reception of service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the long connection of a single Rabbitmq node. quantity.
  • the results of each module can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.
  • the application also discloses a service processing device, an electronic device, and a computer-readable storage medium, which can also achieve the above technical effects.
  • Figure 1 is a schematic diagram of a message processing flow in related technologies
  • FIG. 3 is a flowchart of a service processing method disclosed in an embodiment of the application.
  • FIG. 4 is a schematic diagram of the architecture of the service processing method disclosed in an embodiment of the application.
  • FIG. 5 is a flowchart of another service processing method disclosed in an embodiment of the application.
  • Fig. 6 is a structural diagram of a service processing device disclosed in an embodiment of the application.
  • FIG. 7 is a structural diagram of an electronic device disclosed in an embodiment of the application.
  • FIG. 8 is a structural diagram of another electronic device disclosed in an embodiment of the application.
  • each module of all nodes in the cluster maintains a long connection with a message service of a single rabbitmq service node, which wastes connection resources.
  • each module creates a new connection every time it receives a processing request, and the resource overhead is large.
  • the number of nodes and modules is large, it will cause a lot of pressure on a single Rabbitmq service node.
  • the embodiment of the present application discloses a service processing method, which reduces the pressure on a single Rabbitmq service node, reduces the connection creation time, and improves the message flow speed.
  • a service processing method disclosed in an embodiment of the present application includes:
  • S101 Receive a web service request issued by a client
  • web service requests may include, but are not limited to, requests such as data query, modification, and deletion.
  • S102 Select a first target persistent connection in an idle state from the first type of connection pool, where a pre-established persistent connection for receiving is stored in the first type of connection pool;
  • the first target persistent connection whose status is idle can be selected from the first type of connection pool, so as to use the persistent connection to send the request to the corresponding functional module.
  • the first type of connection pool is used to maintain consumer long-term connections, which saves pre-established long-term connections for receiving, and is responsible for managing, storing, and releasing long-term connections.
  • a certain number of persistent connections are created in the first type of connection pool. The number of creations can be determined according to the preset minimum number of connections to ensure that there are at least the minimum number of persistent connections in the connection pool.
  • the first target persistent connection selected above can be used to send the web service request to the corresponding functional module for processing. It is understandable that this embodiment can parse the web service request to obtain the request operation code contained therein, and then determine the functional module used to process the web service request according to the current request operation code, and then pass the first target The long connection sends the web service request to the determined functional module so that the functional module can process the current web service request.
  • S104 Select an idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. Established long connection for sending.
  • the idle second target persistent connection can be selected from the second type of connection pool, and the processing result can be sent to the client through the second target persistent connection.
  • the second type of connection pool stores pre-established long connections for sending, and is responsible for managing, storing, and releasing long connections.
  • long connections that are greater than or equal to the minimum number of connections can be created during initialization and stored in the second type of connection pool.
  • the embodiment of the present application can also perform state monitoring on the long connections maintained in the first type connection pool and the second type connection pool at a fixed time or in real time. If any long connection is detected to be disconnected, the disconnected long connection is reconnected.
  • the embodiment of the present application can count the number of disconnections corresponding to the connection for the disconnected long connection. If it is detected that the number of disconnections corresponding to any long connection is greater than the first preset threshold, it indicates that the connection is unstable and the performance is poor. The reconnection operation of the current long connection can be prohibited within the preset time period to avoid poor stability The resource waste caused by repeated reconnections of long connections.
  • a service processing method provided by this application includes: receiving a web service request issued by a client; Pre-established persistent connections for receiving are stored in the pool; using the first target persistent connection, the web service request is sent to the corresponding functional module for processing, and the processing result corresponding to the web service request is obtained; Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection.
  • the second type of connection pool stores pre-established connections. Long connection for sending.
  • the first type of connection pool in this application saves pre-established long connections for unified reception of service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the long connection of a single Rabbitmq node. quantity.
  • the results of each module can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.
  • the embodiment of the present application discloses another service processing method. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. As shown in Figure 5, specific:
  • S201 Receive a web service request issued by a client
  • S202 Select a first target persistent connection in an idle state from the first type of connection pool, where a pre-established persistent connection for receiving is stored in the first type of connection pool;
  • S203 Use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
  • S204 Select an idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. Long connection established for sending;
  • S205 Generate a time curve that characterizes changes in business processing pressure by collecting statistics on historical business processing data
  • the connections in the connection pool can be adaptively adjusted according to actual business processing conditions. For example, the number of long connections can be added when the business processing pressure is high to reduce business Processing response time, reducing the number of long connections when the business processing pressure is small, and reducing resource consumption.
  • the embodiment of the present application can collect historical business processing data, and generate a time curve that characterizes changes in business processing pressure by performing statistics on the historical data.
  • S206 Based on the current number and maximum threshold of persistent connections stored in the first type of connection pool and the second type of connection pool, add or add to the persistent connections in the connection pool at a preset time node in combination with the time curve Release operation.
  • a rough business processing pressure change rule can be learned based on the time curve, and the business processing pressure that may correspond to each time period or time node can be determined. Furthermore, based on the number of connections currently saved in the connection pool and the maximum threshold, the operation of adding or releasing long connections can be performed at a preset time node.
  • the process of adding or releasing the long connections in the connection pool at the preset time node in combination with the time curve may specifically include: if it is determined according to the time curve that the service processing pressure of the preset time node is less than The second preset threshold is used to obtain the number of times of disconnection and the sending success rate corresponding to each long connection in the connection pool. Combining the number of times of disconnection and the transmission success rate of each persistent connection, the third target persistent connection is determined, and the third target persistent connection is released. That is, the embodiment of the present application can determine the time node with less business processing pressure according to the time curve.
  • the time node where the business processing pressure is less than the second preset threshold can be determined as the preset time node, and when the time node is reached Perform the connection release operation.
  • a long connection with a larger number of disconnections and/or a lower transmission success rate can be selected among all the long connections for release.
  • the above-mentioned second preset threshold may be set according to specific conditions in actual implementation, and is not specifically limited here.
  • the embodiment of the present application can also perform real-time monitoring of the number of service requests to be processed to obtain actual pressure data, which can then be combined with the time curve and actual pressure data at a preset time.
  • the node adds or releases the long connection in the connection pool to avoid the adjustment of the long connection according to the original situation when the time curve is only used as the basis for adjustment.
  • the impact of processing or resource overhead ensures the accuracy of long-term connection maintenance.
  • the above-mentioned process of adding or releasing long connections in the connection pool at a preset time node in combination with the time curve and actual pressure data may include: obtaining real-time monitored actual pressure data, and calculating the next time node
  • the difference between the actual pressure data and the corresponding historical pressure data in the time curve is used to determine whether the difference is within the preset variation range. If it is, the actual pressure data is basically in line with the law of the time curve, and the long connection can be adjusted according to the adjustment strategy corresponding to the original time curve without modifying it; if not, the actual pressure data is different from the law of the time curve. Therefore, it is necessary to determine whether the next time node needs to perform the operation of adding a long connection or releasing the operation of the long connection according to the actual pressure data detected in real time.
  • the following describes a service processing device provided by an embodiment of the present application.
  • the service processing device described below and the service processing method described above can be cross-referenced.
  • a service processing apparatus provided by an embodiment of the present application includes:
  • the request receiving module 301 is used to receive web service requests issued by the client;
  • the first selection module 302 is configured to select a first target persistent connection in an idle state from a first type of connection pool, and the first type of connection pool stores a pre-established persistent connection for receiving;
  • the request sending module 303 is configured to use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
  • the second selection module 304 is configured to select a second target persistent connection in an idle state from the second type of connection pool, and return the processing result to the client through the second target persistent connection, the second type Pre-established long connections for sending are stored in the connection pool.
  • an electronic device As shown in FIG. 7, an electronic device provided by an embodiment of the application includes:
  • the memory 100 is used to store computer programs
  • the processor 200 is configured to implement the steps provided in the foregoing embodiments when executing the computer program.
  • the memory 100 includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and computer-readable instructions
  • the internal memory provides an environment for running the operating system and the computer-readable instructions in the non-volatile storage medium.
  • the processor 200 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip, which provides computing and control capabilities for electronic devices, and executes the
  • the computer program stored in the memory 100 can implement the steps of the service processing method disclosed in any of the foregoing embodiments.
  • the electronic device further includes:
  • the input interface 300 is connected to the processor 200 and is used to obtain externally imported computer programs, parameters and instructions, and store them in the memory 100 under the control of the processor 200.
  • the input interface 300 can be connected to an input device to receive parameters or instructions manually input by the user.
  • the input device may be a touch layer covered on the display screen, a button, a trackball, or a touch pad provided on the terminal housing, or a keyboard, a touch pad, or a mouse.
  • the display unit 400 is connected to the processor 200 and is used for displaying data processed by the processor 200 and for displaying a visualized user interface.
  • the display unit 400 may be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the network port 500 is connected to the processor 200 and is used to communicate with external terminal devices.
  • the communication technology used in the communication connection can be wired communication technology or wireless communication technology, such as mobile high-definition link technology (MHL), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.
  • FIG. 8 only shows an electronic device with components 100-500. Those skilled in the art can understand that the structure shown in FIG. 8 does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure. Components, or combinations of certain components, or different component arrangements.
  • This application also provides a computer-readable storage medium, which may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic Various media that can store program codes such as discs or optical discs.
  • a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the service processing method disclosed in any of the foregoing embodiments are implemented.
  • the first type of connection pool in this application saves pre-established long connections for uniformly receiving service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the number of long connections for a single Rabbitmq node.
  • they can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.

Abstract

A service processing method and apparatus, and a device and a medium. The method comprises: receiving a web service request issued by a client; selecting a first target long connection in an idle state from a first-type connection pool that stores pre-established long connections for performing reception; using the first target long connection to send the web service request to a corresponding functional module for processing to obtain a processing result corresponding to the web service request; and selecting a second target long connection in an idle state from a second-type connection pool that stores pre-established long connections for performing sending, and returning the processing result to the client by means of the second target long connection. By means of the present application, there is no need for all modules to maintain a long connection with a node, thereby reducing the number of long connections of the node. After obtaining a processing result of each module, the processing result can be sent by means of a pre-established long connection in a second-type connection pool, thereby avoiding resource overheads required for continuously creating and destroying temporary connections, and reducing the connection creation time.

Description

一种业务处理方法、装置及电子设备和存储介质Business processing method, device, electronic equipment and storage medium
本申请要求于2020年06月24日提交中国专利局、申请号为202010591007.0、发明名称为“一种业务处理方法、装置及电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 202010591007.0, and the invention title is "a business processing method, device, electronic equipment and storage medium" on June 24, 2020. The entire content of the application is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及计算机技术领域,更具体地说,涉及一种业务处理方法、装置及一种电子设备和一种计算机可读存储介质。This application relates to the field of computer technology, and more specifically, to a business processing method and device, an electronic device, and a computer-readable storage medium.
背景技术Background technique
在传统的存储管理软件的架构中,根据后端不同功能拆分了不同的功能模块,如图1、图2所示,集群中所有节点的每个模块都与单个Rabbitmq(Rabbit Message Queue,Rabbit公司开发的一种程序对程序的通信方法)服务节点的一个消息服务保持长连接。然而,除了性能和缓存等需要定时执行收集信息的模块之外,其他业务模块基本都处于不活跃状态。当没有请求命令时,模块连接处于空跑状态,浪费了连接资源。同时各个模块处理请求之后又各自临时申请创建新的连接用于发送处理结果,每次接收一个处理请求就新建一个连接,资源开销较大,当节点和模块数量较多时,对单个Rabbitmq服务节点造成很大的压力。In the architecture of traditional storage management software, different functional modules are split according to different back-end functions. As shown in Figure 1 and Figure 2, each module of all nodes in the cluster is connected to a single Rabbitmq (Rabbit Message Queue, Rabbit A program-to-program communication method developed by the company) A message service of the service node maintains a long connection. However, with the exception of modules that need to be executed periodically to collect information, such as performance and caching, other business modules are basically in an inactive state. When there is no request command, the module connection is in an empty running state, which wastes connection resources. At the same time, after each module processes the request, they temporarily apply to create a new connection to send the processing result. Each time a processing request is received, a new connection is created. The resource overhead is large. When the number of nodes and modules is large, it will cause a single Rabbitmq service node. a lot of pressure.
因此,如何解决上述问题是本领域技术人员需要重点关注的。Therefore, how to solve the above-mentioned problems is what those skilled in the art need to focus on.
发明内容Summary of the invention
本申请的目的在于提供一种业务处理方法、装置及一种电子设备和一种计算机可读存储介质,降低了单个Rabbitmq节点的压力,且减少了连接的创建时间,提高了消息流转的速度。The purpose of this application is to provide a service processing method and device, an electronic device, and a computer-readable storage medium, which reduces the pressure on a single Rabbitmq node, reduces the connection creation time, and improves the message flow speed.
为实现上述目的,本申请提供了一种业务处理方法,包括:In order to achieve the above objective, this application provides a service processing method, including:
接收客户端下发的web(网络)业务请求;Receive web (network) service requests issued by the client;
从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;Select a first target persistent connection in an idle state from the first type of connection pool, where the first type of connection pool stores a pre-established persistent connection for receiving;
利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;Using the first target long connection to send the web service request to a corresponding function module for processing, and obtain a processing result corresponding to the web service request;
从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. The second type of connection pool stores pre-established connections. Long connection for sending.
可选的,所述利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,包括:Optionally, the using the first target persistent connection to send the web service request to a corresponding functional module for processing includes:
对所述web业务请求进行解析,得到其中包含的请求操作码;Parse the web service request to obtain the request operation code contained therein;
根据所述请求操作码确定用于处理所述web业务请求的功能模块;Determining a functional module for processing the web service request according to the request operation code;
将所述web业务请求通过所述第一目标长连接发送至所述功能模块,以便所述功能模块对所述web业务请求进行处理。The web service request is sent to the functional module through the first target persistent connection, so that the functional module can process the web service request.
可选的,还包括:Optionally, it also includes:
对所述第一类连接池和所述第二类连接池中的长连接进行状态监测;Performing state monitoring on the long connections in the first type connection pool and the second type connection pool;
若监测到任意长连接断开,则对断开的长连接进行重连操作。If any long connection is detected to be disconnected, the disconnected long connection is reconnected.
可选的,所述对所述第一类连接池和所述第二类连接池中的长连接进行状态监测之后,还包括:Optionally, after the monitoring the status of the long connections in the first-type connection pool and the second-type connection pool, the method further includes:
若监测到任意长连接断开,则针对断开的长连接统计对应的断开次数;If any long connection is detected to be disconnected, the corresponding disconnection times will be counted for the disconnected long connection;
当监测到任意长连接对应的所述断开次数大于第一预设阈值,则在预设时间段内禁止对当前长连接进行重连操作。When it is detected that the number of disconnections corresponding to any long connection is greater than the first preset threshold, the reconnection operation on the current long connection is prohibited within the preset time period.
可选的,还包括:Optionally, it also includes:
通过统计历史业务处理数据,生成表征业务处理压力变化的时间曲线;Through statistics of historical business processing data, a time curve that characterizes changes in business processing pressure is generated;
基于所述第一类连接池和所述第二类连接池中所保存长连接的当前数量和最大阈值,结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作。Based on the current number and maximum threshold of the long connections stored in the first type connection pool and the second type connection pool, add or release the long connections in the connection pool at a preset time node in combination with the time curve .
可选的,所述结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作,包括:Optionally, the adding or releasing a long connection in the connection pool at a preset time node in combination with the time curve includes:
若根据所述时间曲线确定预设时间节点的业务处理压力小于第二预设阈值,则获取连接池中各个长连接对应的断开次数和发送成功率;If it is determined according to the time curve that the service processing pressure of the preset time node is less than the second preset threshold, obtain the number of disconnections and the sending success rate corresponding to each long connection in the connection pool;
结合所述断开次数和所述发送成功率,确定第三目标长连接,对所述 第三目标长连接进行释放操作。Combining the number of disconnections and the sending success rate, determine a third target persistent connection, and perform a release operation on the third target persistent connection.
可选的,所述结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作,包括:Optionally, the adding or releasing a long connection in the connection pool at a preset time node in combination with the time curve includes:
对待处理业务请求的数量进行实时监控,得到实际压力数据;Real-time monitoring of the number of business requests to be processed to obtain actual pressure data;
结合所述时间曲线和所述实际压力数据在预设时间节点对连接池中的长连接进行添加或释放操作。The long connection in the connection pool is added or released at a preset time node in combination with the time curve and the actual pressure data.
为实现上述目的,本申请提供了一种业务处理装置,包括:To achieve the above objective, this application provides a service processing device, including:
请求接收模块,用于接收客户端下发的web业务请求;The request receiving module is used to receive web service requests issued by the client;
第一选取模块,用于从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;The first selection module is configured to select a first target persistent connection in an idle state from a first type of connection pool, and the first type of connection pool stores a pre-established persistent connection for receiving;
请求发送模块,用于利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;A request sending module, configured to use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
第二选取模块,用于从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。The second selection module is configured to select a second target persistent connection in an idle state from the second type of connection pool, and return the processing result to the client through the second target persistent connection, the second type of connection Pre-established long connections for sending are stored in the pool.
为实现上述目的,本申请提供了一种电子设备,包括:In order to achieve the above objective, this application provides an electronic device, including:
存储器,用于存储计算机程序;Memory, used to store computer programs;
处理器,用于执行所述计算机程序时实现前述公开的任一种业务处理方法的步骤。The processor is used to implement the steps of any service processing method disclosed above when executing the computer program.
为实现上述目的,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现前述公开的任一种业务处理方法的步骤。In order to achieve the above objective, this application provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium. step.
通过以上方案可知,本申请提供的一种业务处理方法,包括:接收客户端下发的web业务请求;从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长 连接。由上可知,本申请的第一类连接池中保存了预先建立的长连接,用于统一接收业务请求,无需各个模块均保持与单个Rabbitmq节点的长连接,从而降低了单个Rabbitmq节点长连接的数量。同时,在各个模块处理结果后,可通过第二类连接池中预先建立的长连接进行发送,避免了不断创建和销毁临时连接的资源开销,且减少了连接的创建时间,提高了消息流转的速度。It can be seen from the above solution that a service processing method provided by this application includes: receiving a web service request issued by a client; Pre-established persistent connections for receiving are stored in the pool; using the first target persistent connection, the web service request is sent to the corresponding functional module for processing, and the processing result corresponding to the web service request is obtained; Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. The second type of connection pool stores pre-established connections. Long connection for sending. It can be seen from the above that the first type of connection pool in this application saves pre-established long connections for unified reception of service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the long connection of a single Rabbitmq node. quantity. At the same time, after the results of each module are processed, they can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.
本申请还公开了一种业务处理装置及一种电子设备和一种计算机可读存储介质,同样能实现上述技术效果。The application also discloses a service processing device, an electronic device, and a computer-readable storage medium, which can also achieve the above technical effects.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性的,并不能限制本申请。It should be understood that the above general description and the following detailed description are only exemplary and cannot limit the application.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
图1为相关技术中消息处理流程示意图;Figure 1 is a schematic diagram of a message processing flow in related technologies;
图2为相关技术中单节点服务与各模块建立长连接的示意图;Figure 2 is a schematic diagram of a single node service establishing a long connection with each module in the related technology;
图3为本申请实施例公开的一种业务处理方法的流程图;FIG. 3 is a flowchart of a service processing method disclosed in an embodiment of the application;
图4为本申请实施例公开的应用于业务处理方法的架构示意图;FIG. 4 is a schematic diagram of the architecture of the service processing method disclosed in an embodiment of the application;
图5为本申请实施例公开的另一种业务处理方法的流程图;FIG. 5 is a flowchart of another service processing method disclosed in an embodiment of the application;
图6为本申请实施例公开的一种业务处理装置的结构图;Fig. 6 is a structural diagram of a service processing device disclosed in an embodiment of the application;
图7为本申请实施例公开的一种电子设备的结构图;FIG. 7 is a structural diagram of an electronic device disclosed in an embodiment of the application;
图8为本申请实施例公开的另一种电子设备的结构图。FIG. 8 is a structural diagram of another electronic device disclosed in an embodiment of the application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例, 而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by a person of ordinary skill in the art without creative work shall fall within the protection scope of this application.
在现有技术中,集群中所有节点的每个模块都与单个rabbitmq服务节点的一个消息服务保持长连接,浪费了连接资源。同时各个模块每次接收一个处理请求就新建一个连接,资源开销较大,当节点和模块数量较多时,对单个Rabbitmq服务节点造成很大的压力。In the prior art, each module of all nodes in the cluster maintains a long connection with a message service of a single rabbitmq service node, which wastes connection resources. At the same time, each module creates a new connection every time it receives a processing request, and the resource overhead is large. When the number of nodes and modules is large, it will cause a lot of pressure on a single Rabbitmq service node.
因此,本申请实施例公开了一种业务处理方法,降低了单个Rabbitmq服务节点的压力,且减少了连接的创建时间,提高了消息流转的速度。Therefore, the embodiment of the present application discloses a service processing method, which reduces the pressure on a single Rabbitmq service node, reduces the connection creation time, and improves the message flow speed.
参见图3、图4所示,本申请实施例公开的一种业务处理方法包括:Referring to FIG. 3 and FIG. 4, a service processing method disclosed in an embodiment of the present application includes:
S101:接收客户端下发的web业务请求;S101: Receive a web service request issued by a client;
本申请实施例中,可以接收客户端通过命令行CLI(command-line interface)或前端页面下发的web业务请求。具体地,web业务请求可以包括但不限于对数据的查询、修改、删除等请求。In the embodiment of the present application, a web service request issued by a client through a command-line interface (command-line interface) or a front-end page can be received. Specifically, web service requests may include, but are not limited to, requests such as data query, modification, and deletion.
S102:从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;S102: Select a first target persistent connection in an idle state from the first type of connection pool, where a pre-established persistent connection for receiving is stored in the first type of connection pool;
本步骤中,可从第一类连接池中选取状态为空闲的第一目标长连接,以便利用该长连接将请求发送至对应的功能模块。其中,第一类连接池用于维护消费者长连接,其中保存了预先建立的用于进行接收的长连接,负责管理、存储和释放长连接。在初始化时,将创建一定数量的长连接存放至第一类连接池中,创建数量可根据预先设定的最小连接数来确定,确保连接池中至少拥有最小连接数量的长连接。In this step, the first target persistent connection whose status is idle can be selected from the first type of connection pool, so as to use the persistent connection to send the request to the corresponding functional module. Among them, the first type of connection pool is used to maintain consumer long-term connections, which saves pre-established long-term connections for receiving, and is responsible for managing, storing, and releasing long-term connections. During initialization, a certain number of persistent connections are created in the first type of connection pool. The number of creations can be determined according to the preset minimum number of connections to ensure that there are at least the minimum number of persistent connections in the connection pool.
S103:利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;S103: Use the first target long connection to send the web service request to a corresponding function module for processing, and obtain a processing result corresponding to the web service request;
在具体实施中,可利用上述选取的第一目标长连接将web业务请求发送至对应的功能模块进行处理。可以理解的是,本实施例可以通过对web业务请求进行解析,得到其中包含的请求操作码,进而可根据当前的请求操作码确定用于处理该web业务请求的功能模块,进而通过第一目标长连接将web业务请求发送至已确定的功能模块,以便功能模块对当前web业 务请求进行处理。In a specific implementation, the first target persistent connection selected above can be used to send the web service request to the corresponding functional module for processing. It is understandable that this embodiment can parse the web service request to obtain the request operation code contained therein, and then determine the functional module used to process the web service request according to the current request operation code, and then pass the first target The long connection sends the web service request to the determined functional module so that the functional module can process the current web service request.
S104:从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。S104: Select an idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. Established long connection for sending.
当利用功能模块处理得到当前web业务请求对应的处理结果之后,可以在第二类连接池中选取状态空闲的第二目标长连接,进而可通过第二目标长连接将处理结果发送至客户端。其中,第二类连接池中保存了预先建立的用于进行发送的长连接,负责管理、存储和释放长连接。同样的,可以在初始化时创建大于或等于最小连接数的长连接存放至第二类连接池。After the processing result corresponding to the current web service request is obtained by the functional module processing, the idle second target persistent connection can be selected from the second type of connection pool, and the processing result can be sent to the client through the second target persistent connection. Among them, the second type of connection pool stores pre-established long connections for sending, and is responsible for managing, storing, and releasing long connections. Similarly, long connections that are greater than or equal to the minimum number of connections can be created during initialization and stored in the second type of connection pool.
作为一种优选的实施方式,本申请实施例还可以定时或实时地对第一类连接池和第二类连接池中维护的长连接进行状态监测。若监测到任意长连接断开,则对断开的长连接进行重连操作。As a preferred implementation manner, the embodiment of the present application can also perform state monitoring on the long connections maintained in the first type connection pool and the second type connection pool at a fixed time or in real time. If any long connection is detected to be disconnected, the disconnected long connection is reconnected.
进一步地,若监测到任意长连接断开,本申请实施例可以针对断开的长连接统计该连接对应的断开次数。若监测到任意长连接对应的断开次数大于第一预设阈值,则表征该连接不稳定,性能较差,可在预设时间段内禁止对当前长连接进行重连操作,避免对稳定性差的长连接反复进行重连导致的资源浪费情况。Further, if it is detected that any long connection is disconnected, the embodiment of the present application can count the number of disconnections corresponding to the connection for the disconnected long connection. If it is detected that the number of disconnections corresponding to any long connection is greater than the first preset threshold, it indicates that the connection is unstable and the performance is poor. The reconnection operation of the current long connection can be prohibited within the preset time period to avoid poor stability The resource waste caused by repeated reconnections of long connections.
通过以上方案可知,本申请提供的一种业务处理方法,包括:接收客户端下发的web业务请求;从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。由上可知,本申请的第一类连接池中保存了预先建立的长连接,用于统一接收业务请求,无需各个模块均保持与单个Rabbitmq节点的长连接,从而降低了单个Rabbitmq节点长连接的数量。同时,在各个模块处理结果后,可通过第二类连接池中预先建立的长连接进行发送,避免了不断创建和销毁临时连接的资源开销,且减少了连接的创建时间,提高了消息 流转的速度。It can be seen from the above solution that a service processing method provided by this application includes: receiving a web service request issued by a client; Pre-established persistent connections for receiving are stored in the pool; using the first target persistent connection, the web service request is sent to the corresponding functional module for processing, and the processing result corresponding to the web service request is obtained; Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. The second type of connection pool stores pre-established connections. Long connection for sending. It can be seen from the above that the first type of connection pool in this application saves pre-established long connections for unified reception of service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the long connection of a single Rabbitmq node. quantity. At the same time, after the results of each module are processed, they can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.
本申请实施例公开了另一种业务处理方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。参见图5所示,具体的:The embodiment of the present application discloses another service processing method. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. As shown in Figure 5, specific:
S201:接收客户端下发的web业务请求;S201: Receive a web service request issued by a client;
S202:从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;S202: Select a first target persistent connection in an idle state from the first type of connection pool, where a pre-established persistent connection for receiving is stored in the first type of connection pool;
S203:利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;S203: Use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
S204:从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接;S204: Select an idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. Long connection established for sending;
S205:通过统计历史业务处理数据,生成表征业务处理压力变化的时间曲线;S205: Generate a time curve that characterizes changes in business processing pressure by collecting statistics on historical business processing data;
本申请实施例中,作为一种优选的实施方式,可以结合实际业务处理情况对连接池中的连接进行适应性的调整,例如,可以在业务处理压力较大时添加长连接数量,以降低业务处理响应时间,在业务处理压力较小时减少长连接数量,减少资源消耗。由此,本申请实施例可收集历史业务处理数据,并通过对历史数据进行统计,生成表征业务处理压力变化的时间曲线。In the embodiments of this application, as a preferred implementation manner, the connections in the connection pool can be adaptively adjusted according to actual business processing conditions. For example, the number of long connections can be added when the business processing pressure is high to reduce business Processing response time, reducing the number of long connections when the business processing pressure is small, and reducing resource consumption. Thus, the embodiment of the present application can collect historical business processing data, and generate a time curve that characterizes changes in business processing pressure by performing statistics on the historical data.
S206:基于所述第一类连接池和所述第二类连接池中所保存长连接的当前数量和最大阈值,结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作。S206: Based on the current number and maximum threshold of persistent connections stored in the first type of connection pool and the second type of connection pool, add or add to the persistent connections in the connection pool at a preset time node in combination with the time curve Release operation.
可以理解的是,当生成表征业务处理压力变化的时间曲线之后,可以基于时间曲线得知大致的业务处理压力变化规律,并确定各个时间段或时间节点可能对应的业务处理压力。进而可基于连接池中当前保存的连接数量和最大阈值,在预设时间节点执行添加长连接或释放长连接的操作。It is understandable that after generating a time curve that characterizes changes in business processing pressure, a rough business processing pressure change rule can be learned based on the time curve, and the business processing pressure that may correspond to each time period or time node can be determined. Furthermore, based on the number of connections currently saved in the connection pool and the maximum threshold, the operation of adding or releasing long connections can be performed at a preset time node.
在一种具体的实施方式中,上述结合时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作的过程可以具体包括:若根据时间曲线 确定预设时间节点的业务处理压力小于第二预设阈值,则获取连接池中各个长连接对应的断开次数和发送成功率。结合各个长连接的断开次数和发送成功率,确定第三目标长连接,并对第三目标长连接进行释放操作。也即,本申请实施例可根据时间曲线确定业务处理压力较小的时间节点,例如,可将业务处理压力小于第二预设阈值的时间节点确定为预设时间节点,在到达该时间节点时进行连接释放操作。在释放长连接时,可在所有长连接中选取断开次数较多,和/或发送成功率较低的长连接进行释放。上述第二预设阈值可在实际实施中根据具体情况进行设定,在此不对其进行具体限定。In a specific embodiment, the process of adding or releasing the long connections in the connection pool at the preset time node in combination with the time curve may specifically include: if it is determined according to the time curve that the service processing pressure of the preset time node is less than The second preset threshold is used to obtain the number of times of disconnection and the sending success rate corresponding to each long connection in the connection pool. Combining the number of times of disconnection and the transmission success rate of each persistent connection, the third target persistent connection is determined, and the third target persistent connection is released. That is, the embodiment of the present application can determine the time node with less business processing pressure according to the time curve. For example, the time node where the business processing pressure is less than the second preset threshold can be determined as the preset time node, and when the time node is reached Perform the connection release operation. When releasing a long connection, a long connection with a larger number of disconnections and/or a lower transmission success rate can be selected among all the long connections for release. The above-mentioned second preset threshold may be set according to specific conditions in actual implementation, and is not specifically limited here.
作为一种优选的情况,本申请实施例除了基于历史数据得到的时间曲线,还可对待处理业务请求的数量进行实时监控,得到实际压力数据,进而可以结合时间曲线和实际压力数据在预设时间节点对连接池中的长连接进行添加或释放操作,以避免在仅仅依靠时间曲线作为调整依据时,若出现与时间曲线不符合的业务压力突变节点时仍按照原始情况进行长连接的调整对业务处理或资源开销产生的影响,确保长连接维护的精准性。As a preferred situation, in addition to the time curve obtained based on historical data, the embodiment of the present application can also perform real-time monitoring of the number of service requests to be processed to obtain actual pressure data, which can then be combined with the time curve and actual pressure data at a preset time. The node adds or releases the long connection in the connection pool to avoid the adjustment of the long connection according to the original situation when the time curve is only used as the basis for adjustment. The impact of processing or resource overhead ensures the accuracy of long-term connection maintenance.
在具体实施中,上述结合时间曲线和实际压力数据在预设时间节点对连接池中的长连接进行添加或释放操作的过程可以包括:获取实时监测的实际压力数据,并计算下一时间节点的实际压力数据与时间曲线中对应的历史压力数据的差值,判断该差值是否处于预设变化范围中。如果是,则表征实际压力数据基本符合时间曲线规律,可按照原始时间曲线对应的调整策略对长连接进行调整,无需对其进行修改;如果否,则表征实际压力数据与时间曲线规律存在差别,由此需要根据实时检测的实际压力数据确定下一时间节点是否需要执行添加长连接的操作或释放长连接的操作。In a specific implementation, the above-mentioned process of adding or releasing long connections in the connection pool at a preset time node in combination with the time curve and actual pressure data may include: obtaining real-time monitored actual pressure data, and calculating the next time node The difference between the actual pressure data and the corresponding historical pressure data in the time curve is used to determine whether the difference is within the preset variation range. If it is, the actual pressure data is basically in line with the law of the time curve, and the long connection can be adjusted according to the adjustment strategy corresponding to the original time curve without modifying it; if not, the actual pressure data is different from the law of the time curve. Therefore, it is necessary to determine whether the next time node needs to perform the operation of adding a long connection or releasing the operation of the long connection according to the actual pressure data detected in real time.
下面对本申请实施例提供的一种业务处理装置进行介绍,下文描述的一种业务处理装置与上文描述的一种业务处理方法可以相互参照。The following describes a service processing device provided by an embodiment of the present application. The service processing device described below and the service processing method described above can be cross-referenced.
参见图6所示,本申请实施例提供的一种业务处理装置包括:As shown in FIG. 6, a service processing apparatus provided by an embodiment of the present application includes:
请求接收模块301,用于接收客户端下发的web业务请求;The request receiving module 301 is used to receive web service requests issued by the client;
第一选取模块302,用于从第一类连接池中选取状态空闲的第一目标 长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;The first selection module 302 is configured to select a first target persistent connection in an idle state from a first type of connection pool, and the first type of connection pool stores a pre-established persistent connection for receiving;
请求发送模块303,用于利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;The request sending module 303 is configured to use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
第二选取模块304,用于从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。The second selection module 304 is configured to select a second target persistent connection in an idle state from the second type of connection pool, and return the processing result to the client through the second target persistent connection, the second type Pre-established long connections for sending are stored in the connection pool.
关于上述模块301至304的具体实施过程可参考前述实施例公开的相应内容,在此不再进行赘述。For the specific implementation process of the foregoing modules 301 to 304, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not described herein again.
本申请还提供了一种电子设备,参见图7所示,本申请实施例提供的一种电子设备包括:This application also provides an electronic device. As shown in FIG. 7, an electronic device provided by an embodiment of the application includes:
存储器100,用于存储计算机程序;The memory 100 is used to store computer programs;
处理器200,用于执行所述计算机程序时可以实现上述实施例所提供的步骤。The processor 200 is configured to implement the steps provided in the foregoing embodiments when executing the computer program.
具体的,存储器100包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机可读指令,该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。处理器200在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,为电子设备提供计算和控制能力,执行所述存储器100中保存的计算机程序时,可以实现前述任一实施例公开的业务处理方法的步骤。Specifically, the memory 100 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for running the operating system and the computer-readable instructions in the non-volatile storage medium. In some embodiments, the processor 200 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip, which provides computing and control capabilities for electronic devices, and executes the The computer program stored in the memory 100 can implement the steps of the service processing method disclosed in any of the foregoing embodiments.
在上述实施例的基础上,作为优选实施方式,参见图8所示,所述电子设备还包括:On the basis of the foregoing embodiment, as a preferred implementation manner, referring to FIG. 8, the electronic device further includes:
输入接口300,与处理器200相连,用于获取外部导入的计算机程序、参数和指令,经处理器200控制保存至存储器100中。该输入接口300可以与输入装置相连,接收用户手动输入的参数或指令。该输入装置可以是显示屏上覆盖的触摸层,也可以是终端外壳上设置的按键、轨迹球或触控板,也可以是键盘、触控板或鼠标等。The input interface 300 is connected to the processor 200 and is used to obtain externally imported computer programs, parameters and instructions, and store them in the memory 100 under the control of the processor 200. The input interface 300 can be connected to an input device to receive parameters or instructions manually input by the user. The input device may be a touch layer covered on the display screen, a button, a trackball, or a touch pad provided on the terminal housing, or a keyboard, a touch pad, or a mouse.
显示单元400,与处理器200相连,用于显示处理器200处理的数据以及用于显示可视化的用户界面。该显示单元400可以为LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。The display unit 400 is connected to the processor 200 and is used for displaying data processed by the processor 200 and for displaying a visualized user interface. The display unit 400 may be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
网络端口500,与处理器200相连,用于与外部各终端设备进行通信连接。该通信连接所采用的通信技术可以为有线通信技术或无线通信技术,如移动高清链接技术(MHL)、通用串行总线(USB)、高清多媒体接口(HDMI)、无线保真技术(WiFi)、蓝牙通信技术、低功耗蓝牙通信技术、基于IEEE802.11s的通信技术等。The network port 500 is connected to the processor 200 and is used to communicate with external terminal devices. The communication technology used in the communication connection can be wired communication technology or wireless communication technology, such as mobile high-definition link technology (MHL), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.
图8仅示出了具有组件100-500的电子设备,本领域技术人员可以理解的是,图8示出的结构并不构成对电子设备的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 8 only shows an electronic device with components 100-500. Those skilled in the art can understand that the structure shown in FIG. 8 does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure. Components, or combinations of certain components, or different component arrangements.
本申请还提供了一种计算机可读存储介质,该存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。该存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现前述任一实施例公开的业务处理方法的步骤。This application also provides a computer-readable storage medium, which may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic Various media that can store program codes such as discs or optical discs. A computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the service processing method disclosed in any of the foregoing embodiments are implemented.
本申请的第一类连接池中保存了预先建立的长连接,用于统一接收业务请求,无需各个模块均保持与单个Rabbitmq节点的长连接,从而降低了单个Rabbitmq节点长连接的数量。同时,在各个模块处理结果后,可通过第二类连接池中预先建立的长连接进行发送,避免了不断创建和销毁临时连接的资源开销,且减少了连接的创建时间,提高了消息流转的速度。The first type of connection pool in this application saves pre-established long connections for uniformly receiving service requests, without requiring each module to maintain a long connection with a single Rabbitmq node, thereby reducing the number of long connections for a single Rabbitmq node. At the same time, after the results of each module are processed, they can be sent through the long connections established in the second type of connection pool, which avoids the resource overhead of constantly creating and destroying temporary connections, reduces the connection creation time, and improves the message flow speed.
说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的系统而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范 围内。The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method part. It should be pointed out that for those of ordinary skill in the art, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or sequence between operations. Moreover, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also those that are not explicitly listed Other elements of, or also include elements inherent to this process, method, article or equipment. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.

Claims (10)

  1. 一种业务处理方法,其特征在于,包括:A business processing method, characterized in that it comprises:
    接收客户端下发的web业务请求;Receive web service requests issued by the client;
    从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;Select a first target persistent connection in an idle state from the first type of connection pool, where the first type of connection pool stores a pre-established persistent connection for receiving;
    利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;Using the first target long connection to send the web service request to a corresponding function module for processing, and obtain a processing result corresponding to the web service request;
    从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。Select the idle second target persistent connection from the second type of connection pool, and return the processing result to the client through the second target persistent connection. The second type of connection pool stores pre-established connections. Long connection for sending.
  2. 根据权利要求1所述的业务处理方法,其特征在于,所述利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,包括:The service processing method according to claim 1, wherein the using the first target long connection to send the web service request to a corresponding functional module for processing includes:
    对所述web业务请求进行解析,得到其中包含的请求操作码;Parse the web service request to obtain the request operation code contained therein;
    根据所述请求操作码确定用于处理所述web业务请求的功能模块;Determining a functional module for processing the web service request according to the request operation code;
    将所述web业务请求通过所述第一目标长连接发送至所述功能模块,以便所述功能模块对所述web业务请求进行处理。The web service request is sent to the functional module through the first target persistent connection, so that the functional module can process the web service request.
  3. 根据权利要求1所述的业务处理方法,其特征在于,还包括:The service processing method according to claim 1, further comprising:
    对所述第一类连接池和所述第二类连接池中的长连接进行状态监测;Performing state monitoring on the long connections in the first type connection pool and the second type connection pool;
    若监测到任意长连接断开,则对断开的长连接进行重连操作。If any long connection is detected to be disconnected, the disconnected long connection is reconnected.
  4. 根据权利要求3所述的业务处理方法,其特征在于,所述对所述第一类连接池和所述第二类连接池中的长连接进行状态监测之后,还包括:The service processing method according to claim 3, wherein after the monitoring the status of the long connections in the first type connection pool and the second type connection pool, the method further comprises:
    若监测到任意长连接断开,则针对断开的长连接统计对应的断开次数;If any long connection is detected to be disconnected, the corresponding disconnection times will be counted for the disconnected long connection;
    当监测到任意长连接对应的所述断开次数大于第一预设阈值,则在预设时间段内禁止对当前长连接进行重连操作。When it is detected that the number of disconnections corresponding to any long connection is greater than the first preset threshold, the reconnection operation on the current long connection is prohibited within the preset time period.
  5. 根据权利要求1至4任一项所述的业务处理方法,其特征在于,还包括:The service processing method according to any one of claims 1 to 4, further comprising:
    通过统计历史业务处理数据,生成表征业务处理压力变化的时间曲线;Through statistics of historical business processing data, a time curve that characterizes changes in business processing pressure is generated;
    基于所述第一类连接池和所述第二类连接池中所保存长连接的当前数 量和最大阈值,结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作。Based on the current number and maximum threshold of the long connections stored in the first type connection pool and the second type connection pool, add or release the long connections in the connection pool at a preset time node in combination with the time curve .
  6. 根据权利要求5所述的业务处理方法,其特征在于,所述结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作,包括:The service processing method according to claim 5, wherein the adding or releasing the long connection in the connection pool at a preset time node in combination with the time curve comprises:
    若根据所述时间曲线确定预设时间节点的业务处理压力小于第二预设阈值,则获取连接池中各个长连接对应的断开次数和发送成功率;If it is determined according to the time curve that the service processing pressure of the preset time node is less than the second preset threshold, obtain the number of disconnections and the sending success rate corresponding to each long connection in the connection pool;
    结合所述断开次数和所述发送成功率,确定第三目标长连接,对所述第三目标长连接进行释放操作。Combining the number of disconnections and the sending success rate, determine a third target persistent connection, and perform a release operation on the third target persistent connection.
  7. 根据权利要求5所述的业务处理方法,其特征在于,所述结合所述时间曲线在预设时间节点对连接池中的长连接进行添加或释放操作,包括:The service processing method according to claim 5, wherein the adding or releasing the long connection in the connection pool at a preset time node in combination with the time curve comprises:
    对待处理业务请求的数量进行实时监控,得到实际压力数据;Real-time monitoring of the number of business requests to be processed to obtain actual pressure data;
    结合所述时间曲线和所述实际压力数据在预设时间节点对连接池中的长连接进行添加或释放操作。The long connection in the connection pool is added or released at a preset time node in combination with the time curve and the actual pressure data.
  8. 一种业务处理装置,其特征在于,包括:A service processing device, characterized in that it comprises:
    请求接收模块,用于接收客户端下发的web业务请求;The request receiving module is used to receive web service requests issued by the client;
    第一选取模块,用于从第一类连接池中选取状态空闲的第一目标长连接,所述第一类连接池中保存了预先建立的用于进行接收的长连接;The first selection module is configured to select a first target persistent connection in an idle state from a first type of connection pool, and the first type of connection pool stores a pre-established persistent connection for receiving;
    请求发送模块,用于利用所述第一目标长连接,将所述web业务请求发送至对应的功能模块进行处理,得到所述web业务请求对应的处理结果;A request sending module, configured to use the first target persistent connection to send the web service request to a corresponding functional module for processing, and obtain a processing result corresponding to the web service request;
    第二选取模块,用于从第二类连接池中选取状态空闲的第二目标长连接,通过所述第二目标长连接将所述处理结果返回至所述客户端,所述第二类连接池中保存了预先建立的用于进行发送的长连接。The second selection module is configured to select a second target persistent connection in an idle state from the second type of connection pool, and return the processing result to the client through the second target persistent connection, the second type of connection Pre-established long connections for sending are stored in the pool.
  9. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    存储器,用于存储计算机程序;Memory, used to store computer programs;
    处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述业务处理方法的步骤。The processor is configured to implement the steps of the service processing method according to any one of claims 1 to 7 when the computer program is executed.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述业务处理方法的步骤。A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it realizes the service processing method according to any one of claims 1 to 7 step.
PCT/CN2021/077022 2020-06-24 2021-02-20 Service processing method and apparatus, and electronic device and storage medium WO2021258753A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010591007.0 2020-06-24
CN202010591007.0A CN111770157B (en) 2020-06-24 2020-06-24 Business processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021258753A1 true WO2021258753A1 (en) 2021-12-30

Family

ID=72722019

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/077022 WO2021258753A1 (en) 2020-06-24 2021-02-20 Service processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN111770157B (en)
WO (1) WO2021258753A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114401204A (en) * 2022-01-14 2022-04-26 平安科技(深圳)有限公司 Link pool management method and device, computer equipment and storage medium
CN114675908A (en) * 2022-05-27 2022-06-28 武汉中科通达高新技术股份有限公司 Service data processing system, method, computer device and storage medium
CN116055227A (en) * 2023-03-31 2023-05-02 北京国信会视科技有限公司 Intelligent terminal management and control method, system and device based on android device online security

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770157B (en) * 2020-06-24 2023-04-18 广东浪潮大数据研究有限公司 Business processing method and device, electronic equipment and storage medium
CN113467966A (en) * 2021-05-31 2021-10-01 珠海大横琴科技发展有限公司 Data processing method and device
CN114338479B (en) * 2022-01-04 2024-03-22 北京金山云网络技术有限公司 Communication method, device and system
CN115132189A (en) * 2022-06-10 2022-09-30 中国第一汽车股份有限公司 Long connection communication connection pool management method based on self-adaptive control strategy

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104270472A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
US20180019922A1 (en) * 2016-07-15 2018-01-18 Ebay Inc. Preemptive connection pool adjustments
CN108124003A (en) * 2017-12-11 2018-06-05 中盈优创资讯科技有限公司 Network management device connection processing method, apparatus and system
CN109769001A (en) * 2019-03-19 2019-05-17 中信梧桐港供应链管理有限公司 A kind of internet of things data transmission method and system
CN109818810A (en) * 2019-03-18 2019-05-28 深圳市网心科技有限公司 A kind of access server connection optimization method, access server and communication system
CN110430238A (en) * 2019-07-05 2019-11-08 中国平安财产保险股份有限公司 Long connection management method, apparatus, equipment and computer readable storage medium
CN111770157A (en) * 2020-06-24 2020-10-13 广东浪潮大数据研究有限公司 Business processing method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104092714B (en) * 2013-09-25 2016-02-17 腾讯科技(深圳)有限公司 The player method of files in stream media and device
CN110049068A (en) * 2018-01-15 2019-07-23 北京京东尚科信息技术有限公司 A kind of method and apparatus of the Chief Web Officer connection optimization based on hypertext transfer protocol
CN110289993B (en) * 2019-06-06 2022-03-04 创新先进技术有限公司 Connection pool management method, device, equipment and switching system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104270472A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
US20180019922A1 (en) * 2016-07-15 2018-01-18 Ebay Inc. Preemptive connection pool adjustments
CN108124003A (en) * 2017-12-11 2018-06-05 中盈优创资讯科技有限公司 Network management device connection processing method, apparatus and system
CN109818810A (en) * 2019-03-18 2019-05-28 深圳市网心科技有限公司 A kind of access server connection optimization method, access server and communication system
CN109769001A (en) * 2019-03-19 2019-05-17 中信梧桐港供应链管理有限公司 A kind of internet of things data transmission method and system
CN110430238A (en) * 2019-07-05 2019-11-08 中国平安财产保险股份有限公司 Long connection management method, apparatus, equipment and computer readable storage medium
CN111770157A (en) * 2020-06-24 2020-10-13 广东浪潮大数据研究有限公司 Business processing method and device, electronic equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114401204A (en) * 2022-01-14 2022-04-26 平安科技(深圳)有限公司 Link pool management method and device, computer equipment and storage medium
CN114401204B (en) * 2022-01-14 2024-01-23 平安科技(深圳)有限公司 Link pool management method, device, computer equipment and storage medium
CN114675908A (en) * 2022-05-27 2022-06-28 武汉中科通达高新技术股份有限公司 Service data processing system, method, computer device and storage medium
CN114675908B (en) * 2022-05-27 2022-08-26 武汉中科通达高新技术股份有限公司 Service data processing system, method, computer device and storage medium
CN116055227A (en) * 2023-03-31 2023-05-02 北京国信会视科技有限公司 Intelligent terminal management and control method, system and device based on android device online security

Also Published As

Publication number Publication date
CN111770157B (en) 2023-04-18
CN111770157A (en) 2020-10-13

Similar Documents

Publication Publication Date Title
WO2021258753A1 (en) Service processing method and apparatus, and electronic device and storage medium
CN109660607B (en) Service request distribution method, service request receiving method, service request distribution device, service request receiving device and server cluster
WO2018130163A1 (en) Scheduling method and device for mobile cloud computing platform
US8589537B2 (en) Methods and computer program products for aggregating network application performance metrics by process pool
CN110858843B (en) Service request processing method and device and computer readable storage medium
CN102917077A (en) Resource allocation method in cloud computing system
WO2020259354A1 (en) Queue adjustment method, apparatus and device, and computer-readable storage medium
US20200050479A1 (en) Blockchain network and task scheduling method therefor
WO2021093365A1 (en) Gpu video memory management control method and related device
CN110719311B (en) Distributed coordination service method, system and computer readable storage medium
US9817698B2 (en) Scheduling execution requests to allow partial results
WO2019104974A1 (en) Dubbo platform-based automatic server starting and stopping method , server, and storage medium
WO2012155440A1 (en) Method and apparatus for processing service request based on hyper text transfer protocol
CN104793982A (en) Method and device for establishing virtual machine
KR20150007698A (en) Load distribution system for virtual desktop service
US8312138B2 (en) Methods and computer program products for identifying and monitoring related business application processes
CN111427674A (en) Micro-service management method, device and system
JP2001202318A (en) Data distribution system
CN107196800B (en) Overtime hierarchical control method based on configuration
CN116108036A (en) Method and device for off-line exporting back-end system data
CN111294383B (en) Internet of things service management system
CN112073223B (en) System and method for managing and controlling operation of cloud computing terminal and cloud server
US10866876B2 (en) Dynamically configurable operation information collection
CN113238875A (en) Queue-based request frequency control system and control method
CN113111083A (en) Method, device, equipment, storage medium and program product for data query

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21828154

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24.05.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21828154

Country of ref document: EP

Kind code of ref document: A1