Data transmission method and apparatus, electronic device, and storage medium

By monitoring server concurrency and controlling the transmission speed of a single session, the problem of unreasonable allocation of network device bandwidth resources was solved, thus achieving rational utilization of network resources and improved user experience.

CN116366638BActive Publication Date: 2025-11-04BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310440729.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-21
Publication Date
2025-11-04
Estimated Expiration
2043-04-21

AI Technical Summary

Technical Problem

In existing technologies, network devices have a coarse control granularity when allocating network bandwidth resources, which leads to reduced transmission speeds in some IT systems, poor user experience, and low network resource utilization.

Method used

By monitoring the server's concurrency, the transmission speed of a single session is controlled to ensure that each session is transmitted at the current maximum transmission speed, thus avoiding a single session consuming too much bandwidth resources.

Benefits of technology

This achieves the rational use of network bandwidth resources, improves user experience and transmission efficiency, and avoids situations where some requests consume most of the bandwidth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116366638B_ABST
    Figure CN116366638B_ABST
Patent Text Reader

Abstract

The application provides a data transmission method and device, electronic equipment and storage medium, which can be used in the financial field or other fields. The method comprises the following steps: a server receives a data transmission request from a client, and judges whether the current actual concurrency is equal to the current maximum concurrency. If the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at the current single-session maximum transmission speed. When the target file transmission is completed, the current actual concurrency is reduced by 1. The method provided by the application embodiment is beneficial to balancing the network bandwidth resources occupied by each data transmission request, avoiding the case that a small part of requests occupy most of the bandwidth resources, improving the user experience, and realizing the rational utilization of network bandwidth resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the financial field or other fields, and in particular to a data transmission method, apparatus, electronic device and storage medium. Background Technology

[0002] Typically, enterprise internal cross-regional network bandwidth resources are limited, and multiple IT (Internet Technology) systems usually share these network resources. In order to avoid a single IT system consuming too much network bandwidth resources when transferring large amounts of files across regions, thereby making other IT systems unavailable, it is necessary to control the transmission speed on the IT system with large file transfer needs to ensure the availability of other IT systems.

[0003] In existing technologies, transmission speed is typically controlled by allocating bandwidth resources to various IT systems through network devices. While this ensures the availability of each IT system, the control granularity is relatively coarse, only enabling control over the overall transmission speed of a single IT system. If the network resource control strategy pre-allocated by the network device is unreasonable, allocating more bandwidth resources to IT systems with lower current session and data transmission volumes will lead to reduced smoothness in other IT systems with higher current session and data transmission volumes, resulting in a poor user experience and low utilization of network resources. Summary of the Invention

[0004] This application provides a data transmission method, apparatus, electronic device, and storage medium to solve the technical problem of low network resource utilization caused by the inability of network devices to reasonably allocate network bandwidth resources in the prior art.

[0005] In a first aspect, this application provides a data transmission method applied to a server, the method comprising: receiving a data transmission request from a client, the data transmission request being used to request the transmission of a target file; determining whether the current actual concurrency is equal to the current maximum concurrency, the concurrency being the number of data transmission requests processed simultaneously by the server; if the current actual concurrency is less than the current maximum concurrency, increasing the current actual concurrency by 1, and performing rate-limited transmission of the target file according to the current maximum transmission speed per session; and when the transmission of the target file ends, decreasing the current actual concurrency by 1.

[0006] Secondly, this application provides a data processing apparatus, comprising: a transceiver module for receiving a data transmission request from a client, the data transmission request being used to request the transmission of a target file; a processing module for determining whether the current actual concurrency is equal to the current maximum concurrency, the concurrency being the number of data transmission requests processed simultaneously by the apparatus; and, if the current actual concurrency is less than the current maximum concurrency, increasing the current actual concurrency by 1 and performing rate-limited transmission of the target file according to the current maximum transmission speed per session; and when the transmission of the target file ends, decreasing the current actual concurrency by 1.

[0007] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect.

[0008] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect.

[0009] Fifthly, this application provides a computer program product, comprising: a computer program (also referred to as code or instructions), which, when executed, causes the computer to perform the aforementioned first aspect.

