CN117544568A - Request processing method, device, equipment and storage medium - Google Patents

Request processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN117544568A
CN117544568A CN202311550569.0A CN202311550569A CN117544568A CN 117544568 A CN117544568 A CN 117544568A CN 202311550569 A CN202311550569 A CN 202311550569A CN 117544568 A CN117544568 A CN 117544568A
Authority
CN
China
Prior art keywords
target
request
fragment
token
tokens
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311550569.0A
Other languages
Chinese (zh)
Inventor
李伟伟
张志良
韩锐
谢镇东
马岩
刘迪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Volcano Engine Technology Co Ltd
Original Assignee
Beijing Volcano Engine Technology 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 Beijing Volcano Engine Technology Co Ltd filed Critical Beijing Volcano Engine Technology Co Ltd
Priority to CN202311550569.0A priority Critical patent/CN117544568A/en
Publication of CN117544568A publication Critical patent/CN117544568A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • H04L67/108Resource delivery mechanisms characterised by resources being split in blocks or fragments

Abstract

The embodiment of the disclosure provides a request processing method, a request processing device, request processing equipment and a storage medium. The method comprises the following steps: acquiring a target downloading request to be processed; determining the number of target fragments corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request; obtaining a slicing token from a slicing token container based on a target slicing quantity, wherein the slicing token container adds the slicing token at a target speed, and the target speed is determined based on a single slicing data quantity and a network bandwidth of a request processing end; and responding to the target downloading request based on the obtained fragment token. By the technical scheme of the embodiment of the disclosure, the balanced flow control of the downloading speed of each request can be realized, and the bandwidth utilization rate is improved.

Description

