File transmission method and device, electronic equipment and storage medium
By obtaining the target user's file upload request and the original file, and determining the file processing method based on the rate limiting configuration parameters, the problem of excessive server bandwidth consumption was solved, and the stability and flexibility of business operation were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2026-03-27
AI Technical Summary
The existing service method leads to excessive server bandwidth consumption when providing services to the outside world, which affects the stability of other normal business operations.
By obtaining the target user's file upload request and the original file, the file processing method is determined based on the rate limiting configuration parameters, including the maximum capacity limit, the maximum data volume limit, the maximum transfer rate, and the sleep interval, and the file transfer process is dynamically controlled.
This system enables the determination of file processing methods based on the rate limiting configuration parameters of the target user, ensuring the stability of business operations, avoiding excessive server bandwidth consumption, and improving the flexibility and stability of the business.
Smart Images

Figure CN115801763B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a file transmission method and device, electronic equipment and storage medium. BACKGROUND
[0002] With the rapid development of computer technology, existing service providers embed products and services into application programs of cooperative Internet scene platforms to provide services for a large number of users.
[0003] However, the existing service method often simultaneously processes all requests, and thus a large number of external files need to be received in the process of providing services to the outside, which leads to excessive occupation of server bandwidth and affects other normal businesses. SUMMARY
[0004] The present application provides a file transmission method and device, electronic equipment and storage medium, which dynamically limits the transmission process of files based on flow limiting configuration parameters, thereby improving the stability of business operation.
[0005] In a first aspect, the present application provides a file transmission method, comprising:
[0006] obtaining a file upload request and an original file sent by a target user;
[0007] obtaining flow limiting configuration parameters corresponding to the target user based on the file upload request; wherein the flow limiting configuration parameters include maximum limit capacity, maximum limit data volume, maximum transmission rate, sleep interval and current file capacity;
[0008] determining a file processing mode based on the original file and the flow limiting configuration parameters, and performing file transmission based on the file processing mode.
[0009] In a second aspect, the present application also provides a file transmission device, which comprises:
[0010] a file obtaining module configured to obtain a file upload request and an original file sent by a target user;
[0011] a flow limiting configuration parameter obtaining module configured to obtain flow limiting configuration parameters corresponding to the target user based on the file upload request; wherein the flow limiting configuration parameters include maximum limit capacity, maximum limit data volume, maximum transmission rate, sleep interval and current file capacity;
[0012] a file transmission module configured to determine a file processing mode based on the original file and the flow limiting configuration parameters, and perform file transmission based on the file processing mode.
[0013] In a third aspect, an electronic device is provided, and the device includes:
[0014] one or more processors; and
[0015] a memory communicatively connected to the at least one processor; wherein
[0016] the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to implement the file transmission method according to any of the embodiments of the present application.
[0017] In a fourth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the file transmission method according to any of the embodiments of the present application.
[0018] The technical solution of the embodiments of the present application acquires the file upload request and the original file sent by the target user, then acquires the flow limiting configuration parameter corresponding to the target user based on the file upload request, finally determines the file processing mode based on the original file and the flow limiting configuration parameter, and performs file transmission based on the file processing mode. Based on the above technical solution, the processing mode of the file is determined according to the flow limiting configuration parameter corresponding to the target user, and the file to be uploaded by the user is processed according to the file processing mode, thereby ensuring the stability during the operation of the business, and realizing the dynamic flow limiting mode of the file transmission according to the flow limiting configuration parameter corresponding to the target user.
[0019] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments are briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0021] Figure 1 is a flow diagram of a file transmission method provided by the embodiments of the present application;
[0022] Figure 2 is a flow diagram of a file transmission method provided by the embodiments of the present application;
[0023] Figure 3is a structural block diagram of a file transmission device provided by an embodiment of the present application.
[0024] Figure 4 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0026] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Embodiment one
[0028] Figure 1 A flowchart of a file transmission method provided by an embodiment of the present application is shown in the figure. The embodiment can be applicable to determining the processing mode of the uploaded file based on the flow limiting configuration parameters corresponding to the user, and transmitting the file according to the file processing mode. The method can be executed by a file transmission device, which can be realized in the form of hardware and / or software. The device can be configured in an electronic device, which can be a server or the like.
[0029] As shown in the figure, the method comprises: Figure 1
[0030] S110, obtaining a file upload request and an original file sent by a target user.
[0031] The target user can be a user who needs to upload a file. The file upload request can be understood as a request information generated by the user through a corresponding control on a terminal device when the user needs to upload a file. The original file can be a file that the user needs to upload.
[0032] Specifically, when a user needs to upload a file, they can trigger a file upload control on their terminal device to generate a corresponding file upload request and select the original file to be uploaded. After the user completes the selection, the file upload request and the original file are sent to the server, which then receives them. For example, when a user needs to upload a file, they can select the original file to be uploaded and then trigger the corresponding control to generate a file upload request, which the server then retrieves. Alternatively, when a user needs to use a specific function in the application, they can trigger the corresponding control to issue a file upload request and automatically determine the original file to be uploaded. In this case, the original file can be a file used to verify user permission information.
[0033] S120. Obtain the rate limiting configuration parameters corresponding to the target user based on the file upload request.
[0034] The rate limiting configuration parameters are information used to restrict traffic transmission. These parameters include maximum capacity limit, maximum data limit, maximum transfer rate, sleep interval, and current file size. Maximum capacity limit refers to the maximum number of files the server can currently handle. Maximum data limit can be understood as the maximum amount of data in a file that the server can process. Maximum transfer rate can be a pre-set maximum transfer speed during file transfer. Sleep interval can be understood as the duration of sleep required if file transfer is currently impossible. Current file size can be the number of files the server is currently processing.
[0035] Specifically, upon receiving a file upload request, the request can be parsed to obtain the rate limiting configuration parameters corresponding to the target user. These parameters can then be used to determine the file processing method. For example, the rate limiting configuration parameters matching the file upload request can be searched in a pre-set user information database. It's important to note that the rate limiting configuration parameters are user-specific; different users may have different parameters. For instance, the rate limiting parameters can be determined based on the user's spending level.
[0036] Based on the above technical solution, the step of obtaining the rate limiting configuration parameters corresponding to the target user based on the file upload request includes: extracting user identification information from the file upload request; and obtaining rate limiting configuration parameters matching the user identification information from the data source based on the user identification information.
[0037] The user identification information can be identification information of the target user, such as account information, an identity ID, or other information that can be used for identity identification. The data source can be understood as a database for storing user data.
[0038] Specifically, the received file upload is parsed to obtain user identification information corresponding to the target user, and then the user identification information is used to search the data source for flow limiting configuration parameters that match the user identification information, and the found flow limiting configuration parameters are used as flow limiting configuration parameters corresponding to the target user. For example, the account information can be matched in the database. When the user information table matching the account information is obtained, the flow limiting configuration parameters corresponding to the target user can be extracted from the user information table, and then the file transmission is completed according to the flow limiting configuration parameters.
[0039] S130, determining a file processing mode based on the original file and the flow limiting configuration parameters, and performing file transmission based on the file processing mode.
[0040] The file processing mode can be understood as a processing mode used when uploading the original file.
[0041] Specifically, after the original file is preliminarily parsed, the attribute information of the original file is obtained, and the attribute information of the original file is compared with the flow limiting configuration parameters. If the attribute information of the original file does not match the flow limiting configuration parameters, it is determined that the current original file cannot be transmitted, and the corresponding prompt information is sent to the user. If the attribute information of the original file matches the flow limiting configuration parameters, it is determined that the current original file meets the transmission condition, and the file transmission is normally performed.
[0042] On the basis of the above technical solution, before determining the file processing mode based on the original file and the flow limiting configuration parameters, and performing file transmission based on the file processing mode, the following steps are included: detecting the current file capacity and the maximum limit capacity; if the current file capacity is greater than the maximum limit capacity, the current file capacity and the maximum limit capacity are detected again after a sleep interval; if the current file capacity is less than the maximum limit capacity, the file processing mode is determined based on the original file and the flow limiting configuration parameters.
[0043] Specifically, before file transmission, the current file capacity of the server is detected. If the current file capacity being processed by the server is greater than the maximum limit capacity that the server can bear, it is determined that the current condition does not meet the file transmission condition, the file transmission is temporarily stopped, and after a sleep interval is satisfied, the current file capacity and the maximum limit capacity are detected again. If the file transmission condition is satisfied, the file processing mode is determined according to the original file and the throttling configuration parameter. If the file transmission condition is still not satisfied, the file transmission is continued to be paused for a sleep interval until the current file capacity is less than the file transmission condition.
[0044] On the basis of the above technical solution, the file processing mode is determined based on the original file and the throttling configuration parameter, including: dividing the original file into a plurality of data blocks according to a preset data amount; determining the file processing mode based on each data block and the throttling configuration parameter, and performing file transmission based on the file processing mode.
[0045] The preset data amount can be a pre-set data transmission amount. The data block can be understood as a data block obtained by dividing the file according to the preset data amount.
[0046] Specifically, the original file is divided into a plurality of data blocks according to a preset data amount. It should be noted that the data amount in the divided data block is equal to the preset data amount, and then the file processing mode of the original file is determined according to each data block and the throttling configuration parameter, and the original file is processed based on the file processing mode.
[0047] On the basis of the above technical solution, the file processing mode is determined based on the original file and the throttling configuration parameter, including: dividing the original file into a plurality of data blocks according to a preset data amount; determining the file processing mode based on each data block and the throttling configuration parameter, and performing file transmission based on the file processing mode.
[0048] The current data block can be understood as a data block that has completed file reading. The reading completion time can be time information when the data block completes reading. Correspondingly, the reading start time can be understood as time information when the current data block starts to be read. The reading speed can be the data reading speed of the current database. The next data block can be understood as the next data block to be read.
[0049] Specifically, when it is detected that the current data block is completed reading, time information of a current time when the current data block reading is completed and time information of a time when the current data block starts reading are acquired, and a reading duration of the current data block is determined based on the reading completion time and the reading start time, a reading speed of the current data block is determined according to the reading duration and a preset data amount, if the reading speed is greater than the maximum transmission rate, the next data block is processed after a sleep interval is paused, if the reading speed is less than the maximum transmission rate, the next data block is continuously read until reading of all data blocks is completed.
[0050] On the basis of the above technical solution, after the file processing mode is determined based on the original file and the throttling configuration parameter and the file transmission is performed based on the file processing mode, the original file data amount is acquired, and whether the original file meets a subsequent processing condition is determined according to the original file data amount and the maximum limit data amount; if the data amount of the original file is greater than the maximum limit data amount, it is determined that the original file does not meet the subsequent processing condition; if the data amount of the original file is less than the maximum limit data amount, it is determined that the original file meets the subsequent processing condition.
[0051] The original file data amount can be understood as a file size of the original file. The subsequent processing condition can be whether the original data amount meets a maximum limit data amount set in advance.
[0052] Specifically, the original file data amount is acquired, and whether the original file meets a subsequent processing condition is determined by comparing the original file data amount and the maximum limit data amount; if the original file data amount is greater than the maximum limit data amount, it is indicated that the current original file does not meet the subsequent processing condition; if the original file data amount is less than the maximum limit data amount, it is indicated that the current original file meets the subsequent processing condition. It should be noted that the server needs to perform subsequent processing on the file after receiving the file, and in order to avoid that a file with a large data amount occupies a large amount of server resources in the subsequent processing process, whether the current file meets the subsequent processing condition is determined based on the maximum limit data amount and the original file data amount.
[0053] On the basis of the above technical solution, if it is determined that the original file does not meet the subsequent processing condition, the response to the file upload request is immediately stopped, prompt information corresponding to the file upload request is generated, and the prompt information is sent to the target user; if the original file meets the subsequent processing condition, the original file is released after the response to the file upload request is completed, and the current file capacity is updated.
[0054] The prompt information can be prompt information for prompting the target user that the current original file does not meet the processing condition.
[0055] Specifically, if the data amount of the current original file is greater than the pre-set maximum limit data amount, it is determined that the current original file does not meet the subsequent processing condition, the response to the file upload request is immediately stopped, the prompt information corresponding to the file upload request is generated, and the prompt information is sent to the target user to prompt the user that the file upload cannot be completed based on the prompt information. If the data amount of the current original file is less than the pre-set maximum limit data amount, it is determined that the current original file meets the subsequent processing condition, the original file is released from the processing queue of the server after the response to the file upload request is completed, and the current file capacity is updated, for example, if the current original file meets the subsequent processing condition, the current file capacity is reduced by one after the subsequent processing of the original file is completed.
[0056] The technical scheme of the embodiment of the application acquires the file upload request and the original file sent by the target user, then acquires the flow limiting configuration parameter corresponding to the target user based on the file upload request, finally determines the file processing mode based on the original file and the flow limiting configuration parameter, and performs file transmission based on the file processing mode. Based on the above technical scheme, the processing mode of the file is determined according to the flow limiting configuration parameter corresponding to the target user, and the file to be uploaded by the user is processed according to the file processing mode, thereby ensuring the stability in the process of business operation, and realizing the dynamic flow limiting mode of file transmission according to the flow limiting configuration parameter corresponding to the target user.
[0057] Embodiment two
[0058] Figure 2 A flowchart of a file transmission method provided by the embodiment of the application. The embodiment further optimizes the above file transmission method on the basis of the above embodiment. The specific implementation manner can be referred to the technical scheme of the embodiment. The same or corresponding technical terms as those in the above embodiment are not described herein.
[0059] It should be noted that the open platform is a new innovative platform business model. The open platform service provider embeds products and services into the application program of the cooperative Internet scene platform through Api, H5, SDK and other means to realize ubiquitous open platform services. However, in the process of external service, there are a large number of external cooperation parties in the large file upload scene. In the face of complex network environment, in order to prevent the server bandwidth from being full during large file upload and affect other services of the server, it is necessary to limit the flow in the file upload process.
[0060] Receive file upload request and original file: specifically, the target user initiates a file upload request and determines the original file to be uploaded, assuming that the size of the original file is S, and sends the request to the server.
[0061] Reading the flow control configuration parameters: Specifically, the user identifier of the target user is extracted from the file upload request, and the relevant service flow control configuration parameters, including the maximum limit capacity: UpLoadTotalLimit, the maximum limit data volume SingleFileMax, the maximum transmission rate MaxRate, the sleep interval SleepTime, and the current file capacity CurrentSize, are read from the database according to the user identifier and saved in Redis. It should be noted that Redis (Remote Dictionary Server) is an open-source Key-Value database written in ANSI C, supporting network, and based on memory or persistent log. It also provides APIs in multiple languages.
[0062] Determining whether the current file capacity is greater than the maximum limit capacity: Specifically, it is checked whether the file volume currently being processed by the system is greater than UpLoadTotalLimit. If it is greater, the flow control is directly performed, for example, the current file transmission can be paused for a sleep period, and after the sleep period, it is again determined whether the current file capacity is greater than the maximum limit capacity.
[0063] Determining the data block reading speed: Specifically, the current original file is read, and the original file S is divided into multiple data blocks according to the preset data volume BlockSize. When a data block BlockSize is read, the current reading completion time NowTime, the start reading time of the current data block lastSentTick are obtained. Then the data block reading speed UploadRate = BlockSize / (NowTime-lastSenTick) is determined.
[0064] Determining the file reading method: Specifically, it is determined whether UploadRate is greater than the maximum limit transmission rate MaxRate. If it is not greater, the next data block is directly read. If it is greater, the process is put to sleep for SleepTime, and after the sleep is completed, the next data block is continued to be read, and the loop processing is continued until all data blocks are read.
[0065] Determining whether the original file is greater than the maximum limit data volume: Specifically, after the original file S is uploaded, it is determined whether the size of the original file is greater than the maximum limit data volume SingleFileMax. If it is greater than the maximum limit data volume SingleFileMax, it is determined that the current original file does not meet the subsequent processing condition, and the response is directly stopped, and the corresponding prompt information is fed back.
[0066] Update the current file capacity: specifically, after the original file is uploaded and the response to the file upload request is completed, the original file S is released from the memory, and the current file capacity is updated, for example, the current file capacity CurrentSize = CurrentSize-1, and the related data in Redis is updated.
[0067] The technical scheme of the embodiment of the application acquires the file upload request and the original file sent by the target user, then acquires the flow limiting configuration parameter corresponding to the target user based on the file upload request, finally determines the file processing mode based on the original file and the flow limiting configuration parameter, and performs file transmission based on the file processing mode. Based on the above technical scheme, the processing mode of the file is determined according to the flow limiting configuration parameter corresponding to the target user, and the file to be uploaded by the user is processed according to the file processing mode, thereby ensuring the stability during the operation of the business, realizing the scenario-based configuration of the flow limiting parameter, realizing the individualized configuration of a single output scene and a single partner, effectively improving the flexibility of the business, and introducing the concept of the total file pool, which can control the size of a single file and the size of the total parallel file pool, so that when the relevant background cannot be processed in time during the business peak period, the system will not be full of system memory due to the un-released files in the memory.
[0068] Embodiment three
[0069] Figure 3 A structural block diagram of a file transmission device provided by the embodiment of the application is provided. The device comprises a file acquisition module 310, a flow limiting configuration parameter acquisition module 320, and a file transmission module 330.
[0070] The file acquisition module 310 is configured to acquire the file upload request and the original file sent by the target user.
[0071] The flow limiting configuration parameter acquisition module 320 is configured to acquire the flow limiting configuration parameter corresponding to the target user based on the file upload request. The flow limiting configuration parameter comprises a maximum limit capacity, a maximum limit data volume, a maximum transmission rate, a sleep interval, and a current file capacity.
[0072] The file transmission module 330 is configured to determine the file processing mode based on the original file and the flow limiting configuration parameter, and perform file transmission based on the file processing mode.
[0073] On the basis of the above technical scheme, the flow limiting configuration parameter acquisition module is configured to extract the user identification information in the file upload request, and acquire the flow limiting configuration parameter matched with the user identification information from the data source based on the user identification information.
[0074] On the basis of the above technical solutions, the flow limiting configuration parameter acquisition module is configured to detect the current file capacity and the maximum limit capacity; if the current file capacity is greater than the maximum limit capacity, continue to detect the current file capacity and the maximum limit capacity after a sleep interval; and if the current file capacity is less than the maximum limit capacity, determine a file processing mode based on the original file and the flow limiting configuration parameter.
[0075] On the basis of the above technical solutions, the file acquisition module comprises a data block division unit configured to divide the original file into a plurality of data blocks according to a preset data amount; determine a file processing mode based on each data block and the flow limiting configuration parameter, and perform file transmission based on the file processing mode.
[0076] On the basis of the above technical solutions, the file acquisition module is configured to, when detecting that the current data block reading is completed, acquire a reading completion time and a reading start time of the current data block; determine a reading speed of the current data block based on the data block, the reading completion time and the reading start time; if the reading speed of the current data block is greater than the maximum transmission rate, read a next data block after a sleep interval; and if the current reading speed is less than the maximum transmission rate, continue to read the next data block until all data blocks are read.
[0077] On the basis of the above technical solutions, the device comprises a file processing module configured to acquire a data amount of the original file, and determine whether the original file meets a subsequent processing condition according to the original file data amount and the maximum limit data amount; if the data amount of the original file is greater than the maximum limit data amount, determine that the original file does not meet the subsequent processing condition; and if the data amount of the original file is less than the maximum limit data amount, determine that the original file meets the subsequent processing condition.
[0078] On the basis of the above technical solutions, the file processing module is configured to, if it is determined that the original file does not meet the subsequent processing condition, immediately stop responding to a file upload request, generate prompt information corresponding to the file upload request, and send the prompt information to the target user; and if the original file meets the subsequent processing condition, release the original file after completing the response to the file upload request, and update the current file capacity.
[0079] The technical scheme of the embodiment of the present application obtains a file uploading request and an original file sent by a target user, then obtains a flow limiting configuration parameter corresponding to the target user based on the file uploading request, finally determines a file processing mode based on the original file and the flow limiting configuration parameter, and performs file transmission based on the file processing mode. Based on the above technical scheme, the processing mode of the file is determined according to the flow limiting configuration parameter corresponding to the target user, and the file to be uploaded by the user is processed according to the file processing mode, thereby ensuring the stability in the process of business operation, and realizing the dynamic flow limiting mode of file transmission according to the flow limiting configuration parameter corresponding to the target user.
[0080] The file transmission device provided by the embodiment of the present application can execute the file transmission method provided by any one of the embodiments of the present disclosure, has the function modules and beneficial effects corresponding to the execution method.
[0081] It should be noted that each unit and module included in the above device is only divided according to the function logic, but is not limited to the above division, as long as the corresponding function can be realized; in addition, the specific name of each functional unit is only for convenient mutual distinction, and is not used to limit the protection scope of the embodiments of the present disclosure.
[0082] Embodiment three
[0083] Figure 4 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0084] As Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication. The memory stores computer programs executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0085] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0086] The processor 11 can be various general and / or special-purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the file transfer method.
[0087] In some embodiments, the file transfer method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the file transfer method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the file transfer method by any other appropriate means, such as by means of firmware.
[0088] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0089] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.
[0090] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0091] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0092] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by 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), a blockchain network, and the Internet.
[0093] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server is generally established using computer programs running on the respective computers and having a client-server relationship. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0094] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in series, or executed in different orders, as long as the desired results of the technical solutions of the present disclosure are achieved, and the present disclosure is not limited herein.
[0095] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A file transfer method characterized by, The method comprises the following steps: obtaining a file upload request and an original file sent by a target user; obtaining a flow limiting configuration parameter corresponding to the target user based on the file upload request; wherein the flow limiting configuration parameter comprises a maximum limit capacity, a maximum limit data volume, a maximum transmission rate, a sleep interval, and a current file capacity; determining a file processing mode based on the original file and the flow limiting configuration parameter, and performing file transmission based on the file processing mode; wherein, before determining the file processing mode based on the original file and the flow limiting configuration parameter, and performing file transmission based on the file processing mode, the method comprises the following steps: detecting the current file capacity and the maximum limit capacity, wherein the current file capacity is the number of files currently being processed by the server, and the maximum limit capacity is the maximum number of files that can be processed by the server currently; if the current file capacity is greater than the maximum limit capacity, then continue to detect the current file capacity and the maximum limit capacity after a sleep interval; if the current file capacity is less than the maximum limit capacity, then determine the file processing mode based on the original file and the flow limiting configuration parameter; wherein, the step of determining the file processing mode based on the original file and the flow limiting configuration parameter, and performing file transmission based on the file processing mode, comprises the following steps: obtaining attribute information of the original file after preliminary analysis of the original file; comparing the attribute information of the original file with the flow limiting configuration parameter; if the attribute information of the original file does not match the flow limiting configuration parameter, then determining that the current original file cannot be transmitted, and sending corresponding prompt information to the user; if the attribute information of the original file matches the flow limiting configuration parameter, then determining that the current original file meets the transmission condition, and performing file transmission.
2. The method of claim 1, wherein, The step of obtaining the flow limiting configuration parameter corresponding to the target user based on the file upload request comprises the following steps: extracting user identification information in the file upload request; obtaining a flow limiting configuration parameter matching the user identification information from a data source based on the user identification information.
3. The method of claim 1, wherein, The step of determining the file processing mode based on the original file and the flow limiting configuration parameter comprises the following steps: dividing the original file into multiple data blocks according to a preset data volume; determining the file processing mode based on each data block and the flow limiting configuration parameter, and performing file transmission based on the file processing mode.
4. The method of claim 3, wherein, The step of determining the file processing mode based on each data block and the flow limiting configuration parameter, and performing file transmission based on the file processing mode, comprises the following steps: when detecting that the reading of the current data block is completed, obtaining the reading completion time and the reading start time of the current data block; determining the reading speed of the current data block based on the data block, the reading completion time, and the reading start time; if the reading speed of the current data block is greater than the maximum transmission rate, then reading the next data block after a sleep interval; if the reading speed of the current data block is less than the maximum transmission rate, then continue to read the next data block until all data blocks are read.
5. The method of claim 1, wherein, After determining the file processing mode based on the original file and the throttling configuration parameter, and performing file transmission based on the file processing mode, the method comprises: obtaining the data amount of the original file, and determining whether the original file meets the subsequent processing condition according to the data amount of the original file and the maximum limited data amount; if the data amount of the original file is greater than the maximum limited data amount, determining that the original file does not meet the subsequent processing condition; if the data amount of the original file is less than the maximum limited data amount, determining that the original file meets the subsequent processing condition.
6. The method of claim 5, wherein, comprises: if it is determined that the original file does not meet the subsequent processing condition, immediately stopping responding to the file upload request, and generating prompt information corresponding to the file upload request, and sending the prompt information to the target user; if the original file meets the subsequent processing condition, releasing the original file after completing the response to the file upload request, and updating the current file capacity.
7. A file transfer apparatus characterized by comprising: comprises: a file acquisition module configured to acquire a file upload request and an original file sent by a target user; a throttling configuration parameter acquisition module configured to acquire a throttling configuration parameter corresponding to the target user based on the file upload request; wherein the throttling configuration parameter comprises a maximum limited capacity, a maximum limited data amount, a maximum transmission rate, a sleep interval, and a current file capacity; a file transmission module configured to determine a file processing mode based on the original file and the throttling configuration parameter, and perform file transmission based on the file processing mode; wherein the throttling configuration parameter acquisition module is further configured to detect the current file capacity and the maximum limited capacity, wherein the current file capacity is the number of files currently being processed by the server, and the maximum limited capacity is the maximum number of files that can be currently processed by the server; if the current file capacity is greater than the maximum limited capacity, continuing to detect the current file capacity and the maximum limited capacity after one sleep interval; if the current file capacity is less than the maximum limited capacity, determining the file processing mode based on the original file and the throttling configuration parameter; wherein the file transmission module is specifically configured to acquire attribute information of the original file after preliminary analysis of the original file; compare the attribute information of the original file with the throttling configuration parameter; if the attribute information of the original file does not match the throttling configuration parameter, determine that the current original file cannot be transmitted, and send corresponding prompt information to the user; if the attribute information of the original file matches the throttling configuration parameter, determine that the current original file meets the transmission condition, and perform file transmission.
8. An electronic device, comprising: The electronic device comprises: one or more processors; and a memory communicatively connected with the at least one processor; wherein the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the file transmission method of any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the processor to implement the file transmission method in any one of claims 1-6 when executed.
Citation Information
Patent Citations
Access request processing method and apparatus, and server
CN106375472A
Download control method and device, multimedia terminal, and computer storage medium
CN109218847A
Multi-thread uploading optimization method based on memory allocation
CN109547566A
Data import method and device
CN112100135A