[0010] This application provides a data transmission method, apparatus, electronic device, and storage medium. The method includes: a server receiving a data transmission request from a client and determining whether the current actual concurrency is equal to the current maximum concurrency. If the current actual concurrency is less than the current maximum concurrency, the server increases the current actual concurrency by 1 and performs rate-limited transmission of the target file according to the current maximum transmission speed for a single session. When the transmission of the target file ends, the server decreases the current actual concurrency by 1. The method provided in this application, by controlling the server's current actual concurrency to ensure it does not exceed the current maximum concurrency, and simultaneously rate-limiting the transmission of the target file according to the current maximum transmission speed for a single session, ensures that a single session does not consume excessive network bandwidth resources. This allows each session to transmit the target file at the highest average speed not exceeding the current maximum transmission speed for a single session. This helps to balance the network bandwidth resources occupied by various data transmission requests, avoiding a situation where a small number of requests consume most of the bandwidth resources, thus improving user experience and promoting the rational utilization of network bandwidth resources. Attached Figure Description

[0011] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0012] Figure 1 This is a schematic diagram illustrating the application scenario to which this application applies;

[0013] Figure 2 A schematic flowchart illustrating a data transmission method provided in an embodiment of this application;

[0014] Figure 3 A schematic flowchart illustrating another data transmission method provided in an embodiment of this application;

[0015] Figure 4 A schematic flowchart illustrating another data transmission method provided in an embodiment of this application;

[0016] Figure 5 A schematic flowchart illustrating a data transmission method provided in an embodiment of this application;

[0017] Figure 6 A schematic block diagram of a data transmission device provided in an embodiment of this application;

[0018] Figure 7 This is a schematic block diagram of an electronic device provided in an embodiment of this application.

[0019] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0020] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0021] It should be noted that the data transmission method, apparatus, electronic device and storage medium provided in this application can be used in the financial field, or in any field other than the financial field. This application does not limit the application field.

[0022] Network bandwidth refers to the amount of data that can be transmitted per unit of time. A network is similar to a highway; the larger the bandwidth, the more lanes a highway has, and the stronger its capacity. Typically, the bandwidth resources of an enterprise's cross-regional network are limited, and multiple IT systems usually share these network resources. To prevent one IT system from consuming excessive network bandwidth resources during large cross-regional file transfers, thus rendering other IT systems unavailable, it is necessary to control the transmission speed on IT systems with large file transfer needs to ensure the availability of other IT systems.

[0023] Existing technologies utilize network devices to pre-allocate bandwidth resources to various IT systems, thereby limiting the transmission speed of each IT system. While this method ensures the availability of each IT system, its control granularity is relatively coarse, only controlling the overall transmission speed of a single IT system. If the bandwidth resource allocation strategy pre-set by the network device is unreasonable, allocating more bandwidth resources to IT systems with low current session and data transmission volumes, it will lead to reduced smoothness in other IT systems with high session and data transmission volumes, resulting in a poor user experience and low utilization of network resources.

[0024] In view of this, this application proposes a data transmission method that monitors the current concurrency of the server and calculates and controls the transmission speed of a single session based on the actual total bandwidth resources, thereby achieving session-level transmission speed control, making reasonable use of network bandwidth resources, and improving user experience.

[0025] Figure 1 This is a schematic diagram illustrating application scenario 100 to which this application applies. For example... Figure 1 As shown, application scenario 100 includes server 101, client 102, client 103, and client 104. Server 101 and client 102, as well as client 103 and client 104, can communicate via network connection. Server 101 provides multiple application services to the clients, and clients 102, 103, and 104 can upload data to or download data from server 101.

[0026] Optionally, the client can be a computer, tablet, smartphone, smart wearable device, or any other device that can communicate with server 101 via a network connection. Figure 1 The client types and numbers shown are merely illustrative; in a concrete implementation, the client can be any other type, and the number of clients can also be greater than [previous examples]. Figure 1 The application does not specifically limit the number of more or fewer shown in the figure.

[0027] Optionally, there can be one or more servers 101, which can be centrally configured in the same location or distributed across different locations. This application does not impose any specific limitations on this. However, it should be noted that regardless of whether one or more servers 101 are configured, their functions are the same. When multiple servers are configured, client requests can be distributed to the appropriate servers for processing based on a load balancing strategy.