Request processing method, device, equipment and storage medium
Technical Field
Embodiments of the present disclosure relate to computer technology, and in particular, to a method, an apparatus, a device, and a storage medium for processing a request.
Background
With the rapid development of computer technology, response processing is required for a download request sent by a user. Currently, the request processing end generally passively receives all the download requests and directly responds to all the download requests. However, the existing method only considers to control the downloading speed of a single request, so that the downloading speed of different requests is excessively different, and the bandwidth utilization rate of the request processing end is reduced.
Disclosure of Invention
The disclosure provides a request processing method, a device, equipment and a storage medium, so that the balanced flow control of the downloading speed of each request is realized, and the bandwidth utilization rate is improved.
In a first aspect, an embodiment of the present disclosure provides a request processing method, including:
acquiring a target downloading request to be processed;
determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
obtaining a slicing token from a slicing token container based on the target slicing quantity, wherein the slicing token container adds the slicing token at a target speed, and the target speed is determined based on the single slicing data quantity and the network bandwidth of a request processing end;
and responding to the target downloading request based on the obtained fragment token.
In a second aspect, an embodiment of the present disclosure further provides a request processing apparatus, including:
the target downloading request acquisition module is used for acquiring a target downloading request to be processed;
the target fragment number determining module is used for determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
The fragmentation token acquisition module is used for acquiring the fragmentation tokens from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added with the fragmentation tokens at a target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end;
and the response processing module is used for carrying out response processing on the target downloading request based on the obtained fragment token.
In a third aspect, embodiments of the present disclosure further provide an electronic device, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the request processing method as described in any of the embodiments of the present disclosure.
In a fourth aspect, the disclosed embodiments also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a request processing method as described in any of the disclosed embodiments.
According to the method and the device for processing the data, the target fragmentation number corresponding to the target downloading request is determined based on the data quantity to be downloaded and the single fragmentation data quantity corresponding to the target downloading request to be processed, and the fragmentation tokens are obtained from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added into the fragmentation tokens at the target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end, so that the adding speed of the fragmentation tokens can be reasonably controlled based on the network bandwidth of the request processing end, equipment resources are fully utilized, and the bandwidth utilization rate is improved. Based on the fragment tokens obtained from the fragment token container, the target downloading request is responded, the downloading speeds of different requests can be balanced, and the balanced flow control of the downloading speed of each request is realized.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow chart of a request processing method according to an embodiment of the disclosure;
FIG. 2 is an exemplary diagram of a request processing procedure according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of another request processing method provided by an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a request processing device according to an embodiment of the disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a schematic flow chart of a request processing method provided by an embodiment of the present disclosure, where the embodiment of the present disclosure is suitable for a case of performing response processing on a download request of a user, and the method may be performed by a request processing device, where the device is integrated on a request processing end, and the device may be implemented in a form of software and/or hardware, optionally, implemented by an electronic device, where the electronic device may be a mobile terminal, a PC end, a server, or the like.
As shown in fig. 1, the request processing method specifically includes the following steps:
s110, acquiring a target downloading request to be processed.
The target download request may refer to a user download request that needs to be processed currently. The number of target download requests may be one or more.
Specifically, the request processing end and each user end may establish an HTTP (Hypertext Transfer Protocol, link hypertext transfer protocol) link, so that the target download request sent by each user end may be received through the HTTP link and the download data after the request response may be returned to the user end.
The request processing end may be an edge device in a distributed network, for example. Accordingly, S110 may include: and receiving a target downloading request sent by the user terminal through scheduling equipment in the distributed network.
Wherein the distributed network may comprise a scheduling device and a plurality of edge devices distributed at different locations. The scheduling device may serve as a central management node, and schedule the received download request to a specific edge device. The edge device may be an edge node, such as an edge server, for caching data.
Specifically, in the distributed network architecture, each user side sends a target downloading request to be processed to a scheduling device, and the scheduling device schedules the target downloading request to a specific one of the edge devices, so that each edge device can receive at least one target downloading request, and the downloading speed of all requests on each edge device is guaranteed to be balanced later.
S120, determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request.
The data amount to be downloaded may refer to the data amount requested to be downloaded by the target download request. The single-piece data size may be a preset data size of a single download data piece, that is, a data size corresponding to a single-piece token. The individual sliced data volumes can be determined based on experimental verification to obtain optimal equalization effects. The target number of fragments may refer to the number of fragment tokens that the target download request needs to obtain.
Specifically, for each target downloading request, the data size to be downloaded corresponding to the target downloading request may be divided by a single fragment data size, and the division result is rounded, for example, the division result is rounded, and the obtained integer is the target fragment number corresponding to the target downloading request.
S130, based on the target number of fragments, acquiring fragment tokens from a fragment token container, wherein the fragment token container adds fragment tokens at a target speed, and the target speed is determined based on the single fragment data amount and the network bandwidth of the request processing end.
Wherein the shard token may be used to characterize data that is allowed to be downloaded with a single amount of shard data. The sliced token container may be a token bucket for holding sliced tokens. The number of sliced tokens in the sliced token container is dynamically changing. The sliced tokens can be fetched from the sliced token container based on the download request and added to the sliced token container at a target rate. The network bandwidth of the request processing end may refer to the network bandwidth allocated to the request processing end.
Specifically, based on a single sliced data volume, the network bandwidth of the request processing end is divided into a plurality of slices, so that the target speed of adding the sliced token into the sliced token container is obtained, bandwidth balance control can be realized through the slices, and further balance of the downloading speed is ensured. For example, if the target speed is s, it indicates that s sliced tokens are added to the sliced token container every second, so that the network bandwidth can be utilized to the greatest extent. The sliced tokens are uniformly added in the sliced token container, that is, the time for generating each sliced token in the sliced token container is equal. For each target downloading request, the fragmented tokens with the target number of fragments can be taken out from the fragmented token container at one time, or the fragmented tokens with the target number of fragments can be taken out in multiple times.
Illustratively, determining the target speed based on the single fragmented data volume and the network bandwidth of the request processing end may include: dividing the network bandwidth of the request processing end by the single piece of data quantity, and determining the obtained division result as the target speed. For example, if the single piece of data is n kb, and the network bandwidth of the request processing end is bw kb/s, the target speed s of adding the piece of token into the piece of token container is: s=bw/n.
And S140, responding to the target downloading request based on the obtained fragment token.
Specifically, the request processing end reads the download data of the corresponding data volume from the data memory based on all the obtained fragment tokens and returns the download data, so that the download of the corresponding data volume is realized, and the response processing to the target download request is completed. By controlling the addition of the fragmentation tokens in the fragmentation token container, the acquisition speed of the fragmentation can be controlled for each target downloading request, and each target downloading request needs to be responded and processed based on the acquired fragmentation tokens, so that the downloading speed of each request can be balanced, the downloading speed of each request is basically the same in the same period, the equipment resources of the request processing end are fully utilized, the problem of unbalanced downloading speed on each HTTP link is solved, the bandwidth utilization rate of each edge equipment is within the equipment capacity range, and the bandwidth utilization rate of the equipment is prevented from exceeding.
Illustratively, S140 may include: determining a target data volume to be downloaded based on the obtained fragment token; and reading target downloading data with target data quantity corresponding to the target downloading request from the data memory, and returning the target downloading data.
The data memory may be hardware for storing data in the request processing end. For example, the data store may be, but is not limited to, a hard disk. Specifically, the obtained number of the fragment tokens may be multiplied by a single fragment data amount, and the obtained multiplication result is the target data amount to be downloaded. And reading target downloading data with target data quantity corresponding to the target downloading request from the data memory, and returning the target downloading data to the user side through the HTTP link, thereby completing response processing of the target downloading request.
It should be noted that, the requested download speed=download data amount/download time= (target number of slices m×single slice data amount)/(time required for the slice token container to generate m slice tokens+read m slice data times from the data storage+network transmission time) = (m×single slice data amount)/(time required for the slice token container to generate 1 slice token×m+network transmission time) is approximately equal to single slice data amount/(time required for the slice token container to generate 1 slice token+read 1 slice data time from the data storage). The principle of the last step is as follows: the network transmission time is strongly related to the distance between the user terminal and the request processing terminal and the network quality of an operator, the time consumption is short, the difference between the users is not large, and the users can be ignored; m on the numerator denominator is eliminated, and the remainder is constant, so the download speed per request is substantially equal.
According to the technical scheme, the target fragmentation number corresponding to the target downloading request is determined based on the data quantity to be downloaded and the single fragmentation data quantity corresponding to the target downloading request to be processed, and the fragmentation tokens are obtained from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added into the fragmentation tokens at the target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end, so that the adding speed of the fragmentation tokens can be reasonably controlled based on the network bandwidth of the request processing end, equipment resources are fully utilized, and the bandwidth utilization rate is improved. Based on the fragment tokens obtained from the fragment token container, the target downloading request is responded, the downloading speeds of different requests can be balanced, and the balanced flow control of the downloading speed of each request is realized.
Based on the above technical solution, before S120, the method may further include: acquiring current request information, wherein the current request information comprises: the number of current requests processed per second and/or the number of current concurrent requests; and carrying out current limiting control on the target downloading request based on the current request information and a preset current limiting threshold.
The current number of requests processed per second may refer to QPS (Queries Per Second) at the current time in the request processing end. The current concurrent request number may refer to the number of requests that are not processed at the current time in the request processing end. For example, the number of requests currently being processed and the number of unprocessed requests currently received are added to obtain the number of concurrent requests currently.
Specifically, before the slice equalization control is performed, the current request number processed per second can be obtained, whether the current request number processed per second is greater than or equal to a preset current limiting threshold value or not is detected, if yes, current limiting control is performed on a currently received target downloading request, QPS is reduced, the request processing speed is controlled, and QPS control is achieved. For example, two current limiting thresholds may be preset, namely a first current limiting threshold and a second current limiting threshold, and the second current limiting threshold is greater than the first current limiting threshold. The current limit control is performed when the current request number processed per second is greater than or equal to the second current limit threshold value, until the current request number processed per second is less than or equal to the first current limit threshold value, the current limit control is released, so that the smooth control of the QPS can be realized.
Or before the slice equalization control is performed, the current concurrent request quantity can be obtained, whether the current concurrent request quantity is larger than or equal to a preset current limiting threshold value or not is detected, if yes, the current limiting control is required to be performed on the currently received target downloading request, the concurrent quantity is reduced, the quantity of downloading tasks is controlled, and the lowest downloading speed of the request is controlled. For example, the minimum download speed is required to be 100kb/s, the network bandwidth allocated to the request processing end is 50Mb/s, and the upper limit of the number of concurrent requests is 50Mb/s/100 kb/s=500. For example, two current limiting thresholds may be preset, namely a first current limiting threshold and a second current limiting threshold, and the second current limiting threshold is greater than the first current limiting threshold. And when the current concurrent request quantity is larger than or equal to the second current limiting threshold, current limiting control is carried out until the current concurrent request quantity is smaller than or equal to the first current limiting threshold, and current limiting control is released, so that concurrent smooth control can be realized.
Alternatively, as shown in fig. 2, QPS control may be performed based on the current number of requests processed per second first after receiving the target download request. After the QPS control is passed, concurrent control is performed based on the current concurrent request quantity. After the concurrency control is passed, the slice equalization control is performed through the steps S120-S140, so as to realize the fine control of the download request. If the QPS control or the concurrency control is not passed, the response failure result is directly returned to the user side. By utilizing the QPS control and the concurrent request quantity control, a large number of requests can be prevented from being burst, and the situation that the available bandwidth divided by each request is too low is avoided, so that the user downloading experience is prevented from being influenced.
Fig. 3 is a schematic flow chart of another request processing method provided in an embodiment of the present disclosure, where the step of "obtaining a sharded token from a sharded token container based on a target sharded number" is optimized based on the above disclosed embodiment, and the step of "responding to a target download request based on the obtained sharded token" is also optimized based on the above disclosed embodiment. Wherein the same or corresponding terms as those of the above-described embodiments are not explained in detail herein.
As shown in fig. 3, the request processing method specifically includes the following steps:
s310, acquiring a target downloading request to be processed.
S320, determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request.
S330, obtaining a preset number of sliced tokens from the sliced token container each time until the sliced tokens of the target sliced number are obtained, wherein the sliced token container adds the sliced tokens at a target speed, and the target speed is determined based on the single sliced data quantity and the network bandwidth of the request processing end.
The preset number may be preset, and each request includes the number of the fragment tokens acquired at one time. The preset number has a lower limit value and an upper limit value to prevent the bandwidth from increasing suddenly due to excessive one-time transmission. For example, the lower limit value of the preset number is 1. The upper limit value of the preset number may refer to the number of fragment tokens corresponding to the data block that is sent at most once, for example, the upper limit value is: 2X 1024/n, n is single slice data quantity, which shows that data can be read according to 2MB each time, the read-write granularity is moderate, and the logic is relatively less complex.
Specifically, the request processing end obtains a preset number of fragmented tokens from the fragmented token container each time based on each received target downloading request, and each target downloading request can alternately obtain the preset number of fragmented tokens from the fragmented token container until each target downloading request obtains a corresponding target fragmented number of fragmented tokens. For example, if the preset number is 1, all target download requests may cross take out 1 sliced token from the sliced token container, for example, one target download request may take out one sliced token from the sliced token container according to a fixed or random request sequence, and then the next target download request may take out one sliced token from the sliced token container until the target sliced number of sliced tokens is obtained.
Illustratively, S330 may include: if the preset number of the fragment tokens does not exist in the fragment token container currently, detecting whether the response is overtime currently; if the current response is not overtime, carrying out sleep waiting based on the preset sleep time, and acquiring a preset number of fragment tokens from the fragment token container after the sleep is awakened.
Specifically, each time each target download request obtains a sliced token from the sliced token container, if there is no preset number of sliced tokens in the sliced token container, it needs to detect whether the response time is overtime, such as detecting whether the response time allowed by the target download request is exceeded. If the current response is not overtime, the user can sleep and wait for preset sleep time, for example, sleep for 2ms and wait for adding a new slicing token into the slicing token container, and automatically wake up after the sleep time is up, and a preset number of slicing tokens are acquired from the slicing token container. If the preset number of the sliced tokens still do not exist in the sliced token container after the sleep wakeup, the sleep waiting can be continued under the condition that the current non-response is overtime until the preset number of the sliced tokens are successfully obtained or the response is overtime. If the current response is overtime, the request download failure can be directly returned to the user terminal.
Illustratively, S330 may include: if the target downloading request currently acquires the public lock corresponding to the partitioned token container, updating the state of the public lock to be an occupied state, and acquiring a preset number of partitioned tokens from the partitioned token container; and updating the state of the public lock into an idle state after the preset number of fragment tokens are acquired at the present time.
Specifically, a common lock may be set for the sliced token containers, and the first received target download request first obtains the common lock. If a plurality of target downloading requests are received at the same time, all the target downloading requests randomly rob the public lock based on the same probability, so that each target downloading request can randomly acquire the opportunity of acquiring the fragment token from the fragment token container once, and the situation that some requests cannot rob the public lock for a long time is avoided. If a target download request currently acquires the public lock, that is, the target download request acquires the authority of the public lock, the state of the public lock can be updated to be an occupied state, so that other requests are prevented from acquiring the public lock. The common lock can effectively control each request to acquire the fragment token independently from the container, so that the downloading speed of each request is balanced.
It should be noted that the time for each target download request to wait for generating the preset number of fragment tokens is approximately equal, so as to ensure that the download speed of each request is also substantially consistent.
S340, responding to the target downloading request based on the obtained fragment tokens each time.
Specifically, the request processing end determines the target data volume to be downloaded each time based on the fragment token obtained by the target downloading request each time, reads target downloading data with the target data volume corresponding to the target downloading request from the data memory, and returns the target downloading data to the user end, thereby completing the response processing of the target downloading request.
According to the technical scheme, the preset number of the fragment tokens are obtained from the fragment token container each time through each target downloading request until the target number of the fragment tokens is obtained, so that each target downloading request carries out data downloading in a mode of obtaining a small number of fragment tokens each time, and the balance of downloading speed of each request can be further guaranteed.
Fig. 4 is a schematic structural diagram of a request processing apparatus according to an embodiment of the present disclosure, as shown in fig. 4, where the apparatus specifically includes: a target download request acquisition module 410, a target number of fragments determination module 420, a fragment token acquisition module 430, and a response processing module 440.
The target download request acquiring module 410 is configured to acquire a target download request to be processed; a target number of slices determining module 420, configured to determine a target number of slices corresponding to the target downloading request based on a data amount to be downloaded and a single data amount of slices corresponding to the target downloading request; a sliced token obtaining module 430, configured to obtain sliced tokens from a sliced token container based on the target sliced number, where the sliced token container joins the sliced tokens at a target speed, where the target speed is determined based on the single sliced data amount and the network bandwidth of the request processing end; and the response processing module 440 is used for performing response processing on the target downloading request based on the obtained fragment token.
According to the technical scheme provided by the embodiment of the disclosure, the target fragmentation number corresponding to the target downloading request is determined based on the data quantity to be downloaded and the single fragmentation data quantity corresponding to the target downloading request, and the fragmentation tokens are obtained from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added into the fragmentation tokens at the target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end, so that the adding speed of the fragmentation tokens can be reasonably controlled based on the network bandwidth of the request processing end, the equipment resources are fully utilized, and the bandwidth utilization rate is improved. Based on the fragment tokens obtained from the fragment token container, the target downloading request is responded, the downloading speeds of different requests can be balanced, and the balanced flow control of the downloading speed of each request is realized.
Based on the above technical solution, the fragment token obtaining module 430 is specifically configured to: obtaining a preset number of fragment tokens from a fragment token container each time until the target fragment number of fragment tokens are obtained;
the response processing module 440 is specifically configured to: and responding to the target downloading request based on the obtained slicing tokens each time.
Based on the above technical solutions, the fragment token obtaining module 430 is specifically configured to:
if the preset number of the fragment tokens does not exist in the fragment token container currently, detecting whether the response is overtime currently; if the current response is not overtime, carrying out sleep waiting based on the preset sleep time, and acquiring a preset number of fragment tokens from the fragment token container after the sleep is awakened.
Based on the above technical solutions, the fragment token obtaining module 430 is specifically configured to:
if the target downloading request currently acquires the public lock corresponding to the partitioned token container, updating the state of the public lock to be an occupied state, and acquiring a preset number of partitioned tokens from the partitioned token container; and updating the state of the public lock into an idle state after the preset number of fragment tokens are acquired at the present time.
Based on the above technical solutions, the response processing module 440 is specifically configured to:
determining a target data volume to be downloaded based on the obtained fragment token; and reading target downloading data with the target data quantity corresponding to the target downloading request from a data memory, and returning the target downloading data.
On the basis of the technical schemes, the device further comprises:
a target speed determination module for: dividing the network bandwidth of the request processing end by the single piece of data quantity, and determining the obtained division result as the target speed.
On the basis of the technical schemes, the device further comprises:
the current limiting control module is configured to obtain current request information before determining a target fragment number corresponding to the target downloading request based on a data amount to be downloaded and a single fragment data amount corresponding to the target downloading request, where the current request information includes: the number of current requests processed per second and/or the number of current concurrent requests; and carrying out current limiting control on the target downloading request based on the current request information and a preset current limiting threshold value.
On the basis of the technical schemes, the request processing end is edge equipment in a distributed network;
The target download request acquisition module 410 is specifically configured to: and receiving a target downloading request sent by the user terminal through scheduling equipment in the distributed network.
The request processing device provided by the embodiment of the disclosure can execute the request processing method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of executing the request processing method.
It should be noted that each unit and module included in the above apparatus are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for convenience of distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure. Referring now to fig. 5, a schematic diagram of an electronic device (e.g., a terminal device or server in fig. 5) 500 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 5, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The electronic device provided by the embodiment of the present disclosure and the request processing method provided by the foregoing embodiment belong to the same inventive concept, and technical details not described in detail in the present embodiment may be referred to the foregoing embodiment, and the present embodiment has the same beneficial effects as the foregoing embodiment.
The present disclosure provides a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the request processing method provided by the above embodiments.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a target downloading request to be processed; determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request; obtaining a slicing token from a slicing token container based on the target slicing quantity, wherein the slicing token container adds the slicing token at a target speed, and the target speed is determined based on the single slicing data quantity and the network bandwidth of a request processing end; and responding to the target downloading request based on the obtained fragment token.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a request processing method, including:
acquiring a target downloading request to be processed;
determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
obtaining a slicing token from a slicing token container based on the target slicing quantity, wherein the slicing token container adds the slicing token at a target speed, and the target speed is determined based on the single slicing data quantity and the network bandwidth of a request processing end;
and responding to the target downloading request based on the obtained fragment token.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example two ] further comprising:
optionally, the obtaining the slicing tokens from the slicing token container based on the target slicing number includes:
obtaining a preset number of fragment tokens from a fragment token container each time until the target fragment number of fragment tokens are obtained;
the responding processing of the target downloading request based on the obtained fragment token comprises the following steps:
And responding to the target downloading request based on the obtained slicing tokens each time.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example three ], further comprising:
optionally, the obtaining a preset number of sliced tokens from the sliced token container each time includes:
if the preset number of the fragment tokens does not exist in the fragment token container currently, detecting whether the response is overtime currently;
if the current response is not overtime, carrying out sleep waiting based on the preset sleep time, and acquiring a preset number of fragment tokens from the fragment token container after the sleep is awakened.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example four ], further comprising:
optionally, the obtaining a preset number of sliced tokens from the sliced token container each time includes:
if the target downloading request currently acquires the public lock corresponding to the partitioned token container, updating the state of the public lock to be an occupied state, and acquiring a preset number of partitioned tokens from the partitioned token container;
and updating the state of the public lock into an idle state after the preset number of fragment tokens are acquired at the present time.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example five ], further comprising:
optionally, the responding processing for the target downloading request based on the obtained fragment token includes:
determining a target data volume to be downloaded based on the obtained fragment token;
and reading target downloading data with the target data quantity corresponding to the target downloading request from a data memory, and returning the target downloading data.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example six ], further comprising:
optionally, determining the target speed based on the single fragmented data volume and the network bandwidth of the request processing end includes:
dividing the network bandwidth of the request processing end by the single piece of data quantity, and determining the obtained division result as the target speed.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example seventh ], further comprising:
optionally, before determining the target number of fragments corresponding to the target downloading request based on the data to be downloaded and the single fragment data corresponding to the target downloading request, the method further includes:
Acquiring current request information, wherein the current request information comprises: the number of current requests processed per second and/or the number of current concurrent requests;
and carrying out current limiting control on the target downloading request based on the current request information and a preset current limiting threshold value.
According to one or more embodiments of the present disclosure, there is provided a request processing method [ example eight ], further comprising:
optionally, the request processing end is an edge device in the distributed network;
the obtaining the target downloading request to be processed comprises the following steps:
and receiving a target downloading request sent by the user terminal through scheduling equipment in the distributed network.
According to one or more embodiments of the present disclosure, there is provided a request processing apparatus, including:
the target downloading request acquisition module is used for acquiring a target downloading request to be processed;
the target fragment number determining module is used for determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
the fragmentation token acquisition module is used for acquiring the fragmentation tokens from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added with the fragmentation tokens at a target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end;
And the response processing module is used for carrying out response processing on the target downloading request based on the obtained fragment token.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (11)

