CN115396313A - Communication method, communication apparatus, storage medium, and electronic apparatus - Google Patents

Communication method, communication apparatus, storage medium, and electronic apparatus Download PDF

Info

Publication number
CN115396313A
CN115396313A CN202211008851.1A CN202211008851A CN115396313A CN 115396313 A CN115396313 A CN 115396313A CN 202211008851 A CN202211008851 A CN 202211008851A CN 115396313 A CN115396313 A CN 115396313A
Authority
CN
China
Prior art keywords
connection pool
connection
long
strategy
policy
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211008851.1A
Other languages
Chinese (zh)
Inventor
郝晓宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Du Xiaoman Technology Beijing Co Ltd
Original Assignee
Du Xiaoman Technology Beijing Co Ltd
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 Du Xiaoman Technology Beijing Co Ltd filed Critical Du Xiaoman Technology Beijing Co Ltd
Priority to CN202211008851.1A priority Critical patent/CN115396313A/en
Publication of CN115396313A publication Critical patent/CN115396313A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/76Admission control; Resource allocation using dynamic resource allocation, e.g. in-call renegotiation requested by the user or requested by the network in response to changing network conditions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a communication method, a communication device, a storage medium and an electronic device. Wherein, the method comprises the following steps: acquiring a first strategy connection pool, wherein the first strategy connection pool comprises a plurality of initial available connection pools; updating the first strategy connection pool according to first influence factors of a plurality of long connections to obtain a second strategy connection pool, wherein the first influence factors comprise response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second strategy connection pool comprises an initial available connection pool and a rearrangement available connection pool, the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearrangement available connection pool comprises a plurality of long connections arranged according to a preset rule; and transmitting the target request through the target long connection in the second strategy connection pool. The invention solves the technical problems of high-quality resource waste, busy poor-quality resources and low overall processing capacity of the system when the related technology trains the connection pool in turns.

Description