[0028] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0029] Figure 2 This is a schematic flowchart illustrating a data transmission method 200 provided in an embodiment of this application. This data transmission method 200 can be applied to, for example... Figure 1 In the scenario shown, the corresponding steps in method 200 can be derived from... Figure 1 The execution is carried out by the server in this embodiment, and there are no specific restrictions on the specific product form and quantity of the execution entity. For example... Figure 2 As shown, the method includes:

[0030] S201. Receive a data transmission request from the client. The data transmission request is used to request the transmission of the target file.

[0031] It should be understood that the server provides one or more application services to the client. The data transmission request received by the server from the client may be for requesting to upload a data file to the server or for requesting to download a data file from the server. The target file mentioned above is the file that the client requests to upload or download.

[0032] S202. Determine whether the current actual concurrency is equal to the current maximum concurrency. Concurrency is the number of data transmission requests that the server processes simultaneously.

[0033] It should be understood that the number of data transmission requests that the server is processing simultaneously refers to the number of sessions corresponding to requests that are already transmitting data, not the total number of received requests. After receiving a data transmission request from a client, the server needs to first determine whether the current actual concurrency is equal to the current maximum concurrency. Only based on the comparison between the current actual concurrency and the current maximum concurrency can the server decide whether to process the data transmission request.

[0034] The "current actual concurrency" refers to the number of data transmission requests that the server is currently processing simultaneously, while the "current maximum concurrency" refers to the maximum number of data transmission requests that the server is currently allowed to process simultaneously.

[0035] S203. If the current actual concurrency is less than the current maximum concurrency, increase the current actual concurrency by 1, and perform rate-limited transmission of the target file according to the current maximum transmission speed of a single session.

[0036] It should be understood that if the current actual concurrency is less than the current maximum concurrency, it means that the number of data transmission requests that the server is currently processing simultaneously has not reached the maximum limit. Allowing data transmission processing for the data transmission request received at the current moment will not affect other ongoing sessions. If the current actual concurrency is N, then when it is determined that the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, i.e., N = N + 1, and the target file is transmitted at a rate limited to the highest average rate limit, using the current maximum transmission speed of a single session as the highest average rate limit.

[0037] S204. When the target file transfer ends, subtract 1 from the current actual concurrency.

[0038] When the server detects the end of the target file transfer, it releases the corresponding request connection between the server and the client. This reduces the number of data transfer requests that the server is currently processing simultaneously by 1, and the current actual concurrency N = N - 1.

[0039] In one possible implementation, if the data transmission request received by the server from the client is for uploading a target file to the server, the client will send a target file transmission end flag to the server after the target file transmission is completed. The server will determine that the target file transmission has ended based on the received flag.

[0040] In another possible implementation, if the data transmission request received by the server from the client is for downloading a target file from the server, the server can determine whether the target file transmission has ended by detecting the data end flag contained in the transmitted target file. When the data end flag is detected, the target file transmission can be considered to have ended.

[0041] In this embodiment, the server receives a data transmission request from the client and determines whether the current actual concurrency is equal to the current maximum concurrency. If the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at a rate-limited speed according to the current maximum transmission speed of a single session. When the target file transmission ends, the current actual concurrency is decreased by 1. The method provided in this embodiment controls the server's current actual concurrency to ensure it does not exceed the current maximum concurrency, while simultaneously limiting the target file transmission at the current maximum transmission speed of a single session. This ensures that a single session does not consume excessive network bandwidth resources, allowing each session to transmit the target file at the highest average speed not exceeding the current maximum transmission speed of a single session. This helps to balance the network bandwidth resources occupied by various data transmission requests, avoiding a situation where a small number of requests consume most of the bandwidth resources, thus improving user experience and promoting the rational utilization of network bandwidth resources.

[0042] As an optional embodiment, the method for determining the current maximum concurrency and the current maximum transmission speed per session includes: calculating the current maximum concurrency based on the current actual concurrency, the current number of waiting threads, and preset parameters; and calculating the current maximum transmission speed per session based on the current maximum concurrency and the total bandwidth.

[0043] In one possible implementation, the current maximum concurrency M can be calculated using the following formula (1) based on the current actual concurrency N, the current number of waiting threads W, and the preset parameter Y.

[0044] M=(N+W) / Y (1)

[0045] Optionally, the preset parameter Y can be 0.8 to represent a 20% concurrency reserve. This application does not impose specific limitations on the value of the preset parameter Y.

