CN112751930B - File downloading control method and device, computer equipment and storage medium - Google Patents

File downloading control method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112751930B
CN112751930B CN202011609512.XA CN202011609512A CN112751930B CN 112751930 B CN112751930 B CN 112751930B CN 202011609512 A CN202011609512 A CN 202011609512A CN 112751930 B CN112751930 B CN 112751930B
Authority
CN
China
Prior art keywords
file
current time
time period
clients
download
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011609512.XA
Other languages
Chinese (zh)
Other versions
CN112751930A (en
Inventor
魏文杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011609512.XA priority Critical patent/CN112751930B/en
Publication of CN112751930A publication Critical patent/CN112751930A/en
Application granted granted Critical
Publication of CN112751930B publication Critical patent/CN112751930B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • H04L67/1085Resource delivery mechanisms involving dynamic management of active down- or uploading connections

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application relates to the technical field of cloud transmission, and provides a file downloading control method, a file downloading control device, computer equipment and a storage medium, wherein the current time node information during file release is acquired, and the client request quantity percentage in the current time period of the current time node information is acquired; determining the percentage of the file allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period; further acquiring the target number of the clients allowed to download the file in the current time period according to the number of the clients needing to download the file in the current time period; finally, selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file. According to the method and the device, the number of the clients downloading the files at the same time in the same time period is limited, and the phenomenon that a large wave crest is generated due to the sharp increase of the bandwidth is avoided, so that the increase of the bandwidth cost is avoided.

Description

File downloading control method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of cloud transmission technologies, and in particular, to a file download control method and apparatus, a computer device, and a storage medium.
Background
With the development of internet technology, some large internet companies use a Content Delivery Network (CDN) to accelerate service, so that the transmission of Content from a server to a client is faster and more stable, and the user experience of the client is improved.
The CDN services provided by CDN companies are expensive, and there are mainly two ways to meter charges.
The first method comprises the following steps: and calculating according to the flow, namely calculating the charge per GB unit price of the flow consumed by the user for accessing the website.
And the second method comprises the following steps: according to the fixed bandwidth calculation, only the bandwidth is calculated, and the calculation charging is carried out every Mb/s unit price. Generally, 95% of the monthly peak bandwidth is taken as the charging bandwidth for charging, or the peak values of the 2 nd, 3 rd and 4 th bandwidths of the monthly peak are taken as the charging bandwidth for charging.
Generally, the usage flow of a large company product is large, and it is more cost-effective to select the second charging mode, but the bandwidth peak will cause the CDN cost to increase greatly, and when new file content is delivered, especially large file delivery, if a large number of users download the content at the same time, a large bandwidth peak will be generated, resulting in the CDN cost to increase greatly.
Disclosure of Invention
The application mainly aims to provide a file downloading control method, a file downloading control device, computer equipment and a storage medium, and aims to overcome the defect that a large number of clients download published files at the same time to cause bandwidth surge.
In order to achieve the above object, the present application provides a file download control method, including the following steps:
acquiring current time node information when a file is issued;
acquiring the percentage of the client request quantity in the current time period of the current time node information; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in the historical data;
determining the percentage of the file allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period;
acquiring the number of clients needing to download the file in the current time period;
acquiring the target number of the clients allowed to download the file in the current time period according to the number of the clients required to download the file in the current time period and the percentage of the files allowed to be downloaded in the current time period;
selecting a target number of clients from clients needing to download the file in the current time period; wherein the selected client is allowed to download the file.
Further, after the step of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
performing hash calculation on the current time to obtain a first hash value of a first designated digit;
generating a random number of a second designated bit of the target number by using a random algorithm;
combining the first hash value and the random numbers of the target number respectively to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
sending the tokens with the target number to the selected client; and correspondingly sending one token to one client.
Further, after the step of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
performing hash calculation on the current time to obtain a second hash value of a first designated digit;
generating a random number of a second designated bit number by adopting a random algorithm;
combining the first hash value with the random number to obtain a token, and configuring the upper limit of the verification times of the token as the number corresponding to the target number;
and respectively sending the token to each selected client.
Further, after the step of sending the token to each selected client, the method includes:
when a downloading request of any client is received, obtaining a token returned by the client;
obtaining the verification times of the token, and judging whether the verification times are greater than the upper limit of the verification times;
if not, verifying whether the token is correct;
and if the token is correct, allowing the client to download the file.
Further, after the step of obtaining the current time node information when the file is published, the method further includes:
acquiring the size of the file;
acquiring the total number of clients needing to download the file;
multiplying the size of the file by the total number of the clients needing to download the file to obtain a first result;
judging whether the first result is larger than a first threshold value;
if the current time node information is larger than the preset time node information, entering the step of obtaining the client request quantity percentage in the current time period of the current time node information;
and if not, selecting all clients needing to download the file in the current time period to download the file.
Further, after the step of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
acquiring the size of the file;
multiplying the size of the file by the target number to obtain a second result;
judging whether the second result is larger than a second threshold value;
if so, calculating the ratio of the second result to the second threshold;
dividing the upper limit value of the network speed by the ratio to obtain a third result; and taking the third result as the maximum value of the downloading speed of the file downloaded by the client.
The present application further provides a file download control apparatus, including:
the first acquisition unit is used for acquiring the current time node information when the file is issued;
a second obtaining unit, configured to obtain a percentage of a client request amount in a current time period in which the current time node information is located; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in historical data;
the determining unit is used for determining the percentage of the files allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period;
the third acquisition unit is used for acquiring the number of clients needing to download the file in the current time period;
a fourth obtaining unit, configured to obtain, according to the number of clients that need to download the file in the current time period and a percentage of the files that are allowed to be downloaded in the current time period, a target number of clients that are allowed to download the files in the current time period;
the selection unit is used for selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file.
Further, still include:
performing hash calculation on the current time to obtain a first hash value of a first designated digit;
generating a random number of a second designated bit of the target number by using a random algorithm;
combining the first hash value and the random numbers of the target number respectively to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
sending the tokens with the target number to the selected client; wherein, a token is correspondingly sent to a client.
The present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any one of the above.
According to the file downloading control method, the file downloading control device, the computer equipment and the storage medium, when a file is issued, the percentage of the request quantity of the client in the time period of the current time is obtained; determining the percentage of the files allowed to be downloaded in the current time period according to the percentage of the client request amount in the current time period; further acquiring the target number of the clients allowed to download the file in the current time period according to the number of the clients needing to download the file in the current time period; finally, selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file. According to the method and the device, the number of the clients downloading the files at the same time in the same time period is limited, and the situation that a large wave crest is generated due to the fact that the bandwidth is increased rapidly is avoided, so that the increase of the bandwidth cost is avoided.
Drawings
FIG. 1 is a schematic diagram illustrating steps of a file download control method according to an embodiment of the present application;
FIG. 2 is a block diagram of a file download control apparatus according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application.
Referring to fig. 1, an embodiment of the present application provides a file download control method, including the following steps:
step S1, acquiring current time node information when a file is issued;
s2, acquiring the percentage of the request quantity of the client in the current time period of the current time node information; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in historical data;
s3, determining the percentage of the file allowed to be downloaded in the current time period according to the percentage of the request quantity of the client in the current time period;
s4, acquiring the number of clients needing to download the files in the current time period;
s5, acquiring the target number of the clients allowed to download the files in the current time period according to the number of the clients required to download the files in the current time period and the percentage of the files allowed to be downloaded in the current time period;
s6, selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file.
In this embodiment, when the file is released, if all the clients download the file at the same time, a large bandwidth peak is generated, which results in a great increase in CDN cost. It is therefore desirable to limit the number of clients that download files simultaneously. In this embodiment, the method is applied to a management terminal, and the management terminal determines the percentage of clients downloading files in the current time period according to the number of clients downloading files in each time period in the historical data, so as to limit the number of clients downloading files simultaneously.
Specifically, when the file is published, the current time node information is obtained, and a time period in which the time node information is located is obtained, where the time period may be one unit time, for example, one hour. Specifically, historical access data is obtained, the number of clients requesting downloading in one day and the number of clients requesting downloading in the current time period are calculated, and the percentage of the number of clients requesting downloading in the current time period to the number of clients requesting downloading in the whole day is calculated to obtain the percentage of the amount of requests of the clients in the current time period.
And further, calculating the percentage of the files allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period, wherein the higher the percentage of the client request quantity in the current time period is, the lower the percentage of the files allowed to be downloaded in the current time period is. Specifically, a corresponding relation table between the percentage of the request amount of the client and the percentage of the file allowed to be downloaded may be preset; for example: 14:00-15: in the time period of 00, the client quantity is the largest, the request quantity is the largest and accounts for 18% of all-day clients, and then the proportion of the number of the clients allowed to download the files is the lowest and is only 30%;4:00-5: in the time period of 00, the number of clients is the minimum, the request amount is the minimum, and accounts for 1% of all day clients, so that the proportion of the number of the clients allowed to download the files is the highest 100%, and all the clients are allowed to download the published files. Therefore, the purpose of uniform file delivery can be achieved, a large number of clients are prevented from downloading delivered files at the same time, and CDN cost increase caused by large wave peaks generated by bandwidth surge is avoided.
When the client finishes downloading the release file, the file is cached, and the client which downloads the release file cannot download the release file again. When the file is released, the client judges whether the file has a cache, and if so, a downloading request is not sent; if not, and the file needs to be downloaded at this time, a download request can be issued. According to the downloading request sent by the client in the current time period, the number of the clients needing to download the file in the current time period can be obtained, and therefore the target number of the clients allowed to download the file in the current time period is calculated according to the percentage of the files allowed to be downloaded in the current time period. And finally, selecting a target number of clients from the clients needing to download the files in the current time period to download the files. In this embodiment, the number of clients downloading files at the same time in the same time period is limited, and CDN cost increase caused by a large peak generated by a sharp increase in bandwidth is avoided.
In an embodiment, after step S6 of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
step S71, carrying out Hash calculation on the current time to obtain a first Hash value of a first designated digit;
step S72, generating random numbers of second designated digits of the target quantity by adopting a random algorithm;
step S73, combining the first hash value and the random numbers of the target number respectively to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
step S74, sending the tokens with the target number to the selected client; and one token is correspondingly sent to one client.
In this embodiment, in order to facilitate the client to perform permission verification when downloading a file, a token may be respectively made for each client, and the token is sent to the client, where the client returns the token when sending a download request, and the management terminal verifies the validity, i.e., correctness, of the token when receiving the token; if the token is valid, the client is allowed to download the file, and if the token is invalid, the client is not allowed to download the file. It will be appreciated that the token described above is unique and has only one right to be used.
At present, the token is usually generated only by generating a random number, and this way cannot carry more information in the token, for example, the time when the client is allowed to download the file, etc. In this embodiment, after the hash calculation is performed on the current time, the hash calculation is added to the token, so that only the time when the client is allowed to download the file can be known according to the token. The token can be used as a basis for subsequent rechecking investigation, and has strong traceability. The hash calculation is performed to avoid that the number corresponding to the current time is too long, usually the first specified number of bits is 3, and the second specified number of bits is 6, for example, one token may be stt790263, where stt is the first hash value obtained by hash calculation at the current time, and 790263 is a random number.
In an embodiment, after step S7 of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
step S701, performing hash calculation on the current time to obtain a second hash value of a first designated digit;
step S702, generating a random number of a second designated bit number by adopting a random algorithm;
step S703, combining the first hash value with the random number to obtain a token, and configuring an upper limit of the verification times of the token as a number corresponding to the target number;
step S704, sending the token to each selected client.
In this embodiment, in order to facilitate the client to perform permission verification when downloading a file, a same token may be uniformly made for all clients, and the token is sent to the client; and if the token is valid, allowing the client to download the file, and if the token is invalid, not allowing the client to download the file. It will be appreciated that the token described above is unique and has only one right to be used.
In this embodiment, all tokens sent to the client are the same, and it is limited that the upper limit of the verification times of the token is a number corresponding to the target number, that is, the number of times that the token is used by the target number at most, that is, it can be ensured that the number of times that the file is downloaded by the target number at most in the time period, thereby avoiding an increase in CDN cost caused by a large peak due to a sharp increase in bandwidth.
It can be understood that the token is not bound to the client, that is, after any client takes the token, the token can be used for verification, so as to perform file downloading, but in this embodiment, an upper limit of the number of times of using the token is defined, so that no matter which client performs file downloading, it can be guaranteed that the number of clients downloading files is not more than the target number in the period. When downloading the file, the method has stronger flexibility, for example, some client sides which need to download the file more but do not receive the token can obtain the token after negotiating with other users, and download the file through the token.
Specifically, after the step S704 of sending the token to each selected client respectively, the method includes:
step S705, when receiving a download request of any one of the clients, obtaining a token returned by the client;
step S706, obtaining the verification times of the token, and judging whether the verification times is greater than the upper limit of the verification times;
step S707, if not, verifying whether the token is correct;
step S708, if the token is correct, allowing the client to download the file.
In this embodiment, when verifying the token, it is first verified whether the number of times of using the token reaches an upper limit, and if the number of times of using the token reaches the upper limit, the client is not allowed to download the file; if the upper limit is not reached, whether the token is correct or not can be further verified, and the file can be downloaded only if the token is correct.
In an embodiment, after the step S1 of obtaining the current time node information when the file is published, the method further includes:
step S11, acquiring the size of the file;
step S12, obtaining the total number of clients needing to download the file;
step S13, multiplying the size of the file by the total number of the clients needing to download the file to obtain a first result;
step S14, judging whether the first result is larger than a first threshold value;
step S15, if the current time node information is larger than the current time node information, the step of obtaining the client request quantity percentage in the current time period is carried out;
and S16, if the current time period is not larger than the preset time period, selecting all clients needing to download the file in the current time period to download the file.
In this embodiment, when downloading a file, the size of the file may also be obtained, and if the file is very small, or the number of clients needing the file in the next week is very small, no excessive network pressure is caused, and all the clients may download the file in this time period.
Therefore, in this embodiment, the first threshold is preset, and when a first result obtained by multiplying the size of the file by the total number of the clients needing to download the file is greater than the first threshold, it indicates that a large network pressure is generated if all the clients download the file at present; at this time, the steps of obtaining the percentage of the client request amount in the current time period and subsequently selecting the client are required.
If the first result is not greater than the first threshold, all the clients may be allowed to download the file, and in order to further reduce the network pressure, only the clients that need to download the file in the current time period may be selected to download the file. It is to be understood that the clients that generally need to download the file refer to all clients that do not download the file; the client needing to download the file in the current time period refers to the client which sends a download request in the current time period from all clients which do not download the file; therefore, the number of clients that need to download the file is typically greater than the number of clients that need to download the file in the current time period. That is, when the first result is not greater than the first threshold, all the clients that need to download the file in the current time period may be selected to download the file, so that not only can the clients that need to download the file in the current time period download the file, but also excessive network pressure is avoided.
In another embodiment, after step S7 of selecting a target number of clients from the clients that need to download the file in the current time period, the method includes:
s7a, acquiring the size of the file;
s7b, multiplying the size of the file by the target number to obtain a second result;
step S7c, judging whether the second result is larger than a second threshold value;
step S7d, if the first result is larger than the second threshold, calculating the ratio of the second result to the second threshold;
s7e, dividing the upper limit value of the network speed by the ratio to obtain a third result; and taking the third result as the maximum value of the downloading speed of the file downloaded by the client.
In this embodiment, when downloading a file, the size of the file may also be obtained, and if the file is very small and the target number is also small, the speed of downloading the file by the client may not be limited at this time; if the file is large or the target number is particularly large, the downloading speed of the file downloaded by the client can be increased, so that network congestion is avoided, and network use of other clients is prevented from being influenced.
Therefore, in this embodiment, the second threshold is preset, and when the first result obtained by multiplying the size of the file by the target number is greater than the second threshold, it indicates that the downloading pressure is greater, so as to avoid occupying too many network resources and affecting network usage of other clients, and limit the downloading speed of the selected client for downloading the file. Specifically, a ratio of the second result to the second threshold is calculated; and performing phase location on the upper limit value of the network speed and the ratio to obtain a third result, and taking the third result as the maximum value of the downloading speed of the client for downloading the file.
If the first result obtained by multiplying the size of the file by the target number is not greater than the second threshold, it indicates that the downloading pressure at this time is not large, and the downloading speed may not be limited, and may not have a great influence on other clients.
In an embodiment, the method further includes:
the data is stored in a blockchain. The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
Referring to fig. 2, an embodiment of the present application further provides a file download control apparatus, including:
a first obtaining unit 10, configured to obtain node information of a current time when a file is issued;
a second obtaining unit 20, configured to obtain a percentage of a client request amount in a current time period in which the current time node information is located; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in historical data;
a determining unit 30, configured to determine, according to the percentage of the client request amount in the current time period, the percentage of the file allowed to be downloaded in the current time period;
a third obtaining unit 40, configured to obtain the number of clients that need to download the file in the current time period;
a fourth obtaining unit 50, configured to obtain, according to the number of clients that need to download the file in the current time period and the percentage of the files that are allowed to be downloaded in the current time period, a target number of clients that are allowed to download the file in the current time period;
a selecting unit 60, configured to select a target number of clients from clients that need to download the file in a current time period; wherein the selected client is allowed to download the file.
In an embodiment, the file download control apparatus further includes:
the first calculation unit is used for carrying out Hash calculation on the current time to obtain a first Hash value of a first designated digit;
a first generating unit configured to generate a random number of a second designated bit of the target number by using a random algorithm;
the first combination unit is used for combining the first hash value and the random numbers of the target number respectively to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
the first sending unit is used for sending the tokens with the target number to the selected client; wherein, a token is correspondingly sent to a client.
In an embodiment, the file download control apparatus further includes:
the second calculation unit is used for carrying out Hash calculation on the current time to obtain a second Hash value of the first designated digit;
the second generating unit is used for generating a random number of a second designated bit number by adopting a random algorithm;
the second combination unit is used for combining the first hash value with the random number to obtain a token, and configuring the upper limit of the verification times of the token as a number corresponding to the target number;
and the second sending unit is used for respectively sending the tokens to each selected client.
In an embodiment, the file download control apparatus further includes:
the receiving unit is used for acquiring a token returned by the client when receiving a downloading request of any client;
the first judgment unit is used for acquiring the verification times of the token and judging whether the verification times are larger than the upper limit of the verification times or not;
the verifying unit is used for verifying whether the token is correct or not if the token is not larger than the preset threshold;
and the first downloading unit is used for allowing the client to download the file if the token is correct.
In an embodiment, the file download control apparatus further includes:
a fifth acquiring unit configured to acquire the size of the file;
a sixth obtaining unit, configured to obtain the total number of clients that need to download the file;
the first multiplying unit is used for multiplying the size of the file by the total number of the clients needing to download the file to obtain a first result;
a second judging unit, configured to judge whether the first result is greater than a first threshold;
the first processing unit is used for acquiring the client request quantity percentage in the current time period of the current time node information if the current time node information is larger than the preset time node information;
and the second processing unit is used for selecting all the clients needing to download the file in the current time period to download the file if the current time period is not greater than the preset time period.
In an embodiment, the file download control apparatus further includes:
a seventh acquiring unit configured to acquire the size of the file;
the second multiplying unit is used for multiplying the size of the file by the target number to obtain a second result;
a third judging unit, configured to judge whether the second result is greater than a second threshold;
a third calculating unit, configured to calculate a ratio of the second result to the second threshold if the second result is greater than the second threshold;
the third processing unit is used for dividing the upper limit value of the network speed with the ratio to obtain a third result; and taking the third result as the maximum value of the downloading speed of the file downloaded by the client.
In this embodiment, please refer to the method described in the above embodiment for specific implementation of each unit in the above apparatus embodiment, which is not described herein again.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing files and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a file download control method.
Those skilled in the art will appreciate that the architecture shown in fig. 3 is only a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects may be applied.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements a file download control method. It is to be understood that the computer readable storage medium in this embodiment may be a volatile readable storage medium or a non-volatile readable storage medium.
In summary, according to the file download control method, device, computer device and storage medium provided in the embodiments of the present application, when a file is published, the percentage of the client request amount in the time period in which the current time node information is located is obtained; determining the percentage of the file allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period; further acquiring the target number of the clients allowed to download the file in the current time period according to the number of the clients needing to download the file in the current time period; finally, selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file. According to the method and the device, the number of the clients downloading the files at the same time in the same time period is limited, and the phenomenon that a large wave crest is generated due to the sharp increase of the bandwidth is avoided, so that the increase of the bandwidth cost is avoided.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, apparatus, article, or method that comprises the element.
The above description is only for the preferred embodiment of the present application and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.

Claims (7)

1. A file download control method is characterized by comprising the following steps:
acquiring current time node information when a file is issued;
acquiring the percentage of the client request quantity in the current time period of the current time node information; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in historical data;
determining the percentage of the file allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period;
acquiring the number of clients needing to download the file in the current time period;
acquiring the target number of the clients allowed to download the file in the current time period according to the number of the clients required to download the file in the current time period and the percentage of the files allowed to be downloaded in the current time period;
selecting a target number of clients from clients needing to download the file in the current time period; wherein the selected client is allowed to download the file;
after the step of selecting the target number of clients from the clients that need to download the file in the current time period, the method includes:
performing hash calculation on the current time to obtain a first hash value of a first specified digit;
generating a random number of a second designated bit of the target number by using a random algorithm;
combining the first hash value and the random numbers of the target number respectively to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
sending the tokens with the target number to the selected client; wherein, a token is correspondingly sent to one client; alternatively, the first and second electrodes may be,
after the step of selecting the target number of clients from the clients that need to download the file in the current time period, the method includes:
performing hash calculation on the current time to obtain a second hash value of a first designated digit;
generating a random number of a second designated bit number by adopting a random algorithm;
combining the second hash value with the random number to obtain a token, and configuring the upper limit of the verification times of the token as the number corresponding to the target number;
and respectively sending the token to each selected client.
2. The method of claim 1, wherein the step of sending the token to each selected client respectively comprises:
when a downloading request of any client is received, a token returned by the client is obtained;
obtaining the verification times of the token, and judging whether the verification times are greater than the upper limit of the verification times or not;
if not, verifying whether the token is correct;
and if the token is correct, allowing the client to download the file.
3. The file download control method according to claim 1, wherein after the step of obtaining the current time node information when the file is published, the method further comprises:
acquiring the size of the file;
acquiring the total number of clients needing to download the file;
multiplying the size of the file by the total number of the clients needing to download the file to obtain a first result;
judging whether the first result is larger than a first threshold value;
if the current time node information is larger than the preset time node information, entering the step of obtaining the client request quantity percentage in the current time period of the current time node information;
and if not, selecting all clients needing to download the file in the current time period to download the file.
4. The method according to claim 1, wherein the step of selecting a target number of clients from the clients that need to download the file in the current time period is followed by:
acquiring the size of the file;
multiplying the size of the file by the target number to obtain a second result;
judging whether the second result is larger than a second threshold value;
if so, calculating the ratio of the second result to the second threshold;
dividing the upper limit value of the network speed by the ratio to obtain a third result; and taking the third result as the maximum value of the downloading speed of the file downloaded by the client.
5. A file download control apparatus, comprising:
the first acquisition unit is used for acquiring the current time node information when the file is issued;
a second obtaining unit, configured to obtain a percentage of a client request amount in a current time period in which the current time node information is located; the client request quantity percentage in the current time period is the ratio of the number of clients sending requests in the current time period to the number of clients sending requests all day in the historical data;
the determining unit is used for determining the percentage of the files allowed to be downloaded in the current time period according to the percentage of the client request quantity in the current time period;
the third acquisition unit is used for acquiring the number of clients needing to download the file in the current time period;
a fourth obtaining unit, configured to obtain, according to the number of clients that need to download the file in the current time period and a percentage of the files that are allowed to be downloaded in the current time period, a target number of clients that are allowed to download the files in the current time period;
the selection unit is used for selecting a target number of clients from the clients needing to download the files in the current time period; wherein the selected client is allowed to download the file;
the file download control device further comprises:
the first calculation unit is used for carrying out Hash calculation on the current time to obtain a first Hash value of a first designated digit;
a first generating unit configured to generate a random number of a second designated bit of the target number by using a random algorithm;
the first combination unit is used for respectively combining the first hash value and the random numbers of the target number to obtain tokens of the target number; configuring the upper limit of the verification times of each token to be one time;
the first sending unit is used for sending the tokens with the target number to the selected client; one token is correspondingly sent to one client; alternatively, the first and second electrodes may be,
the file download control device further comprises:
the second calculation unit is used for carrying out Hash calculation on the current time to obtain a second Hash value of the first designated digit;
the second generating unit is used for generating a random number of a second designated bit number by adopting a random algorithm;
the second combination unit is used for combining the second hash value with the random number to obtain a token, and configuring the upper limit of the verification times of the token as a number corresponding to the target number;
and the second sending unit is used for respectively sending the tokens to each selected client.
6. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method according to any of claims 1 to 4.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN202011609512.XA 2020-12-30 2020-12-30 File downloading control method and device, computer equipment and storage medium Active CN112751930B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011609512.XA CN112751930B (en) 2020-12-30 2020-12-30 File downloading control method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011609512.XA CN112751930B (en) 2020-12-30 2020-12-30 File downloading control method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112751930A CN112751930A (en) 2021-05-04
CN112751930B true CN112751930B (en) 2022-11-25

Family

ID=75649545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011609512.XA Active CN112751930B (en) 2020-12-30 2020-12-30 File downloading control method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112751930B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114257598B (en) * 2021-12-17 2023-07-04 北京金堤科技有限公司 Resource downloading method and device, storage medium and electronic equipment
CN114650277B (en) * 2022-03-11 2023-10-31 中国工商银行股份有限公司 File transmission control method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102075367A (en) * 2011-02-21 2011-05-25 北京奇虎科技有限公司 Method and system for controlling downloading of patch packet, client and server
CN102904763A (en) * 2011-02-21 2013-01-30 北京奇虎科技有限公司 Method and system for controlling downloading of service pack, client and server
CN103997522A (en) * 2014-05-16 2014-08-20 广州金山网络科技有限公司 Content distribution network flow control method and terminal
CN105763616A (en) * 2016-03-29 2016-07-13 广东欧珀移动通信有限公司 Resource-downloading method and device
WO2017102713A1 (en) * 2015-12-15 2017-06-22 Koninklijke Kpn N.V. Controlling retrieval in adaptive streaming
CN109617996A (en) * 2019-01-04 2019-04-12 平安科技(深圳)有限公司 File uploads and method for down loading, server and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102075367A (en) * 2011-02-21 2011-05-25 北京奇虎科技有限公司 Method and system for controlling downloading of patch packet, client and server
CN102904763A (en) * 2011-02-21 2013-01-30 北京奇虎科技有限公司 Method and system for controlling downloading of service pack, client and server
CN103997522A (en) * 2014-05-16 2014-08-20 广州金山网络科技有限公司 Content distribution network flow control method and terminal
WO2017102713A1 (en) * 2015-12-15 2017-06-22 Koninklijke Kpn N.V. Controlling retrieval in adaptive streaming
CN105763616A (en) * 2016-03-29 2016-07-13 广东欧珀移动通信有限公司 Resource-downloading method and device
CN109617996A (en) * 2019-01-04 2019-04-12 平安科技(深圳)有限公司 File uploads and method for down loading, server and computer readable storage medium

Also Published As

Publication number Publication date
CN112751930A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
US11245770B2 (en) Locality based content distribution
CN112751930B (en) File downloading control method and device, computer equipment and storage medium
CN113542384B (en) Access request access control method, device, computer equipment and storage medium
CN112054897B (en) Outsourcing Internet of things data for protecting privacy based on block chain and integrity verification method for backup of outsourcing Internet of things data
CN110267060B (en) Video file storage injection method and device, computer equipment and storage medium
CN107251523B (en) Data storage method based on cloud service, integrity detection method and device and terminal equipment
CN111669402A (en) Encrypted communication method, device, equipment and storage medium
EP2909784B1 (en) Methods and nodes for handling usage policy
CN113709530B (en) Resource downloading method, system, electronic equipment and storage medium
CN113949579B (en) Website attack defense method and device, computer equipment and storage medium
CN115689741A (en) Calculation power transaction method, device and system
CN112104671B (en) Interface authorization monitoring method and device, computer equipment and storage medium
CN110933022A (en) Block processing method and device, computer equipment and storage medium
CN115913802A (en) Service data processing method and device, electronic equipment and storage medium
CN112995251B (en) Source returning method and device, electronic equipment and storage medium
CN111277416A (en) Interactive zero knowledge proof method, device, computer equipment and storage medium
CN110944007A (en) Network access management method, system, device and storage medium
CN113590994A (en) Data processing method, data processing device, computer equipment and storage medium
CN113656163A (en) Service resource scheduling method, device, computer equipment and storage medium
CN112953846B (en) Domain name bandwidth cost optimization type delivery method and device and computer equipment
CN116436692A (en) Data access method, device, equipment and storage medium
CN114022275A (en) Block chain transfer transaction method based on block chain and related equipment
CN111865832A (en) Resource allocation method, terminal, server and storage medium
CN112822020A (en) Network request method, network request device, computer equipment and storage medium
CN114219484A (en) Payment system interface management method and device

Legal Events

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