1. A method of processing a request, comprising:
acquiring a target downloading request to be processed;
determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
obtaining a slicing token from a slicing token container based on the target slicing quantity, wherein the slicing token container adds the slicing token at a target speed, and the target speed is determined based on the single slicing data quantity and the network bandwidth of a request processing end;
and responding to the target downloading request based on the obtained fragment token.
2. The method according to claim 1, wherein the obtaining the sliced tokens from the sliced token container based on the target sliced number includes:
Obtaining a preset number of fragment tokens from a fragment token container each time until the target fragment number of fragment tokens are obtained;
the responding processing of the target downloading request based on the obtained fragment token comprises the following steps:
and responding to the target downloading request based on the obtained slicing tokens each time.
3. The method for processing a request according to claim 2, wherein each time a preset number of fragmented tokens are acquired from the fragmented token container, the method comprises:
if the preset number of the fragment tokens does not exist in the fragment token container currently, detecting whether the response is overtime currently;
if the current response is not overtime, carrying out sleep waiting based on the preset sleep time, and acquiring a preset number of fragment tokens from the fragment token container after the sleep is awakened.
4. The method for processing a request according to claim 2, wherein each time a preset number of fragmented tokens are acquired from the fragmented token container, the method comprises:
if the target downloading request currently acquires the public lock corresponding to the partitioned token container, updating the state of the public lock to be an occupied state, and acquiring a preset number of partitioned tokens from the partitioned token container;
And updating the state of the public lock into an idle state after the preset number of fragment tokens are acquired at the present time.
5. The request processing method according to claim 1, wherein the responding the target download request based on the obtained fragmented token includes:
determining a target data volume to be downloaded based on the obtained fragment token;
and reading target downloading data with the target data quantity corresponding to the target downloading request from a data memory, and returning the target downloading data.
6. The request processing method according to claim 1, wherein determining the target speed based on the single fragmented data volume and a network bandwidth of a request processing side comprises:
dividing the network bandwidth of the request processing end by the single piece of data quantity, and determining the obtained division result as the target speed.
7. The request processing method according to claim 1, further comprising, before determining the target number of fragments corresponding to the target download request based on the amount of data to be downloaded and the single amount of fragment data corresponding to the target download request:
acquiring current request information, wherein the current request information comprises: the number of current requests processed per second and/or the number of current concurrent requests;
And carrying out current limiting control on the target downloading request based on the current request information and a preset current limiting threshold value.
8. The method for processing a request according to any one of claims 1 to 7, wherein the request processing end is an edge device in a distributed network;
the obtaining the target downloading request to be processed comprises the following steps:
and receiving a target downloading request sent by the user terminal through scheduling equipment in the distributed network.
9. A request processing apparatus, comprising:
the target downloading request acquisition module is used for acquiring a target downloading request to be processed;
the target fragment number determining module is used for determining the target fragment number corresponding to the target downloading request based on the data quantity to be downloaded and the single fragment data quantity corresponding to the target downloading request;
the fragmentation token acquisition module is used for acquiring the fragmentation tokens from the fragmentation token container based on the target fragmentation number, wherein the fragmentation token container is added with the fragmentation tokens at a target speed, and the target speed is determined based on the single fragmentation data quantity and the network bandwidth of the request processing end;
and the response processing module is used for carrying out response processing on the target downloading request based on the obtained fragment token.
10. An electronic device, the electronic device comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the request processing method of any of claims 1-8.
11. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the request processing method of any of claims 1-8.
CN202311550569.0A 2023-11-20 2023-11-20 Request processing method, device, equipment and storage medium Pending CN117544568A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311550569.0A CN117544568A (en) 2023-11-20 2023-11-20 Request processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311550569.0A CN117544568A (en) 2023-11-20 2023-11-20 Request processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117544568A true CN117544568A (en) 2024-02-09

Family

ID=89782016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311550569.0A Pending CN117544568A (en) 2023-11-20 2023-11-20 Request processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117544568A (en)

Similar Documents

Publication Publication Date Title
CN108696374B (en) Method and device for updating client configuration
CN112637287B (en) Load balancing method and equipment
CN111488185B (en) Page data processing method, device, electronic equipment and readable medium
CN111221638B (en) Concurrent task scheduling processing method, device, equipment and medium
CN111246228B (en) Method, device, medium and electronic equipment for updating gift resources of live broadcast room
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN112379982B (en) Task processing method, device, electronic equipment and computer readable storage medium
CN111427706A (en) Data processing method, multi-server system, database, electronic device, and storage medium
CN110768861B (en) Method, device, medium and electronic equipment for obtaining overtime threshold
CN115237589A (en) SR-IOV-based virtualization method, device and equipment
CN109862069B (en) Message processing method and device
CN117544568A (en) Request processing method, device, equipment and storage medium
CN114785770A (en) Mirror layer file sending method and device, electronic equipment and computer readable medium
CN111756833B (en) Node processing method, node processing device, electronic equipment and computer readable medium
CN112163176A (en) Data storage method and device, electronic equipment and computer readable medium
CN114006871A (en) Flow control method, flow control device, container and storage medium
CN114138427A (en) SLO guarantee method, SLO guarantee device, node, and storage medium
CN112860439A (en) Application starting method and device, terminal and storage medium
CN113368494A (en) Cloud equipment distribution method and device, electronic equipment and storage medium
CN112149019A (en) Method, apparatus, electronic device, and computer-readable medium for displaying information
CN112860431A (en) Connection method, system, equipment and storage medium of micro service node
CN111538721A (en) Account processing method and device, electronic equipment and computer readable storage medium
CN110633141A (en) Memory management method and device of application program, terminal equipment and medium
CN111324387A (en) Application task control method, device, terminal and system
CN111385643B (en) Method and device for storing data, electronic equipment and storage medium

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