[0046] In one possible implementation, the method for determining the current maximum transmission speed of a single session includes: calculating the current maximum transmission speed S of a single session based on the current maximum concurrency M and the total bandwidth using the following formula (2).

[0047] S = Total bandwidth / M (2)

[0048] In equation (2) above, total bandwidth refers to the total network bandwidth resources that can be used for data transmission between the server and the client, representing the maximum amount of data that can be transmitted per unit time. In specific implementation, the specific total bandwidth data can be purchased from the corresponding network operator. For example, it can be 100Mbps (Megabyte Bit Per Second), which means that the amount of data that can be transmitted per second is 100M bit, and also means that the amount of data transmitted per second is 100 / 8 = 12.5MB (M Byte), where 1 Byte contains 8 bits.

[0049] Figure 3 This is a schematic flowchart illustrating another data transmission method 300 provided in an embodiment of this application. In the above... Figure 2 Based on the embodiments, the method further includes:

[0050] S301. If the current actual concurrency is equal to the current maximum concurrency, increase the current number of waiting threads by 1.

[0051] S302. After a preset time period, decrement the current number of waiting threads by 1 and continue executing S202~S203~S204, or continue looping S202~S301~S302 until S203~S204 can be executed.

[0052] It should be understood that the server has received the data transmission request from the client, but since the current actual concurrency has reached the current maximum concurrency, the server has not yet processed the transfer of the target file for this request. This part of the request needs to enter the waiting thread to wait, and the number of requests entering the waiting thread is the current number of waiting threads.

[0053] The aforementioned preset time period is the time that a data transmission request received by the server stays in the waiting thread. After waiting for a preset time period, the current number of waiting threads is reduced by 1, that is, the current number of waiting threads W = W - 1. Then, it continues to determine whether the current actual concurrency is equal to the current maximum concurrency, until the current actual concurrency is less than the current maximum concurrency. Then, the current actual concurrency N = N + 1, and the target file is transmitted at a rate limited according to the current maximum transmission speed of a single session.

[0054] In one possible implementation, if the actual concurrency level still equals the maximum concurrency level after a preset time period, a message can be returned for the request to remind the user to choose whether to re-initiate the request or abandon it. This setting allows users to receive timely feedback after waiting for a preset time period, which helps improve the user experience.

[0055] Figure 4This is a schematic flowchart illustrating a data transmission method 400 provided in an embodiment of this application. Figure 2 and Figure 3 In the embodiment, one possible implementation of rate-limited transmission of the target file according to the current single-session maximum transmission speed in S203 and S303 includes:

[0056] S401. During the first time period, the target file is transmitted at a rate-limited speed of a first transmission speed, where the first transmission speed is the maximum transmission speed of a single session at the first moment.

[0057] S402, (when the first time period ends) determine whether the target file has finished transmitting. If it has not finished, execute S403; if it has finished, execute S204.

[0058] S403. If the target file has not finished transmitting, the remaining data of the target file shall be transmitted at a limited rate during the second time period, and the second transmission speed shall be the maximum transmission speed of a single session at the second time.

[0059] In one possible implementation, the first time period is a time cycle for determining whether the target file transmission has ended. The first moment is the moment when the target file begins transmission. At the first moment when the target file begins transmission, the server calculates the current maximum transmission speed for a single session in real time, i.e., the maximum transmission speed for a single session at the first moment. Based on the maximum transmission speed for a single session at the first moment, a first transmission speed for transmitting the target file is determined. When transmitting the target file using the first transmission speed, the maximum amount of data transmitted per unit cannot exceed the maximum amount of data that can be transmitted per unit time using the maximum transmission speed for a single session at the first moment. That is, the first transmission speed can be considered as the average speed per unit time, without limiting the maximum speed at each moment within the unit time. Optionally, the period for the server to calculate the current maximum transmission speed for a single session in real time can be on the order of seconds. For servers with a huge sudden access volume, it can be set to the order of milliseconds to ensure the accuracy of the maximum transmission speed for a single session and achieve the purpose of real-time and precise control of the transmission speed for a single session.