Communication method, communication apparatus, storage medium, and electronic apparatus
Technical Field
The present invention relates to the field of communications, and in particular, to a communication method, apparatus, storage medium, and electronic apparatus.
Background
With the development of the internet, a single server cannot bear frequent access and big data processing, so distributed deployment is adopted to distribute data to a plurality of servers for processing, and the requirements of frequent communication and real-time communication between a client and a server are met. The client and the server need to establish a Transmission Control Protocol (TCP) connection before communication can be performed, in order to reduce waste of channel resources and network resources caused by repeated connection in a short time, a TCP long connection pool is established in advance, and when a request arrives at the client, a long connection is sequentially selected from the long connection pool for communication.
The long connection pool comprises high-quality resources and poor-quality resources, and the long connection pool is trained in turn each time when the client communicates with the server, so that the high-quality resources and the poor-quality resources are selected once, high-quality resources are wasted, the poor-quality resources are busy, and the overall processing capacity of the system is low.
Disclosure of Invention
The embodiment of the invention provides a communication method, a communication device, a storage medium and an electronic device, which are used for at least solving the technical problems of high-quality resource waste, busy poor-quality resources and low overall processing capacity of a system caused by the fact that related technologies are trained to connect a pool in turn.
According to an embodiment of the present invention, there is provided a communication method including:
acquiring a first strategy connection pool, wherein the first strategy connection pool comprises a plurality of initial available connection pools, and the initial available connection pools comprise a plurality of long connections; updating a first strategy connection pool according to first influence factors of a plurality of long connections to obtain a second strategy connection pool, wherein the first influence factors comprise response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second strategy connection pool comprises an initial available connection pool and a rearrangement available connection pool, the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearrangement available connection pool comprises a plurality of long connections arranged according to a preset rule; and transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between the client and the server.
Optionally, the obtaining the first policy connection pool includes: and expanding the capacity of the initial available connection pool by M times to obtain a first strategy connection pool, wherein M is an integer larger than 0.
Optionally, before the updating the first policy connection pool according to the first influence factors of the plurality of long connections and obtaining the second policy connection pool, the method further includes: obtaining a first request, wherein the first request is transmitted through a plurality of long connections; a first influencing factor for the plurality of long connections is determined based on the first request.
Optionally, the method further comprises: and updating the first strategy connection pool according to a preset time interval.
Optionally, the updating the first policy connection pool according to the preset time interval includes: acquiring a first influence factor according to a preset time interval; calculating the weight of each long connection according to a first influence factor; and updating the first strategy connection pool according to the weight of each long connection.
Optionally, updating the first policy connection pool according to the weight of each long connection comprises: and updating and rearranging the available connection pools according to the sequence of the weight of each long connection from large to small, wherein the number of the first long connection is more than that of the second long connection, the weight of the first long connection is more than a first weight threshold value, and the weight of the second long connection is less than or equal to the first weight threshold value.
Optionally, the target long connection is the long connection that is closest to the head end of the second policy connection pool and is unused.
According to an embodiment of the present invention, there is also provided a communication apparatus including:
the system comprises an acquisition module, a management module and a management module, wherein the acquisition module is used for acquiring a first strategy connection pool, the first strategy connection pool comprises a plurality of initial available connection pools, and the initial available connection pools comprise a plurality of long connections; the updating module is used for updating the first strategy connection pool according to a first influence factor of a plurality of long connections to obtain a second strategy connection pool, wherein the first influence factor comprises response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second strategy connection pool comprises an initial available connection pool and a rearrangement available connection pool, the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearrangement available connection pool comprises a plurality of long connections which are arranged according to a preset rule; and the transmission module is used for transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between the client and the server.
Optionally, the obtaining module is further configured to expand the initial available connection pool by M times to obtain a first policy connection pool, where M is an integer greater than 0.
Optionally, the obtaining module is further configured to obtain a first request, where the first request is transmitted through multiple long connections; a first influencing factor for the plurality of long connections is determined based on the first request.
Optionally, the updating module is further configured to update the first policy connection pool according to a preset time interval.
Optionally, the updating module is further configured to obtain a first influence factor according to a preset time interval; calculating the weight of each long connection according to a first influence factor; and updating the first strategy connection pool according to the weight of each long connection.
Optionally, the updating module is further configured to update and rearrange the available connection pools according to an order in which the weight of each long connection is arranged from large to small, where the number of the first long connection is greater than the number of the second long connection, the weight of the first long connection is greater than a first weight threshold, and the weight of the second long connection is less than or equal to the first weight threshold.
Optionally, the target long connection is the long connection that is closest to the head end of the second policy connection pool and is unused.
There is further provided, according to an embodiment of the present invention, a computer-readable storage medium in which a computer program is stored, wherein the computer program is configured to perform the communication method in any one of the above when run on a computer or a processor.
There is further provided, according to an embodiment of the present invention, an electronic apparatus, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the computer program to perform the communication method in any one of the above.
In the embodiment of the invention, a first strategy connection pool is obtained, wherein the first strategy connection pool comprises a plurality of initial available connection pools, and the initial available connection pools comprise a plurality of long connections; updating a first strategy connection pool according to first influence factors of a plurality of long connections to obtain a second strategy connection pool, wherein the first influence factors comprise response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second strategy connection pool comprises an initial available connection pool and a rearrangement available connection pool, the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearrangement available connection pool comprises a plurality of long connections arranged according to a preset rule; and transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between the client and the server. By adopting the method, the initial available connection pool is expanded, and the initial available connection pool is ensured to have one at the head end of the strategy connection pool, so that the weight of each long connection can be determined before the strategy connection pool is updated next time, the number of the long connections with high weights is increased when the strategy connection pool is updated, high-quality resources can be selected for many times, the number of the long connections with low weights is reduced, and the overall processing capacity of the system is improved. The method comprises the steps of calculating the weight of long connection, periodically updating a strategy connection pool after capacity expansion, dynamically screening and sequencing the long connection, increasing the probability of selecting high-quality resources, reducing the probability of selecting poor-quality resources, reasonably using server resources, and improving the resource utilization rate and the overall processing capacity of the system, thereby solving the technical problems of high-quality resource waste, busy poor-quality resources and low overall processing capacity of the system when related technologies alternately train the long connection pool.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a communication method according to one embodiment of the present invention;
FIG. 2 is a schematic diagram of a connection pool that may be used in accordance with one embodiment of the present invention;
FIG. 3 is a schematic diagram of a client in communication with a server;
FIG. 4 is a schematic diagram of a client communicating with a server according to one embodiment of the invention;
fig. 5 is a block diagram of a communication device according to an embodiment of the present invention.
Detailed Description
For ease of understanding, some of the concepts related to the embodiments of the present invention are illustratively presented for reference. As follows:
long connection: generally, communication can be performed only after TCP connection is established between two communication parties, and after the communication is completed, the connection is disconnected, instead of actively disconnecting, and what is continuously kept connected is a long connection. Multiple data packets may be sent continuously over a long connection.
Available connection pools: refers to a non-repetitive set of TCP connections that are established between a client and all servers in a distributed deployment and that are capable of normal communications.
A strategy connection pool: in the embodiment of the invention, the long connection pool after capacity expansion, reordering and hashing of the available connection pool has load balancing capability and can be directly used by a client.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Where an embodiment of a method of communication is provided according to one of the embodiments of the present invention, it is noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The method embodiments may be performed in an electronic device, similar control device or system, comprising a memory and a processor. Taking an electronic device as an example, the electronic device may include one or more processors and memory for storing data. Optionally, the electronic apparatus may further include a communication device for a communication function and a display device. It will be understood by those skilled in the art that the foregoing structural description is merely illustrative and not restrictive on the structure of the electronic device. For example, the electronic device may also include more or fewer components than described above, or have a different configuration than described above.
A processor may include one or more processing units. For example: the processor may include a Central Processing Unit (CPU), a Graphic Processing Unit (GPU), a Digital Signal Processing (DSP) chip, a Microprocessor (MCU), a field-programmable gate array (FPGA), a neural Network Processor (NPU), a Tensor Processing Unit (TPU), an Artificial Intelligence (AI) type processor, and the like. Wherein the different processing units may be separate components or may be integrated in one or more processors. In some examples, the electronic device may also include one or more processors.
The memory may be configured to store a computer program, for example, a computer program corresponding to the communication method in the embodiment of the present invention, and the processor may execute the computer program stored in the memory, thereby implementing the communication method described above. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located from the processor, which may be connected to the electronic device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Communication devices are used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the communication device includes a Network Interface Controller (NIC) that may be connected to other network devices via a base station to communicate with the internet. In one example, the communication device may be a Radio Frequency (RF) module for communicating with the internet by wireless means.
The display device may be, for example, a touch screen type Liquid Crystal Display (LCD) and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a Graphical User Interface (GUI) with which a user can interact by touching finger contacts and/or gestures on a touch-sensitive surface, where the man-machine interaction function optionally includes the following interactions: executable instructions for creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, emailing, call interfacing, playing digital video, playing digital music, and/or web browsing, etc., for performing the above-described human-computer interaction functions, are configured/stored in one or more processor-executable computer program products or readable storage media.
In the present embodiment, a communication method operating in an electronic device is provided, and fig. 1 is a flowchart of a communication method according to an embodiment of the present invention, as shown in fig. 1, the flowchart includes the following steps:
and S101, acquiring a first strategy connection pool.
Wherein the first policy connection pool comprises a plurality of initially available connection pools, the initially available connection pools comprising a plurality of long connections.
As shown in FIG. 2, which is a schematic diagram of an available connection pool, the available connection pool in FIG. 2 can be considered as an initial available connection pool. The pool of available connections includes N long connections, each of which represents a server deployed on a machine. Currently, in a distributed deployment, a client communicates with multiple servers through an available connection pool, for example, as shown in fig. 3, a request a sent by the client selects a long connection a in the available connection pool to transmit the request a to the server a, a request B sent by the client selects a long connection B in the available connection pool to transmit the request B to the server B, and so on, a request N sent by the client selects a long connection N in the available connection pool to transmit the request N to the server N. After all the long connections (N long connections) in the available connection pool are selected, the request newly issued by the client will start to circularly select again from the long connection a in the available long connection pool for transmission.
The first policy connection pool includes a plurality of initial available connection pools, which may be understood as capacity expansion of the initial available connection pools.
And S102, updating the first strategy connection pool according to the first influence factors of the long connections to obtain a second strategy connection pool.
The first influencing factor includes response time of the transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, and may be understood as response time, success rate, pertinence or frequency response of the transmission request in the case of a long connection transmission request. In general, a shorter response time indicates a better processing capability for the long connection, i.e. a good quality long connection resource,
the second strategy connection pool comprises an initial available connection pool and a rearranged available connection pool, wherein the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearranged available connection pool comprises a plurality of long connections which are arranged according to a preset rule.
As shown in fig. 4, the second policy connection pool includes an initial available connection pool and a rearranged available connection pool, the initial available connection pool is always located at the head end of the policy connection pool, and the position remains unchanged, so that it is ensured that each long connection is selected, the first influencing factor of each long connection can be obtained, and further, when the policy connection pool is updated next time, the weight of each long connection can be determined according to the first influencing factors of a plurality of long connections.
The strategy connection pool is updated according to the first influence factors of the long connections, and the strategy connection pool can be understood as updating the rearranged available connection pool according to the first influence factors of the long connections, when updating is carried out, the long connections are rearranged according to a preset rule, high-quality long connection resources are increased, poor-quality long connection resources are reduced, and the long connection resources are arranged according to the weight of each long connection in a descending order, so that the rearranged available connection pool is updated.
And step S103, transmitting the target request through the target long connection in the second strategy connection pool.
The target request is used for communication between the client and the server.
After a target request sent by the client is acquired, a target long connection is selected from the updated strategy connection pool to transmit the target request, so that the communication between the client and the server is realized.
Because the request processing capability is directly affected by machine resources (such as a Central Processing Unit (CPU), a memory, input/output (IO) performance and the like) and network resources (the same machine room, a cross machine room and the like) of the deployment server, for example, under the condition that the machine resources are sufficient and the same machine room is adopted, the difference between high-quality resources with short response time and low-quality resources with long response time is very obvious, the strategy connection pool is updated, the strategy connection pool which accords with the current scene can be constructed under different scenes, the probability of selecting the high-quality resources is increased, the probability of selecting the low-quality resources is reduced, the server resources are reasonably used, and the overall performance of the service is improved.
Through the steps, a first strategy connection pool is obtained, wherein the first strategy connection pool comprises a plurality of initial available connection pools, and the initial available connection pools comprise a plurality of long connections; updating a first strategy connection pool according to first influence factors of a plurality of long connections to obtain a second strategy connection pool, wherein the first influence factors comprise response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second strategy connection pool comprises an initial available connection pool and a rearrangement available connection pool, the initial available connection pool is positioned at the head end of the second strategy connection pool, and the rearrangement available connection pool comprises a plurality of long connections arranged according to a preset rule; and transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between the client and the server. By adopting the method, the initial available connection pool is expanded, and the initial available connection pool is ensured to have one at the head end of the strategy connection pool, so that the weight of each long connection can be determined before the strategy connection pool is updated next time, the number of the long connections with high weights is increased when the strategy connection pool is updated, high-quality resources can be selected for many times, the number of the long connections with low weights is reduced, and the overall processing capacity of the system is improved. The method comprises the steps of calculating the weight of long connection, periodically updating a strategy connection pool after capacity expansion, dynamically screening and sequencing the long connection, increasing the probability of selecting high-quality resources, reducing the probability of selecting poor-quality resources, reasonably using server resources, and improving the resource utilization rate and the overall processing capacity of the system, thereby solving the technical problems of high-quality resource waste, busy poor-quality resources and low overall processing capacity of the system when related technologies alternately train the long connection pool.
Optionally, in step S101, acquiring the first policy connection pool may include the following steps:
and S101a, expanding the capacity of the initial available connection pool by M times to obtain a first strategy connection pool.
Wherein M is an integer greater than 0.
Illustratively, the initial available connection pool includes N long connections, and the capacity of the initial available connection pool is expanded by M times, so that the obtained first policy connection pool includes N × M long connections.
Optionally, in step S102, before updating the first policy connection pool according to the first influencing factors of the plurality of long connections to obtain the second policy connection pool, the following steps may be performed:
step S102a, a first request is obtained.
Step S102b, determining a plurality of long connections according to the first request.
Wherein the first request is transmitted over a plurality of long connections.
Before the strategy connection pool is updated for the first time, the transmission mode of the request sent by the client can be understood as the rotation of the initial available connection pool, and the requests sent by the client are transmitted through the plurality of long connections in the initial available connection pool in sequence, so that the first influence factors of the plurality of long connections can be obtained, and the strategy connection pool can be updated according to the obtained first influence factors of the plurality of long connections.
Optionally, the process further includes the following steps:
and S102c, updating the first strategy connection pool according to a preset time interval.
The preset time interval can be understood as the time interval from the last refreshing to the current refreshing, and the preset time interval can be set according to the actual situation, which is not limited by the invention.
The strategy connection pool is periodically updated, a proper strategy connection pool can be established in real time according to different situations of different scenes, high-quality resources in the strategy connection pool are more than low-quality resources, and the resource utilization rate and the overall processing capacity of the system are improved.
Optionally, in step S102c, updating the first policy connection pool according to the preset time interval may include performing the following steps:
and step S102d, acquiring a first influence factor according to a preset time interval.
And step S102e, calculating the weight of each long connection according to the first influence factor.
And step S102f, updating the first strategy connection pool according to the weight of each long connection.
Before updating the strategy connection pool each time, acquiring first influence factors of a plurality of long connections, determining the weight of each long connection according to the acquired first influence factors, updating the first strategy connection pool according to the weight of each long connection, and repeating the operation when a next preset time interval is reached, thereby ensuring that the strategy connection pool is updated periodically.
Optionally, in step S102f, updating the first policy connection pool according to the weight of each long connection may include performing the steps of:
and step S102g, updating and rearranging the available connection pools according to the sequence of the weights of the long connections from large to small.
The number of the first long connections is more than that of the second long connections, the weight of the first long connections is greater than a first weight threshold, and the weight of the second long connections is less than or equal to the first weight threshold.
The position of the initial available connection pool in the strategy connection pool is ensured to be unchanged, and the initial available connection pool is always at the head end of the strategy connection pool, so that the method is equivalent to updating only the rearrangement available connection pool. During updating, the number of long connections with large weights in the rearrangement available connection pool is increased, that is, the number of long connections with weights larger than a first weight threshold is increased, the number of long connections with small weights in the rearrangement available connection pool is reduced, that is, the number of long connections with weights smaller than or equal to a first weight threshold is reduced, and the long connections are sorted according to the sequence of weights from large to small, and the first weight threshold can be set according to actual situations, which is not limited by the present invention.
Illustratively, as shown in fig. 4, at the time of updating, the initial available connection pool position in the policy connection pool is kept unchanged, i.e., the first N long connection positions are unchanged, and the long connections in the available connection pool are rearranged after the initial available connection pool is updated, i.e., (M-1) × N long connections after the initial available connection pool is updated. If the weight of the long connection A is greater than that of the long connection C, the weight of the long connection A and the weight of the long connection C are both greater than a first weight threshold value, and the weight of the long connection B is less than the first weight threshold value, the number of the long connections A and the number of the long connections C can be increased during updating, the number of the updated long connections A is greater than that of the long connections C, the number of the long connections B can be reduced, the number of the long connections A and the number of the long connections C are both greater than that of the long connections B, and the long connections in the rearrangement available connection pool are ordered according to the weight.
Optionally, the target long connection is the long connection that is closest to the head end of the second policy connection pool and is unused.
During communication, a plurality of requests sent by a client terminal can select long connections from the head end of a strategy connection pool in sequence, and the strategy connection pool is trained in turn. Because the initial available connection pool is at the head end of the strategy connection pool, long connections in the initial available connection pool can be selected, and therefore it can be guaranteed that the first influence factor of each long connection can be obtained when the strategy connection pool is updated next time.
Therefore, in the communication method in the embodiment of the present invention, the capacity of the initial available connection pool including N long connections is expanded by M times to obtain the policy connection pool, and the policy connection pool is periodically updated according to the response time, the success rate, the pertinence, or the frequency response of each long connection in the initial available connection pool. And during updating, the first N long connections are ensured to be consistent with the initial available connection pool, namely, the initial available connection pool is ensured to have one at the head end of the strategy connection pool, the last (M-1) x N long connections of the strategy connection pool calculate the weight of each long connection according to the response time, the success rate, the pertinence or the frequency response of each long connection, the number of long connections with large weights is increased, the number of long connections with small weights is reduced, and sequencing is performed according to the sequence of the weights from large to small, so that the strategy connection pool is updated. When the request of the client is obtained, the long connection is selected from the strategy connection pool in sequence to transmit the request, and because the strategy connection pool has more high-quality resources and less low-quality resources, the overall processing capacity of the system can be effectively improved, and the utilization rate of the high-quality resources is improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a communication device is further provided, and the communication device is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a communication device according to an embodiment of the present invention, as shown in fig. 5, which is exemplified by a communication device 500, and includes: an obtaining module 501, where the obtaining module 501 is configured to obtain a first policy connection pool, where the first policy connection pool includes multiple initial available connection pools, and the initial available connection pool includes multiple long connections; an updating module 502, where the updating module 502 is configured to update the first policy connection pool according to a first influence factor of the multiple long connections to obtain a second policy connection pool, where the first influence factor includes response time of the transmission request, success rate of the transmission request, pertinence of the transmission request, or frequency response of the transmission request, the second policy connection pool includes an initial available connection pool and a rearranged available connection pool, the initial available connection pool is located at a head end of the second policy connection pool, and the rearranged available connection pool includes multiple long connections arranged according to a preset rule; and a transmission module 503, where the transmission module 503 is configured to transmit a target request through a target long connection in the second policy connection pool, where the target request is used for communication between the client and the server.
Optionally, the obtaining module 501 is further configured to expand the initial available connection pool by M times to obtain a first policy connection pool, where M is an integer greater than 0.
Optionally, the obtaining module 501 is further configured to obtain a first request, where the first request is transmitted through a plurality of long connections; a first influencing factor for the plurality of long connections is determined based on the first request.
Optionally, the updating module 502 is further configured to update the first policy connection pool according to a preset time interval.
Optionally, the updating module 502 is further configured to obtain the first influencing factor according to a preset time interval; calculating the weight of each long connection according to a first influence factor; and updating the first strategy connection pool according to the weight of each long connection.
Optionally, the updating module 502 is further configured to update and rearrange the available connection pools according to an order in which the weight of each long connection is arranged from large to small, where the number of the first long connection is greater than the number of the second long connection, the weight of the first long connection is greater than a first weight threshold, and the weight of the second long connection is less than or equal to the first weight threshold.
Optionally, the target long connection is a long connection that is nearest to the head end of the second policy connection pool and is unused.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are located in different processors in any combination.
An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the steps of any of the above method embodiments when the computer program runs on a computer or a processor.
Alternatively, in the present embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring a first strategy connection pool;
s2, updating the first strategy connection pool according to the first influence factors of the long connections to obtain a second strategy connection pool;
and S3, transmitting the target request through the target long connection in the second strategy connection pool.
Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps of any of the above method embodiments.
Optionally, in this embodiment, the processor in the electronic device may be configured to run the computer program to perform the following steps:
s1, acquiring a first strategy connection pool;
s2, updating the first strategy connection pool according to the first influence factors of the long connections to obtain a second strategy connection pool;
and S3, transmitting the target request through the target long connection in the second strategy connection pool.
Optionally, for a specific example in this embodiment, reference may be made to the examples described in the above embodiment and optional implementation, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method of communication, comprising:
obtaining a first policy connection pool, wherein the first policy connection pool comprises a plurality of initial available connection pools, and the initial available connection pools comprise a plurality of long connections;
updating the first policy connection pool according to a first influence factor of the plurality of long connections to obtain a second policy connection pool, wherein the first influence factor includes response time of a transmission request, success rate of the transmission request, pertinence of the transmission request or frequency response of the transmission request, the second policy connection pool includes the initial available connection pool and a rearranged available connection pool, the initial available connection pool is located at a head end of the second policy connection pool, and the rearranged available connection pool includes the plurality of long connections arranged according to a preset rule;
and transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between the client and the server.
2. The method of claim 1, wherein obtaining the first policy connection pool comprises:
and expanding the initial available connection pool by M times to obtain the first strategy connection pool, wherein M is an integer larger than 0.
3. The method according to claim 1 or 2, wherein before updating the first policy connection pool according to the first influence factor of the plurality of long connections to obtain the second policy connection pool, the method further comprises:
obtaining a first request, wherein the first request is transmitted through the plurality of long connections;
determining the first contributing factors to the plurality of long connections from the first request.
4. The method of claim 1 or 2, further comprising:
and updating the first strategy connection pool according to a preset time interval.
5. The method of claim 4, wherein the updating the first policy connection pool according to the preset time interval comprises:
acquiring the first influence factor according to the preset time interval;
calculating the weight of each long connection according to the first influence factor;
and updating the first strategy connection pool according to the weight of each long connection.
6. The method of claim 5, wherein the updating the first policy connection pool according to the weight of each long connection comprises:
and updating the rearranged available connection pool according to the sequence of the weights of each long connection from large to small, wherein the number of first long connections is more than the number of second long connections, the weight of the first long connections is more than a first weight threshold, and the weight of the second long connections is less than or equal to the first weight threshold.
7. The method according to claim 1 or 2, wherein the target long connection is a long connection that is nearest to the head end of the second policy connection pool and has not been used.
8. A communications apparatus, comprising:
an obtaining module, configured to obtain a first policy connection pool, where the first policy connection pool includes a plurality of initial available connection pools, and the initial available connection pools include a plurality of long connections;
an updating module, configured to update the first policy connection pool according to a first influence factor of the multiple long connections to obtain a second policy connection pool, where the first influence factor includes response time of a transmission request, success rate of the transmission request, pertinence of the transmission request, or frequency response of the transmission request, the second policy connection pool includes the initial available connection pool and a rearranged available connection pool, the initial available connection pool is located at a head end of the second policy connection pool, and the rearranged available connection pool includes the multiple long connections arranged according to a preset rule;
and the transmission module is used for transmitting a target request through the target long connection in the second strategy connection pool, wherein the target request is used for communication between a client and a server.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform a communication method as claimed in any one of the preceding claims 1 to 7 when run on a computer or a processor.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is configured to execute the computer program to perform the communication method according to any of the preceding claims 1 to 7.
CN202211008851.1A 2022-08-22 2022-08-22 Communication method, communication apparatus, storage medium, and electronic apparatus Pending CN115396313A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211008851.1A CN115396313A (en) 2022-08-22 2022-08-22 Communication method, communication apparatus, storage medium, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211008851.1A CN115396313A (en) 2022-08-22 2022-08-22 Communication method, communication apparatus, storage medium, and electronic apparatus

