US-12621375-B2 - Data uploading method and apparatus, device, and medium
Abstract
Embodiments of the present disclosure disclose a data uploading method and apparatus, a device, and a medium. The method includes: in response to a preset operation triggered by a user before uploading application data, obtaining at least two data uploading protocols; performing data uploading performance testing on each data uploading protocol on the basis of a preset performance testing means, and determining a target uploading protocol that matches with a current network on the basis of a performance testing result; and in response to an application data uploading operation triggered by the user, uploading current target application data to be uploaded on the basis of the target uploading protocol.
Inventors
- Qian Ma
- Liyang Sun
- Mingming Shen
- Hao Dong
- Lei Zhai
Assignees
- BEIJING BYTEDANCE NETWORK TECHNOLOGY CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20230228
- Priority Date
- 20220309
Claims (18)
- 1 . A method of uploading data, comprising: in response to a preset operation triggered by a user before uploading application data, obtaining at least two data uploading protocols; based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, and based on a performance test result, determining a target uploading protocol matched with current network; in response to an application data uploading operation triggered by the user, and based on the target uploading protocol, uploading target application data currently to be uploaded; and wherein after obtaining the at least two data uploading protocols, the method further comprises: calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols, wherein the calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols comprises: detecting whether a current cache duration of a last available domain name corresponding to each of the at least two data uploading protocols is greater than a preset effective duration, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is greater than the preset effective duration, calling the domain name acquiring interface of the server and acquiring the currently available domain name corresponding to the data uploading protocol, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is less than or equal to the preset effective duration, taking the last available domain name corresponding to the data uploading protocol as the currently available domain name corresponding to the data uploading protocol.
- 2 . The method according to claim 1 , wherein the application data comprises: an audio, a video, an image or a file; and the preset operation comprises: a data collecting operation, a data importing operation or a data editing operation.
- 3 . The method according to claim 1 , wherein the based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, comprises: based on the each data uploading protocol, uploading a preset data packet, and determining the performance test result corresponding to the each data uploading protocol.
- 4 . The method according to claim 3 , wherein the performance test result comprises: information about whether a speed test is successful, network speed information and round-trip time information.
- 5 . The method according to claim 1 , further comprises: in response to that the performance test is not completely completed in the case where the user triggers the application data uploading operation, determining the target uploading protocol matched with the current network based on at least two performance test results currently completed, or, determining the target uploading protocol matched with the current network based on at least one of device model information of an uploading terminal and historical uploading information of the user.
- 6 . The method according to claim 1 , wherein the data uploading protocol comprises: an uploading protocol based on a transmission control protocol TCP, an uploading protocol based on a user datagram protocol UDP or a self-defined uploading protocol.
- 7 . The method according to claim 6 , wherein the based on the target uploading protocol, uploading target application data currently to be uploaded, comprises: in response to that the target uploading protocol is the self-defined uploading protocol, performing a configuration optimization on the self-defined uploading protocol based on a performance test result corresponding to the self-defined uploading protocol to obtain optimized target configuration information; and based on the self-defined uploading protocol and the target configuration information, uploading the target application data currently to be uploaded.
- 8 . The method according to claim 1 , further comprising: monitoring an uploading performance index in an uploading process of the target application data; in response to that the uploading performance index meets a preset protocol switching condition, stopping an uploading operation, re-determining the target uploading protocol matched with the current network, and uploading remaining application data which is not uploaded currently based on re-determined target uploading protocol.
- 9 . The method according to claim 1 , wherein the based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, comprises: based on the preset performance test mode and the currently available domain name corresponding to the each data uploading protocol, performing the data uploading performance tests on the each data uploading protocol; wherein the based on the target uploading protocol, uploading target application data currently to be uploaded, comprises: based on the target uploading protocol and the currently available domain name corresponding to the target uploading protocol, uploading the target application data currently to be uploaded.
- 10 . An electronic device, comprising: at least one processor; and a memory, configured to store at least one program; wherein in the case where the at least one program is executed by the at least one processor, the at least one processor is caused to perform operations comprising: in response to a preset operation triggered by a user before uploading application data, obtaining at least two data uploading protocols; based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, and based on a performance test result, determining a target uploading protocol matched with current network; in response to an application data uploading operation triggered by the user, and based on the target uploading protocol, uploading target application data currently to be uploaded; and wherein after obtaining the at least two data uploading protocols, the operations further comprise: calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols, wherein the calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols comprises: detecting whether a current cache duration of a last available domain name corresponding to each of the at least two data uploading protocols is greater than a preset effective duration, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is greater than the preset effective duration, calling the domain name acquiring interface of the server and acquiring the currently available domain name corresponding to the data uploading protocol, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is less than or equal to the preset effective duration, taking the last available domain name corresponding to the data uploading protocol as the currently available domain name corresponding to the data uploading protocol.
- 11 . The electronic device according to claim 10 , the operations further comprising: based on the each data uploading protocol, uploading a preset data packet, and determining the performance test result corresponding to the each data uploading protocol.
- 12 . The electronic device according to claim 10 , the operations further comprising: in response to that the performance test is not completely completed in the case where the user triggers the application data uploading operation, determining the target uploading protocol matched with the current network based on at least two performance test results currently completed, or, determining the target uploading protocol matched with the current network based on at least one of device model information of an uploading terminal and historical uploading information of the user.
- 13 . The electronic device according to claim 10 , wherein the data uploading protocol comprises: an uploading protocol based on a transmission control protocol TCP, an uploading protocol based on a user datagram protocol UDP or a self-defined uploading protocol.
- 14 . The electronic device according to claim 13 , the operations further comprising: in response to that the target uploading protocol is the self-defined uploading protocol, performing a configuration optimization on the self-defined uploading protocol based on a performance test result corresponding to the self-defined uploading protocol to obtain optimized target configuration information; and based on the self-defined uploading protocol and the target configuration information, uploading the target application data currently to be uploaded.
- 15 . The electronic device according to claim 10 , the operations further comprising: monitoring an uploading performance index in an uploading process of the target application data; in response to that the uploading performance index meets a preset protocol switching condition, stopping an uploading operation, re-determining the target uploading protocol matched with the current network, and uploading remaining application data which is not uploaded currently based on re-determined target uploading protocol.
- 16 . The electronic device according to claim 10 , the operations further comprising: calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to the each data uploading protocol.
- 17 . The electronic device according to claim 16 , the operations further comprising: based on the preset performance test mode and the currently available domain name corresponding to the each data uploading protocol, performing the data uploading performance tests on the each data uploading protocol; wherein the based on the target uploading protocol, uploading target application data currently to be uploaded, comprises: based on the target uploading protocol and the currently available domain name corresponding to the target uploading protocol, uploading the target application data currently to be uploaded.
- 18 . A non-transitory computer-readable storage medium, on which a computer program is stored, wherein in the case where the program is executed by a processor, the program causes the processor to perform operations comprising: in response to a preset operation triggered by a user before uploading application data, obtaining at least two data uploading protocols; based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, and based on a performance test result, determining a target uploading protocol matched with current network; in response to an application data uploading operation triggered by the user, and based on the target uploading protocol, uploading target application data currently to be uploaded; and wherein after obtaining the at least two data uploading protocols, the operations further comprise: calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols, wherein the calling a domain name acquiring interface of a server and acquiring a currently available domain name corresponding to each of the at least two data uploading protocols comprises: detecting whether a current cache duration of a last available domain name corresponding to each of the at least two data uploading protocols is greater than a preset effective duration, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is greater than the preset effective duration, calling the domain name acquiring interface of the server and acquiring the currently available domain name corresponding to the data uploading protocol, in response to that the current cache duration of the last available domain name corresponding to each of the at least two data uploading protocols is less than or equal to the preset effective duration, taking the last available domain name corresponding to the data uploading protocol as the currently available domain name corresponding to the data uploading protocol.
Description
This application is a national phase application of International Patent Application No. PCT/CN2023/078820, filed on Feb. 28, 2023, which claims the priority to and benefits of the Chinee Patent Application No. 20210226539.3, filed on Mar. 9, 2022. All the aforementioned patent applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD The embodiment of the present disclosure relates to Internet technology, for example to a data uploading method, apparatus, device and medium. BACKGROUND With the development of the Internet, users can upload application data through the network. For example, users can upload a captured video to a server of an application. An uploading process of application data depends on an uploading protocol of a transport layer. At present, users' application data is usually uploaded by using a fixed uploading protocol. However, under different network conditions, using a single fixed uploading protocol cannot effectively guarantee upload performance, thus reducing users' experience. SUMMARY The embodiments of the present disclosure provides a data uploading method, an apparatus, a device and a medium, so as to realize dynamic switching of data uploading protocols, effectively ensure uploading performance and improve user's experience. In a first aspect, the embodiments of the present disclosure provide a data uploading method, including: in response to a preset operation triggered by a user before uploading application data, obtaining at least two data uploading protocols;based on a preset performance test mode, performing data uploading performance tests on each data uploading protocol, and based on a performance test result, determining a target uploading protocol matched with current network; andin response to an application data uploading operation triggered by the user, and based on the target uploading protocol, uploading target application data currently to be uploaded. In a second aspect, the embodiments of the present disclosure further provide a data uploading apparatus, including: a data uploading protocol obtaining module, configured to obtain at least two data uploading protocols in response to a preset operation triggered by a user before uploading application data;a performance test module, configured to perform data uploading performance tests on each data uploading protocol based on a preset performance test mode, and determine a target uploading protocol matched with current network based on a performance testing result; andan application data uploading module, configured to upload target application data currently to be uploaded based on the target uploading protocol in response to an application data uploading operation triggered by the user. In a third aspect, the embodiments of the present disclosure further provide an electronic device, which includes: at least one processor;a memory, configured to store at least one program;in the case where the at least one program is executed by the at least one processor, the at least one processor is caused to realize the data uploading method provided by any embodiment of the present disclosure. In a fourth aspect, the embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored, the data uploading method provided by any embodiment of the present disclosure is realized in the case where the program is executed by a processor. BRIEF DESCRIPTION OF DRAWINGS FIG. 1 is a flowchart of a data uploading method provided in embodiment 1 of the present disclosure; FIG. 2 is a flowchart of a data uploading method provided in embodiment 2 of the present disclosure; FIG. 3 is a structural schematic diagram of a data uploading apparatus provided in embodiment 3 of the present disclosure; FIG. 4 is a structural schematic diagram of an electronic device provided in embodiment 4 of the present disclosure. DETAILED DESCRIPTION Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. It should be understood that the steps described in the method embodiments of the present disclosure may be performed in a different order and/or 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 used in this article are open-ended inclusion, namely “including but not limited to”. The term “based on” refers to “at least partially based on”. The term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one other embodiment”; and the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms may be given in the description hereinafter. It should be noted that concepts such as “first” and “second” mentioned in the present disclosure are only used to dist