[0060] If the target file has not finished transmitting after the first time period ends, it needs to continue transmitting, entering the second time period following the first. At this point, the current maximum single-session transmission speed has changed, requiring a new maximum single-session transmission speed for the second time period. The target file is then rate-limited based on this second transmission speed. The second time period is the immediately following moment after the first time period ends, which is also the first moment of the second time period. If the target file is still not fully transmitted after the second time period ends, the rate-limited transmission can continue into the next time period until the target file transmission is complete. For example, if the first time period is 5 seconds, then the first moment is the 1st second, and the second moment is the 6th second.

[0061] In another possible implementation, the server can periodically calculate the current maximum single-session transmission speed at a preset period. Thus, the maximum single-session transmission speed at the first moment and the maximum single-session transmission speed at the second moment may be the same. For example, the preset period for calculating the current maximum single-session transmission speed is 10 seconds. A calculation is performed at 10:10:00, yielding a current maximum single-session transmission speed of 5 Mbps. A time period for determining whether the target file transmission has ended is 5 seconds. Transmission of the target file begins at 10:10:02, making 10:10:02 the first moment. The corresponding current maximum single-session transmission speed at this time is the 5 Mbps calculated by the server at 10:10:00. With 5 Mbps as the maximum speed limit per second for 5 seconds... If the target file has not finished transmitting at 10:10:06, and transmission needs to continue, then the server enters the next period to determine if the target file transmission is complete, i.e., the second time period. This second time point is 10:10:07. At this point, 7 seconds have passed since the last calculation of the current single-session maximum transmission speed, and the single-session maximum transmission speed calculated at 10:10:00 has not yet been recalculated. Therefore, at this second time point, the server still uses the same single-session maximum transmission speed as the first time point to determine the second transmission speed, continuing to rate-limit the transmission of the target file. If the number of requests to the server within the preset period for calculating the current single-session maximum transmission speed is very small (less than a preset threshold), periodically adjusting the current single-session maximum transmission speed can save server computing power without affecting user experience.

[0062] Figure 5 This is a schematic flowchart illustrating a data transmission method 500 provided in an embodiment of this application. In the above... Figure 4 In this embodiment, one possible implementation of rate-limited transmission of the target file at a first transmission speed includes:

[0063] 501. The value of the first transmission speed is determined as the amount of data transmitted per second.

[0064] 502. Read the data corresponding to the specified data volume from the target file and transmit it until the data transmission is complete.

[0065] 503. Determine whether the target file transfer has ended. If yes, release the connection; otherwise, execute S504.

[0066] 504. Determine if the transmission time is less than 1 second; if not, return to continue executing S501 and subsequent steps; if yes, execute S505.

[0067] 505. Then, the third sleep period is initiated, and the duration of the third sleep period is 1 second minus the transmission time to obtain the corresponding duration. After the sleep period ends, return to continue executing S501 and subsequent steps.

[0068] For example, if the first transmission speed is 40Mbps, then the maximum amount of data allowed to be transmitted per second in the first time period is 5MB. 5MB of data is read from the target file and transmitted at the first transmission speed. If the transmission of 5MB of data ends but the transmission of the target file has not ended, the transmission time of the 5MB of data is determined. If the transmission time X is less than 1 second, it means that 5MB of data has been transmitted in less than one second. Continuing to transmit data will exceed the data limit (5MB) corresponding to the first transmission speed. Therefore, the transmission connection corresponding to the target file sleeps for (1-X) seconds. The third time period mentioned above is (1-X) seconds.

[0069] It should be understood that the first transmission speed can be considered as the average speed per unit time, and does not limit the maximum speed at any given moment within that unit time. In other words, when the unit time is 1 second, it is permissible for the instantaneous first transmission speed to exceed the maximum transmission speed of a single session for a certain millisecond within that second. As long as the amount of data transmitted within 1 second does not exceed the amount of data corresponding to the maximum transmission speed of a single session at the first moment, it is considered that rate-limited transmission has been achieved.

[0070] The method provided in this embodiment achieves session-level network bandwidth control by limiting the transmission speed of the target file corresponding to a single request, thereby improving the utilization rate of network resources.