Publications (1)

Publication Number Publication Date
CN115396313A true CN115396313A (en) 2022-11-25

Family

ID=84121419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211008851.1A Pending CN115396313A (en) 2022-08-22 2022-08-22 Communication method, communication apparatus, storage medium, and electronic apparatus

Country Status (1)

Country Link
CN (1) CN115396313A (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101990256A (en) * 2010-08-27 2011-03-23 中兴通讯股份有限公司 Long-connection management device and method for managing link resources of long-connection communication
US20160065421A1 (en) * 2014-09-03 2016-03-03 International Business Machines Corporation Service level agreement (sla) cognizent self-managing database connection pools in a multi-tenant environment
US20170134256A1 (en) * 2015-09-08 2017-05-11 Shenzhen Skyworth-Rgb Electronic Co., Ltd. Long connection sharing method for multi-businesses, system and device, terminal
CN107453937A (en) * 2016-06-01 2017-12-08 广州市动景计算机科技有限公司 The management method and equipment in network connection pond
CN108600349A (en) * 2018-04-11 2018-09-28 北京小米移动软件有限公司 Connection management method and device in connection pool
CN109818810A (en) * 2019-03-18 2019-05-28 深圳市网心科技有限公司 A kind of access server connection optimization method, access server and communication system
CN110289993A (en) * 2019-06-06 2019-09-27 阿里巴巴集团控股有限公司 A kind of connection pool management method, apparatus, equipment and adapting system
CN110430238A (en) * 2019-07-05 2019-11-08 中国平安财产保险股份有限公司 Long connection management method, apparatus, equipment and computer readable storage medium
US20210099530A1 (en) * 2019-09-30 2021-04-01 Oracle International Corporation Automatic connection load balancing between instances of a cluster
CN113032139A (en) * 2020-12-30 2021-06-25 瑞庭网络技术(上海)有限公司 Request processing method and device, computer readable storage medium and electronic equipment
CN113242149A (en) * 2021-05-21 2021-08-10 中国农业银行股份有限公司 Long connection configuration method, device, equipment, storage medium and program product
CN113590357A (en) * 2021-07-30 2021-11-02 未鲲(上海)科技服务有限公司 Method and device for adjusting connection pool, computer equipment and storage medium
CN113687962A (en) * 2021-08-20 2021-11-23 济南浪潮数据技术有限公司 Request processing method, device, equipment and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101990256A (en) * 2010-08-27 2011-03-23 中兴通讯股份有限公司 Long-connection management device and method for managing link resources of long-connection communication
WO2012024909A1 (en) * 2010-08-27 2012-03-01 中兴通讯股份有限公司 Long connection management apparatus and link resource management method for long connection communication
US20160065421A1 (en) * 2014-09-03 2016-03-03 International Business Machines Corporation Service level agreement (sla) cognizent self-managing database connection pools in a multi-tenant environment
US20170134256A1 (en) * 2015-09-08 2017-05-11 Shenzhen Skyworth-Rgb Electronic Co., Ltd. Long connection sharing method for multi-businesses, system and device, terminal
CN107453937A (en) * 2016-06-01 2017-12-08 广州市动景计算机科技有限公司 The management method and equipment in network connection pond
CN108600349A (en) * 2018-04-11 2018-09-28 北京小米移动软件有限公司 Connection management method and device in connection pool
CN109818810A (en) * 2019-03-18 2019-05-28 深圳市网心科技有限公司 A kind of access server connection optimization method, access server and communication system
CN110289993A (en) * 2019-06-06 2019-09-27 阿里巴巴集团控股有限公司 A kind of connection pool management method, apparatus, equipment and adapting system
CN110430238A (en) * 2019-07-05 2019-11-08 中国平安财产保险股份有限公司 Long connection management method, apparatus, equipment and computer readable storage medium
US20210099530A1 (en) * 2019-09-30 2021-04-01 Oracle International Corporation Automatic connection load balancing between instances of a cluster
CN113032139A (en) * 2020-12-30 2021-06-25 瑞庭网络技术(上海)有限公司 Request processing method and device, computer readable storage medium and electronic equipment
CN113242149A (en) * 2021-05-21 2021-08-10 中国农业银行股份有限公司 Long connection configuration method, device, equipment, storage medium and program product
CN113590357A (en) * 2021-07-30 2021-11-02 未鲲(上海)科技服务有限公司 Method and device for adjusting connection pool, computer equipment and storage medium
CN113687962A (en) * 2021-08-20 2021-11-23 济南浪潮数据技术有限公司 Request processing method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ABUBAKR MUHAMMAD: "Design of Sustainable Resource Consumption Networks", 2019 IEEE 58TH CDC *
赵克全;: "大数据背景下动态调整参数的数据库连接池性能优化研究", 淮北职业技术学院学报, no. 01 *

Similar Documents

Publication Publication Date Title
CN110336885B (en) Edge node distribution method, device, scheduling server and storage medium
CN109842508A (en) The method that multiple terminals cooperates, terminal device and multiple terminals cooperative system
CN104052803A (en) Decentralized distributed rendering method and system
CN105630587A (en) Method, device and system for migrating application program data between terminals
CN102713871A (en) Client-server system
CN110268751A (en) Method and system for selection access and mobile management function to ps domain in access net environment
CN109889576A (en) A kind of mobile cloud game method for optimizing resources based on game theory
US20140258703A1 (en) Adaptive data synchronization
CN112596768B (en) Updating method and device of equipment, storage medium and electronic device
CN110928645B (en) Server maintenance method and device, storage medium, processor and electronic device
CN107911547A (en) Interactive system, the method for interface layout
CN111338787B (en) Data processing method and device, storage medium and electronic device
CN109299249A (en) Ask-Answer Community exchange method, device, terminal device and computer storage medium
CN107222618A (en) Terminal screenshotss method and device
CN114237896A (en) Distributed node resource dynamic scheduling method and device
CN109302302B (en) Method, system and computer readable storage medium for scaling service network element
CN105472748A (en) Wireless network resource distribution method and device of mobile terminal
CN106357865B (en) Delete the method and system of contact information
CN115396313A (en) Communication method, communication apparatus, storage medium, and electronic apparatus
CN109240790B (en) Multi-window management method and system and android terminal
CN106330504B (en) Method for realizing application and service controller
CA2833346C (en) Reducing latency for served applications by anticipatory preprocessing
RU2522995C2 (en) Method and apparatus for creating peer-to-peer group in peer-to-peer application and method of using peer-to-peer group
CN114710496A (en) Multi-node load balancing method and device
CN114598654A (en) Content delivery network CDN-based flow equalization processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination