Connection optimization method, device, computing equipment and computer storage medium
By determining and adjusting the connection level between the client and the server, and dynamically managing resource allocation, the problem of WebSocket connection resource consumption was solved, the server-side connection management was optimized, and the efficiency and user experience of the voice translation service were improved.
Patent Information
- Application Number
- CN202111061344.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-09-10
AI Technical Summary
In voice translation scenarios, WebSocket connections consume server resources, leading to limited resources and an inability to establish new connections, thus affecting server-side connection optimization.
By determining the connection level between the client and the server, adjusting the connection level based on the connection idle rate, and dynamically adjusting the allocation of server resources, connection management is optimized.
It achieves reasonable allocation of server-side resources, reduces unnecessary resource consumption, provides a better voice translation service experience, supports more users, and saves bandwidth and memory resources.
Smart Images

Figure CN113783728B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a connection optimization method, device, computing equipment and computer storage medium. Background Art
[0002] At present, voice translation is widely used. For example, in some special meetings, the Chinese and foreign language translation function is needed to assist the communication between the two parties. In the meeting scenario, since the voice translation function needs to be used for a long time, in order to save time and resource consumption when the server and the client establish and disconnect the connection, WebSocket long connection is generally used to transmit the content of voice translation.
[0003] WebSocket is a protocol for full-duplex communication over a single TCP connection. The client and server only need to complete a handshake to directly create a persistent connection between the two and perform two-way data transmission. The client connected via WebSocket can continuously send voice data to the server in real time, and the server can also push audio translation text to the client in a timely manner.
[0004] However, each WebSocket connection will occupy a certain amount of server resources. The total resources of the server are limited. When the number of WebSocket connections reaches a certain number, new connections cannot be established. Therefore, a solution is needed to optimize the connection. Summary of the invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide a connection optimization method, apparatus, computing device, and computer storage medium that overcome the above problems or at least partially solve the above problems.
[0006] According to one aspect of an embodiment of the present invention, a connection optimization method is provided, including:
[0007] Determine the level of the connection between the client and the server; the level of the connection is related to the connection idle rate;
[0008] When a level adjustment condition for the connection occurs, adjusting the level of the connection to obtain an adjusted level of the connection;
[0009] Based on the adjusted connection level, the server adjusts the resources allocated to the connection.
[0010] According to another aspect of an embodiment of the present invention, a connection optimization device is provided, including:
[0011] A determination module, adapted to determine the level of the connection between the client and the server; the level of the connection is associated with the size of the connection idle rate;
[0012] A level adjustment module, adapted to adjust the level of the connection when a level adjustment condition for the connection occurs, so as to obtain an adjusted level of the connection;
[0013] The resource adjustment module is adapted to adjust the resources allocated to the connection by the server based on the adjusted level of the connection.
[0014] According to another aspect of an embodiment of the present invention, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0015] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above connection optimization method.
[0016] According to another aspect of the embodiments of the present invention, a computer storage medium is provided, in which at least one executable instruction is stored, and the executable instruction enables a processor to perform operations corresponding to the above connection optimization method.
[0017] According to the solution provided by the above-mentioned embodiment of the present invention, it is possible to monitor and dynamically manage all connections on the server in real time, remove invalid requests, optimize inefficient requests, save resources such as bandwidth and memory on the client and server, and provide voice translation services to more users with existing server resources. By reducing unnecessary resource consumption on the server, users who really need voice translation services can have a better service experience.
[0018] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation method of the embodiment of the present invention is specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the embodiments of the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0020] Figure 1 A flow chart of a connection optimization method provided by an embodiment of the present invention is shown;
[0021] Figure 2 A flow chart of a connection optimization method provided by another embodiment of the present invention is shown;
[0022] Figure 3 A schematic diagram showing the structure of a connection optimization device provided by an embodiment of the present invention is shown;
[0023] Figure 4 A schematic diagram of the structure of a computing device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0025] Figure 1 FIG. 1 is a flow chart showing a connection optimization method provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0026] Step S101, determining the level of the connection between the client and the server; the level of the connection is associated with the connection idle rate.
[0027] When a user wants to use the speech translation service, the user can initiate a connection request through the client, and a connection will be established between the client and the server. In order to achieve connection optimization, this step needs to determine the level of the connection between the client and the server. Different connections have different levels. The level of the connection is related to the connection idle rate. The connection idle rate reflects the degree of connection idleness. For example, the higher the connection idle rate, the lower the level of the connection; the lower the connection idle rate, the higher the level of the connection.
[0028] Step S102: When a condition for adjusting the level of the connection occurs, the level of the connection is adjusted to obtain an adjusted level of the connection.
[0029] The connection level adjustment condition specifically refers to the condition that needs to be met to adjust the level of the connection. The connection level adjustment condition may include: the resource occupancy rate of the server is greater than or equal to the preset resource occupancy rate upper limit; or the resource occupancy rate of the server is less than the preset resource occupancy rate lower limit. The preset resource occupancy rate upper limit can be expressed as F st Indicates that F st The value is the average value of the value obtained by testing in 1 minute under 1000 idle environments. The preset resource utilization lower limit can be used sd Indicates that F sd The value is the average of 1000 values obtained from 1 minute of testing under low load conditions.
[0030] The server resource utilization rate reflects the current server resource utilization situation. For example, the server resource utilization rate can be calculated based on the server resource information. The server resource information includes: thread CPU utilization time, server CPU load, number of full collections, number of new generation garbage collections, full collection time, new generation garbage collection time, and system startup time.
[0031] Specifically, the server resource occupancy rate F can be calculated according to the following formula:
[0032] F = (thread CPU usage time / CPU usage time benchmark value) * a1 + (server CPU load) * b1 + (full collection times / new generation garbage collection times) * c1 + ((full collection time + new generation garbage collection time) / system startup time) * d1
[0033] Among them, a1+b1+c1+d1=1, a1, b1, c1, d1 can be adjusted to different values according to different server conditions;
[0034] Full GC specifically refers to when the JVM runs out of space in the old generation and cannot put in more objects, it executes GC to collect garbage in the old generation, which is called Full GC.
[0035] Young GC specifically refers to the JVM triggering garbage collection when the Eden area of the new generation is full, which is called Young GC;
[0036] The number of full collections and new generation garbage collections is the number of GCs from the start of the server to the current time.
[0037] The time taken for full collection and new generation garbage collection is the time taken from the server startup to the current GC time. The time units involved in the formula are all seconds.
[0038] When the above conditions occur, the connection level needs to be adjusted to obtain the adjusted connection level. For example, the connection level can be divided into level 0, level 1, level 2, and level 3, and level 0 corresponds to disconnected connection. Of course, other division methods can also be used, such as level A, level B, level C, and level D, where level A is the highest and level D is the lowest. Level D corresponds to disconnected connection. When adjusting the level, the connection level can be adjusted from level A to level C, and from level C to level D. This is only an example and does not have any limiting effect.
[0039] Step S103: adjusting the resources allocated to the connection by the server based on the adjusted level of the connection.
[0040] After completing the connection level adjustment, the server resources allocated to the connection can be adjusted based on the adjusted connection level. The server resources that can be used by connections of different levels are different. The higher the connection level, the more server resources can be used. For example, the highest level connection can use the server resources normally. As the connection level decreases, the server resources that can be used by the connection gradually decrease. For example, the A-level connection can use the server resources normally, the B-level connection can only use 50% of the normal server resources, and the C-level connection can only use 10% of the normal server resources. In other words, the server resources that can be used by the B-level connection and the C-level connection are restricted accordingly, so as to support the establishment of more connections.
[0041] In an optional embodiment of the present invention, the connection is used to transmit relevant data of simultaneous interpretation; the relevant data includes at least one of audio data to be translated and a translation result;
[0042] Therefore, the connection level can also be adjusted by the following method: adjusting the connection level according to the invalid transmission of relevant data to obtain an adjusted connection level; wherein the invalid transmission of relevant data includes: failure to transmit valid relevant data.
[0043] When the relevant data include audio data to be translated, the invalid transmission situation specifically refers to the situation where the connection transmits some useless voice (such as background sound when no one is talking), inefficient voice (such as intermittent noise), or the connection does not transmit valid audio data to be translated; when the relevant data include translation results, the invalid transmission situation of the relevant data includes at least one of the following: the transmitted translation result is a non-empty meaningless string, and the transmitted translation result is an empty string.
[0044] The invalid transmission of relevant data reflects the idleness of the connection. Therefore, the level of the connection is adjusted according to the invalid transmission of relevant data, and the server resources allocated to the connection are guided according to the adjusted level to achieve reasonable allocation of server resources to support the establishment of more connections.
[0045] In an optional implementation of the present invention, in the case where the relevant data includes audio data to be translated, the level of connection can be adjusted by the following method:
[0046] The statistical duration of the connection not transmitting valid audio data to be translated sent by the client after it is used to transmit relevant data of simultaneous interpretation;
[0047] Determine the connection idle rate corresponding to the connection based on the statistical duration and the resource usage of the server;
[0048] The level of the connection is adjusted according to the connection idle rate to obtain an adjusted level of the connection.
[0049] In actual application scenarios, the client may be suspended or the network may be interrupted. When the above situation occurs, the connection cannot transmit the valid audio data to be translated sent by the client. In order to optimize the connection and save server resources, it is necessary to count the statistical duration of the connection after it is used to transmit the relevant data of simultaneous interpretation, and calculate the connection idle rate every 5 seconds. The preset time interval is the connection idle rate calculation interval, 5 seconds. This is just an example and does not have any limiting effect. According to the statistical duration and the server resource occupancy rate, The statistical duration and the resource occupancy rate of the server are used to determine the connection idle rate corresponding to the connection; specifically, the connection idle rate can be calculated using the following formula: S = S1*W*F / F0, where W = statistical duration / connection idle rate calculation interval duration, where the connection idle rate calculation interval duration is set according to actual needs, for example, the connection idle rate calculation interval duration is set to 5 seconds, the duration unit is seconds, F is the server resource occupancy rate, which reflects the server resource occupancy at the moment of calculating the connection idle rate; F0 is the benchmark server resource occupancy rate, and F0 is the average of 1000 random calculations of the server resource occupancy rate F value. S1 is the last connection idle rate. After determining the connection idle rate corresponding to the connection, the level of the connection can be adjusted according to the connection idle rate to obtain the adjusted connection level.
[0050] In an optional embodiment of the present invention, the relevant data includes translation results;
[0051] The invalid transmission of relevant data includes at least one of the following: the transmitted translation result is a non-empty meaningless character string, and the transmitted translation result is an empty character string.
[0052] Therefore, according to the situation of invalid transmission of relevant data, the level of the connection is adjusted to obtain the adjusted level of the connection, including: determining the connection idle rate corresponding to the connection according to whether invalid transmission of relevant data occurs and / or whether invalid transmission of relevant data occurs continuously; and adjusting the level of the connection according to the connection idle rate to obtain the adjusted level of the connection.
[0053] The server receives the audio data sent by the client, performs normal speech translation processing on the audio data, and generates the corresponding translation result. After generating the translation result, the server scores the connection pair based on the translation result through the connection idle rate algorithm to determine whether the connection is idle and the degree of idleness. When the timed time interval is reached, the priority of all current connections is scored and the connections are graded, for example, divided into three levels, ABC.
[0054] Optionally, determining a connection idle rate corresponding to a connection according to whether invalid transmission of relevant data occurs and / or whether invalid transmission of relevant data occurs continuously includes:
[0055] S0, performing word segmentation processing on the translation result to obtain at least one word segmentation;
[0056] S1, assign the connection idle benchmark score to the connection idle rate;
[0057] S2, selecting a participle that has not been selected from at least one participle;
[0058] S3, if the segmented word is an empty string, perform the first scoring process on the connection idle rate and jump to S7;
[0059] S4, if the segmented word is a meaningless string, the connection idle rate is deducted and the process jumps to S7;
[0060] S5, determine whether the last selected word segmentation is a meaningless string, if so, execute S6; if not, execute S7;
[0061] S6, performing a second scoring process on the connection idle rate, and jumping to S7;
[0062] S7, using the selected participle to overwrite the last selected participle;
[0063] S8, determine whether at least one word has been selected; if so, execute S9; if not, jump to S2;
[0064] S9, determining a connection idle rate corresponding to the connection.
[0065] After obtaining the translation result, the translation result can be segmented to obtain at least one segmented word. For example, the translation result can be segmented based on a string matching method, a comprehension-based method, a statistics-based method, etc. Those skilled in the art can select a method according to their needs, or use a combination of multiple methods.
[0066] Specifically, the audio data to be translated sent by the client may include some useless speech (such as background sound when no one is talking) and / or inefficient speech (such as only intermittent noise during the entire connection process). After translating these speech data, the translation result may contain empty strings or meaningless characters or words. In order to accurately determine the connection idle rate of the connection, it is necessary to match the translation result with the empty string, meaningless characters or words to add or subtract points to the connection idle rate.
[0067] For example, firstly, the translation result is segmented to obtain at least one segmentation, and a segmentation that has not been selected is selected from the at least one segmentation, and it is determined whether the selected segmentation is an empty string. If so, S is added. e Otherwise, determine whether it is a meaningless string. If not, subtract S f If it is a meaningless string, then judge according to the last selected word segmentation to determine whether the last selected word segmentation is a meaningless string. If the last selected word segmentation is also a meaningless string, add S g The above steps are repeated until at least one word segment has been selected, and the final connection idle rate is obtained. It should be noted that in this embodiment, a character library of meaningless strings is pre-established. When judging whether it is a meaningless string, the selected word segment is matched with the character library of the meaningless string. If the selected word segment exists in the character library of the meaningless string, it means that the selected word segment is a meaningless string, otherwise, it is not a meaningless string.
[0068] Optionally, performing the first scoring process on the connection idle rate may be implemented by the following method:
[0069] Count the first number of times that the selected word segment is a consecutive empty string; wherein the first number of times is the number of times that the selected word segment is a consecutive empty string, and calculate the first bonus value according to the first number of times and the server resource occupancy rate, for example, according to the following formula S e =e0*ln(first statistical number of times)*F / F0 to calculate the first added value S e ; According to the first bonus value, a first bonus processing is performed on the connection idle rate.
[0070] Optionally, the deduction of the connection idle score may be implemented by the following method:
[0071] The second statistical number of times the selected word is not a meaningless string, the third statistical number of times the selected word is an empty string, and the fourth statistical number of times the last selected word is a meaningless string are counted; the deduction value is calculated according to the second statistical number, the third statistical number, and the fourth statistical number; for example, the deduction value can be calculated according to the following formula: S f =f0*(third statistical number+fourth statistical number) / (second statistical number+third statistical number+fourth statistical number), and the connection idle rate is deducted according to the deduction value.
[0072] Optionally, performing the second scoring process on the connection idle points may be implemented by the following method:
[0073] The fifth statistical number of times the segmentation selected last time is a meaningless string is counted; wherein the fifth statistical number is the number of times the segmentation selected this time and the segmentation selected last time are both meaningless strings. The second bonus value is calculated based on the fifth statistical number and the server resource occupancy rate. For example, the second bonus value can be calculated based on the following formula S g =g0*ln(fifth statistical number)*F / F0 to calculate the second added value S g , according to the second bonus value, a second bonus processing is performed on the connection idle rate.
[0074] Among them, F is the server resource occupancy rate, F0 is the benchmark server resource occupancy rate, and e0, f0, and g0 are the initial values of the scores of the three situations initially set.
[0075] In an optional implementation manner of the present invention, adjusting the connection level according to the connection idle rate to obtain the adjusted connection level can be further achieved by the following method:
[0076] The connection idle rate corresponding to the connection is matched with the connection idle rate interval corresponding to each level to obtain the adjusted level of the connection.
[0077] Specifically, the connection idle rate intervals corresponding to the levels are preset. For ease of understanding, the connection levels are divided into A, B, C, and D levels for explanation, and the above levels decrease step by step.
[0078] Class A: Class A has the highest priority. Usually, the initial level of a newly created connection is Class A, and connections with a score lower than M are classified as Class A. Class A connections can use server resources normally.
[0079] Class B: When the connection idle rate is less than T points and greater than or equal to M points, the connection is classified as Class B. Class B can only use 50% of the resources of the connection in the Class A case.
[0080] Class C: When the connection idle rate is greater than or equal to T points, the connection is classified as Class C. Class C can only use 10% of the resources of the connection in Class A.
[0081] Class D: When the connection is disconnected, the connection is classified as Class D. T and M are fixed values, and M is smaller than T.
[0082] Specifically, after calculating the connection idle rate corresponding to the connection, the level corresponding to the connection can be determined by comparing the connection idle rate with the values of T and M. When the connection idle rate S of the connection is greater than or equal to T, the level of the connection is classified as C and is in an idle and recyclable state. When the server needs to select some idle connections to disconnect and release server resources, it can select the connection. After the connection is disconnected, the level of the connection is adjusted from C to D; when the connection idle rate S of the connection is greater than or equal to M and less than T, the level of the connection is classified as B; when the connection idle rate S of the connection is less than M, the level of the connection is classified as A.
[0083] Figure 2 FIG. 2 is a flow chart of a connection optimization method provided by another embodiment of the present invention. In this embodiment, the connection levels are divided into ABCD levels, and level D corresponds to disconnection. Figure 2 As shown, the method comprises the following steps:
[0084] Step S201, the client initiates a connection request, the server receives the request and establishes a connection. After the connection is established, the data of the connection is added to the connection data maintained by the server, and the connection level is now A.
[0085] Step S202: Calculate the current server resource occupancy rate F and determine whether the server resource occupancy rate F is greater than or equal to a preset resource occupancy rate upper limit F. st .
[0086] The server resource utilization rate F can be calculated according to the following formula:
[0087] F = (thread CPU usage time / CPU usage time benchmark value) * a1 + (server CPU load) * b1 + (full collection times / new generation garbage collection times) * c1 + ((full collection time + new generation garbage collection time) / system startup time) * d1
[0088] Among them, a1+b1+c1+d1=1, and a1, b1, c1, and d1 can be adjusted to different values according to different server conditions.
[0089] Step S203: If the server resource occupancy rate F is greater than or equal to F st When the UPS is connected to the C-level, it is determined whether there is a C-level connection.
[0090] Here, judging whether there is a C-level connection is to judge whether there is an idle connection that can be released immediately.
[0091] Step S204: if there is a Class C connection, disconnect the Class C connection to release the server resources occupied by the Class C connection.
[0092] In step S205, if there is no Class C connection, the class of 50% of the Class A connections with a higher connection idle rate is adjusted to Class B. By downgrading some connections, some resources on the server are freed up.
[0093] If there are no Class C connections, in order to free up some of the server's connection resources, some connections need to be downgraded. For example, 50% of the Class A connections with a higher idle rate are classified as Class B, which implements the downgrade of the connection level to dynamically adjust the server's resources and free up some of the server's resources. It should be noted that Class A can use the server's resources normally; Class B can only use 50% of the resources of the connection in Class A; Class C can only use 10% of the resources of the connection in Class A. Therefore, releasing Class C connections or downgrading Class A connections to Class B connections can free up some of the server's resources.
[0094] Step S206: If the server resource occupancy rate F is less than F st , determine whether the server resource occupancy rate F is less than F sd .
[0095] Step S207: If the server resource occupancy rate F is less than the preset resource occupancy rate lower limit F sd , then determine whether there is a Class B connection.
[0096] Step S208: if there are Class B connections, then 10% of the connections are adjusted from Class B to Class A in order from low to high according to the idle rate of the connections, and the process jumps to Step S206 until the server resource occupancy rate F is greater than or equal to F. sd Or until the connection of level B is empty.
[0097] Step S209: If there is no Class B connection, or the server resource occupancy rate F is greater than or equal to the preset resource occupancy rate lower limit F sd , then receive the connection and notify the client to send audio data.
[0098] The solution provided by the present invention can monitor and dynamically manage all connections on the server side in real time, remove invalid requests, optimize inefficient requests, save resources such as bandwidth and memory on the client and server sides, and provide voice translation services to more users under the existing server side resources. By reducing unnecessary resource consumption on the server side, users who really need voice translation services can have a better service experience.
[0099] Figure 3 FIG. 2 shows a schematic diagram of the structure of a connection optimization device provided by an embodiment of the present invention. Figure 3 As shown, the device includes: a determination module 301, a level adjustment module 302, and a resource adjustment module 303.
[0100] The determination module 301 is adapted to determine the level of the connection between the client and the server; the level of the connection is associated with the connection idle rate;
[0101] The level adjustment module 302 is adapted to adjust the level of the connection when a level adjustment condition for the connection occurs, so as to obtain an adjusted level of the connection;
[0102] The resource adjustment module 303 is adapted to adjust the resources allocated to the connection by the server based on the adjusted level of the connection.
[0103] Optionally, the level adjustment condition for the connection includes:
[0104] The resource utilization rate of the server is greater than or equal to the preset resource utilization rate upper limit; or,
[0105] The resource usage of the server is less than the preset lower limit of resource usage.
[0106] Optionally, the connection is used to transmit relevant data of simultaneous interpretation; the relevant data includes at least one of audio data to be translated and a translation result;
[0107] The level adjustment module is further adapted to: adjust the level of the connection according to the invalid transmission of the relevant data to obtain an adjusted level of the connection;
[0108] Invalid transmission of relevant data, including: failure to transmit valid relevant data.
[0109] Optionally, related data, including audio data to be translated;
[0110] The level adjustment module is further adapted to: calculate the statistical duration of the connection not transmitting the valid audio data to be translated sent by the client after the connection is used to transmit the relevant data of simultaneous interpretation;
[0111] Determine the connection idle rate corresponding to the connection based on the statistical duration and the resource usage of the server;
[0112] The level of the connection is adjusted according to the connection idle rate to obtain an adjusted level of the connection.
[0113] Optionally, related data, including translation results;
[0114] The invalid transmission of relevant data includes at least one of the following:
[0115] The transmitted translation result is a non-empty meaningless string;
[0116] The translated result transmitted is an empty string.
[0117] Optionally, the level adjustment module is further adapted to: determine a connection idle rate corresponding to the connection according to whether invalid transmission of relevant data occurs, and / or whether invalid transmission of relevant data occurs continuously;
[0118] The level of the connection is adjusted according to the connection idle rate to obtain an adjusted level of the connection.
[0119] Optionally, the level adjustment module is further adapted to: S0, perform word segmentation processing on the translation result to obtain at least one word segmentation;
[0120] S1, assign the connection idle benchmark score to the connection idle rate;
[0121] S2, selecting a participle that has not been selected from at least one participle;
[0122] S3, if the segmented word is an empty string, perform the first scoring process on the connection idle rate and jump to S7;
[0123] S4, if the segmented word is a meaningless string, the connection idle rate is deducted and the process jumps to S7;
[0124] S5, determine whether the last selected word segmentation is a meaningless string, if so, execute S6; if not, execute S7;
[0125] S6, performing a second scoring process on the connection idle rate, and jumping to S7;
[0126] S7, using the selected participle to overwrite the last selected participle;
[0127] S8, determine whether at least one word has been selected; if so, execute S9; if not, jump to S2;
[0128] S9, determining a connection idle rate corresponding to the connection.
[0129] Optionally, the level adjustment module is further adapted to: count a first number of times that the selected segmented words are consecutive empty strings;
[0130] A first bonus value is calculated according to the first statistical number and the server resource occupancy rate;
[0131] A first scoring process is performed on the connection idle rate according to the first scoring value.
[0132] Optionally, the level adjustment module is further adapted to: count a second number of times that the selected segmentation is not a meaningless string, a third number of times that the selected segmentation is an empty string, and a fourth number of times that the last selected segmentation is a meaningless string;
[0133] The deduction value is calculated according to the second statistical number, the third statistical number and the fourth statistical number;
[0134] The connection idle points are deducted according to the deduction value.
[0135] Optionally, the level adjustment module is further adapted to: count the fifth number of times that the segmented words selected last time are consecutively meaningless character strings;
[0136] A second bonus value is calculated based on the fifth statistical number and the server resource occupancy rate;
[0137] A second scoring process is performed on the connection idle rate according to the second scoring value.
[0138] The solution provided by the present invention can monitor and dynamically manage all connections on the server side in real time, remove invalid requests, optimize inefficient requests, save resources such as bandwidth and memory on the client and server sides, and provide voice translation services to more users under the existing server side resources. By reducing unnecessary resource consumption on the server side, users who really need voice translation services can have a better service experience.
[0139] An embodiment of the present invention provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the connection optimization method in any of the above method embodiments.
[0140] Figure 4 A schematic diagram of the structure of a computing device provided by an embodiment of the present invention is shown, and the specific embodiment of the present invention does not limit the specific implementation of the computing device.
[0141] like Figure 4 As shown, the computing device may include: a processor, a communications interface, a memory, and a communication bus.
[0142] Wherein: the processor, the communication interface, and the memory communicate with each other via a communication bus. The communication interface is used to communicate with network elements of other devices such as a client or other servers. The processor is used to execute a program, and specifically can execute the relevant steps in the above-mentioned embodiment of the connection optimization method for a computing device.
[0143] Specifically, the program may include program codes including computer operation instructions.
[0144] The processor may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0145] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0146] The program can be specifically used to enable the processor to execute the connection optimization method in any of the above method embodiments. The specific implementation of each step in the program can refer to the corresponding description in the corresponding steps and units in the above connection optimization embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, which will not be repeated here.
[0147] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the embodiment of the present invention described herein, and the description of the above specific language is to disclose the best mode of the embodiment of the present invention.
[0148] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0149] Similarly, it should be understood that in order to streamline the embodiments of the present invention and to aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: that the claimed embodiments of the present invention require more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the single embodiment disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.
[0150] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0151] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0152] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present invention. The embodiments of the present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing an embodiment of the present invention may be stored on a computer-readable medium, or may have the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0153] It should be noted that the above embodiments illustrate rather than limit the present invention, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim listing a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A connection optimization method, comprising: Determine the level of connection between the client and the server; The level of the connection is associated with the connection idle rate of the connection, wherein the higher the connection idle rate of the connection, the lower the level of the connection; and the lower the connection idle rate of the connection, the higher the level of the connection; When a level adjustment condition for the connection occurs, adjust the level of the connection to obtain an adjusted level of the connection, wherein the level adjustment condition for the connection includes: the resource occupancy rate of the server is greater than or equal to a preset resource occupancy rate upper limit; or the resource occupancy rate of the server is less than a preset resource occupancy rate lower limit; Based on the adjusted level of the connection, the resources allocated by the server to the connection are adjusted, wherein the higher the level of the connection, the more server resources can be used.
2. The method according to claim 1, characterized in that The connection is used to transmit relevant data of simultaneous interpretation; the relevant data includes at least one of audio data to be translated and translation results; The step of adjusting the level of the connection to obtain an adjusted level of the connection includes: According to the invalid transmission of the relevant data, the level of the connection is adjusted to obtain an adjusted level of the connection; The invalid transmission of the relevant data includes: failure to transmit valid relevant data.
3. The method according to claim 2, wherein: The relevant data includes audio data to be translated; According to the invalid transmission of the relevant data, adjusting the level of the connection to obtain an adjusted level of the connection includes: Counting the statistical length of time during which the connection does not transmit the valid audio data to be translated sent by the client after being used to transmit the relevant data for simultaneous interpretation; Determine the connection idle rate corresponding to the connection according to the statistical duration and the resource occupancy rate of the server; The level of the connection is adjusted according to the connection idle rate to obtain an adjusted level of the connection.
4. The method according to claim 2, wherein: The relevant data includes the translation result; The invalid transmission of the relevant data includes at least one of the following: The translation result transmitted is a non-empty meaningless character string; The translation result transmitted is an empty string.
5. The method according to claim 4, wherein: According to the invalid transmission of the relevant data, adjusting the level of the connection to obtain an adjusted level of the connection includes: Determine a connection idle rate corresponding to the connection according to whether invalid transmission of the relevant data occurs and / or whether invalid transmission of the relevant data occurs continuously; The level of the connection is adjusted according to the connection idle rate to obtain an adjusted level of the connection.
6. The method according to claim 5, wherein: Determining the connection idle rate corresponding to the connection according to whether invalid transmission of the relevant data occurs and / or whether invalid transmission of the relevant data occurs continuously includes: S0, performing word segmentation processing on the translation result to obtain at least one word segmentation; S1, assign the connection idle benchmark score to the connection idle rate; S2, selecting a participle that has not been selected from the at least one participle; S3, if the segmented word is an empty string, perform the first scoring process on the connection idle rate and jump to S7; S4, if the segmented word is a meaningless string, the connection idle rate is deducted and the process jumps to S7; S5, determine whether the last selected word segmentation is a meaningless string, if so, execute S6; if not, execute S7; S6, performing a second scoring process on the connection idle rate, and jumping to S7; S7, using the selected participle to overwrite the last selected participle; S8, determine whether at least one word has been selected; if so, execute S9; if not, jump to S2; S9, determining a connection idle rate corresponding to the connection.
7. The method according to claim 6, wherein: The first scoring process for the connection idle rate includes: Count the first times that the selected word is a consecutive empty string; A first bonus value is calculated based on the first statistical number of times and the server resource occupancy rate; A first scoring process is performed on the connection idle rate according to the first scoring value.
8. The method according to claim 6 or 7, wherein: The deduction of the connection idle rate includes: Count the second number of times the selected word is not a meaningless string, the third number of times the selected word is an empty string, and the fourth number of times the last selected word is a meaningless string; Calculate the deduction value according to the second statistical number, the third statistical number and the fourth statistical number; According to the deduction value, the connection idle points are deducted.
9. The method according to claim 6 or 7, wherein: The performing a second scoring process on the connection idle rate includes: Count the fifth number of times the last selected word is a meaningless string; A second bonus value is calculated based on the fifth statistical number of times and the server resource occupancy rate; A second scoring process is performed on the connection idle rate according to the second scoring value.
10. A connection optimization device, comprising: a determination module adapted to determine a level of connection between a client and a server; The level of the connection is associated with the connection idle rate of the connection, wherein the higher the connection idle rate of the connection, the lower the level of the connection; and the lower the connection idle rate of the connection, the higher the level of the connection; A level adjustment module, adapted to adjust the level of the connection when a level adjustment condition for the connection occurs, so as to obtain an adjusted level of the connection, wherein the level adjustment condition for the connection includes: the resource occupancy rate of the server is greater than or equal to a preset resource occupancy rate upper limit; or the resource occupancy rate of the server is less than a preset resource occupancy rate lower limit; The resource adjustment module is adapted to adjust the resources allocated by the server to the connection based on the adjusted level of the connection, wherein the higher the level of the connection, the more server resources can be used.
11. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the connection optimization method according to any one of claims 1-9.
12. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and wherein the executable instruction enables a processor to execute operations corresponding to the connection optimization method according to any one of claims 1 to 9.