[0071] Figure 6 This is a schematic block diagram of a data transmission device 600 provided for the purposes of this application. Figure 5As shown, the device 600 includes a transceiver module 601 and a processing module 602. The transceiver module 601 receives data transmission requests from clients, the data transmission requests requesting the transmission of a target file. The processing module 602 determines whether the current actual concurrency is equal to the current maximum concurrency, where concurrency is the number of data transmission requests processed simultaneously by the device; and if the current actual concurrency is less than the current maximum concurrency, it increments the current actual concurrency by 1 and performs rate-limited transmission of the target file according to the current maximum transmission speed per session; when the transmission of the target file ends, it decrements the current actual concurrency by 1.

[0072] Optionally, the processing module 602 is further configured to: if the current actual concurrency is equal to the current maximum concurrency, increase the current number of waiting threads by 1; and after a preset time period, decrease the current number of waiting threads by 1 and determine whether the current actual concurrency is equal to the current maximum concurrency; if the current actual concurrency is less than the current maximum concurrency, increase the current actual concurrency by 1 and perform rate-limited transmission of the target file according to the current maximum transmission speed of a single session.

[0073] Optionally, the processing module 602 is further configured to: if the current actual concurrency is equal to the current maximum concurrency, increase the current number of waiting threads by 1.

[0074] Optionally, the processing module 602 is specifically used to: transmit the target file at a first transmission speed within a first time period, the first transmission speed being the maximum transmission speed of a single session at the first moment; determine whether the transmission of the target file has ended when the first time period ends; and if the transmission of the target file has not ended, transmit the remaining data of the target file at a second transmission speed within a second time period, the second transmission speed being the maximum transmission speed of a single session at the second moment.

[0075] Optionally, the processing module 602 is specifically used to: determine the value of the first transmission speed as the amount of data transmitted per second; read the data corresponding to the amount of data from the target file and transmit it; when the data transmission corresponding to the amount of data has ended but the target file has not ended, determine the transmission time of the data corresponding to the amount of data; determine whether the transmission time is less than 1 second; if the transmission time is less than 1 second, then sleep for a third time period, the duration of the third time period being 1 second minus the corresponding duration obtained by the transmission time.

[0076] Optionally, the processing module 602 is further configured to: calculate the current maximum concurrency based on the current actual concurrency, the current number of waiting threads, and preset parameters; and calculate the current maximum transmission speed for a single session based on the current maximum concurrency and the total bandwidth.

[0077] In one possible implementation, the data transmission device provided in this application may include: a data transmission module, a flow control calculation module, a traffic control module, a distributed caching module, and a file storage module. The data transmission module is used to implement data transmission between the server and the client; the flow control calculation module is used to calculate the current maximum concurrency based on the current actual concurrency, the current number of waiting threads, and preset parameters; and to calculate the current maximum transmission speed per session based on the current maximum concurrency and the total bandwidth; the traffic control module is used to control the current actual concurrency and the transmission speed of the target file based on the current maximum concurrency and the current maximum transmission speed per session calculated by the "transmission speed calculation module"; the distributed caching module is used to store the current maximum concurrency and the current maximum transmission speed per session; and the file storage module is used to store the target file.

[0078] Optionally, in scenarios with multiple servers, the cached content of the distributed caching module can be shared by multiple servers to achieve overall transmission speed control.

[0079] It should be understood that those skilled in the art can adjust the functions of each module in the data transmission device as needed, and this application does not make any specific limitations in this regard.

[0080] The data processing apparatus provided in this application embodiment can be used to implement the technical solutions in any of the foregoing method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.

[0081] Figure 7 This is a schematic block diagram of an electronic device 700 provided in an embodiment of this application. Figure 7 As shown, Figure 7 The illustrated electronic device includes a processor 701 and a memory 702. The processor 701 and memory 702 are connected, for example, via a bus 704. Optionally, the electronic device may also include a transceiver 703. It should be noted that in practical applications, the transceiver is not limited to one unit, and the structure of this electronic device does not constitute a limitation on the embodiments of this application. The electronic device 700 may specifically be the server in the above embodiments and can be used to execute each step and / or process corresponding to the server in the above method embodiments.

[0082] Processor 701 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 701 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0083] Bus 704 may include a pathway for transmitting information between the aforementioned components. Bus 704 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 704 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The 704 bus is represented by a single thick line, but this does not mean that there is only one 704 bus or one type of 704 bus.

[0084] The memory 702 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0085] The memory 702 is used to store application code that executes the solution of this application, and its execution is controlled by the processor 701. The processor 701 is used to execute the application code stored in the memory 702 to implement the content shown in the foregoing method embodiments. Figure 7 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0086] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed, are used to implement any of the technical solutions in the above-described method embodiments.

[0087] This application also provides a computer program product, which includes a computer program (also referred to as code or instructions) that, when run on a computer, allows the computer to execute the corresponding content in the above method embodiments.

[0088] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0089] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A data transmission method, characterized in that, Applied to a server, the method includes: Receive a data transmission request from a client, the data transmission request being used to request the transmission of a target file; Determine whether the current actual concurrency is equal to the current maximum concurrency, where the concurrency is the number of data transmission requests that the server processes simultaneously; If the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at a rate-limited speed according to the current maximum transmission speed per session. This includes: transmitting the target file at a rate-limited speed at a first transmission speed during a first time period, where the first transmission speed is the maximum transmission speed per session at a first moment; when the first time period ends, determining whether the target file transmission is complete; if the target file transmission is not complete, transmitting the remaining data of the target file at a rate-limited speed at a second transmission speed during a second time period, where the second transmission speed is the maximum transmission speed per session at a second moment. When the target file transfer ends, subtract 1 from the current actual concurrency level; The rate-limited transmission of the target file at the first transmission speed includes: The value of the first transmission speed is determined as the amount of data transmitted per second; Read the data corresponding to the specified data volume from the target file and transmit it. If the data transmission corresponding to the data volume has ended but the target file has not been transmitted, determine the transmission time of the data corresponding to the data volume. Determine whether the transmission time is less than 1 second; If the transmission time is less than 1 second, then a third sleep period is initiated, the duration of which is 1 second minus the transmission time.

2. The method according to claim 1, characterized in that, The method further includes: If the current actual concurrency is equal to the current maximum concurrency, increment the current number of waiting threads by 1; After a preset time period, subtract 1 from the current number of waiting threads and determine whether the current actual concurrency is equal to the current maximum concurrency. If the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at a rate-limited speed according to the current maximum transmission speed of a single session.

3. The method according to claim 2, characterized in that, The method further includes: If the current actual concurrency is equal to the current maximum concurrency, increase the current number of waiting threads by 1.

4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Calculate the current maximum concurrency based on the current actual concurrency, the current number of waiting threads, and preset parameters; Calculate the current maximum transmission speed for a single session based on the current maximum concurrency and total bandwidth.

5. A data processing apparatus, characterized in that, include: The transceiver module is used to receive data transmission requests from clients, the data transmission requests being used to request the transmission of target files; The processing module is used to determine whether the current actual concurrency is equal to the current maximum concurrency, where the concurrency is the number of data transmission requests that the device processes simultaneously; Furthermore, if the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at a rate-limited speed according to the current maximum transmission speed of a single session; when the transmission of the target file ends, the current actual concurrency is decreased by 1. The processing module is specifically used to perform rate-limited transmission of the target file at a first transmission speed within a first time period, where the first transmission speed is the maximum transmission speed of a single session at the first moment; and to determine whether the transmission of the target file has ended when the first time period ends. If the target file has not been completely transmitted, the remaining data of the target file will be transmitted at a limited rate during the second time period, with the second transmission speed being the maximum single-session transmission speed at the second time. The processing module is further specifically configured to: determine the value of the first transmission speed as the amount of data transmitted per second; read the data corresponding to the amount of data from the target file and transmit it; determine the transmission time of the data corresponding to the amount of data when the data transmission of the amount of data has ended and the transmission of the target file has not ended; determine whether the transmission time is less than 1 second; if the transmission time is less than 1 second, then sleep for a third time period, the duration of which is 1 second minus the corresponding duration obtained by the transmission time.

6. The apparatus according to claim 5, characterized in that, The processing module is also used for: If the current actual concurrency is equal to the current maximum concurrency, increment the current number of waiting threads by 1; After a preset time period, subtract 1 from the current number of waiting threads and determine whether the current actual concurrency is equal to the current maximum concurrency. If the current actual concurrency is less than the current maximum concurrency, the current actual concurrency is increased by 1, and the target file is transmitted at a rate-limited speed according to the current maximum transmission speed of a single session.

7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 4.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Download speed adjustment method, background server, terminal and system

    CN105847442A

  • Implementation method and device for concurrent control of educational operation system

    CN109976920A