Data transmission method and device, electronic equipment and computer readable storage medium
By selecting an appropriate data transmission path based on the data volume and the number of historical requests in long-connection, multi-request concurrent scenarios, the problem of excessively long loading rates in existing technologies is solved, achieving more efficient data transmission and page loading.
Patent Information
- Application Number
- CN202411082234.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2026-02-10
AI Technical Summary
Existing data transmission methods lack adaptation to scenarios with multiple concurrent requests over long connections, resulting in excessively long page loading times on the client side and a poor user experience.
By receiving current resource acquisition requests, determining the amount of requested data and the number of historical requests, selecting an appropriate data transmission path based on the data type, and employing edge cloud server caching or direct transmission, a differentiated transmission strategy is implemented to improve transmission efficiency.
In scenarios with long-lived connections and multiple concurrent requests, it improves data transmission efficiency, increases page loading speed, and enhances user experience.
Smart Images

Figure CN121509526A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet technology, and more specifically to a data transmission method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] With the rapid development of internet technology, online shopping has become an indispensable part of people's daily lives and work. From a network transmission perspective, the page loading speed of shopping websites is a key factor affecting the shopping experience. For example, when browsing a page, if the page loads quickly enough, the user is more likely to browse or shop on that page; conversely, if a page fails to load quickly, the probability of the user leaving the page increases, thus causing losses to content providers. Therefore, improving page loading speed has become a key focus for various Content Delivery Network (CDN) providers.
[0003] However, current data transmission methods are mainly geared towards general traffic transmission and lack adaptation to scenarios with long connections and multiple concurrent requests. This means that clients still face the problem of poor user experience due to excessively long loading times when browsing pages. Summary of the Invention
[0004] This application provides a data transmission method, apparatus, electronic device, and computer-readable storage medium that can adapt to data transmission in scenarios with long-term connections and multiple concurrent requests, and improve data transmission efficiency.
[0005] In a first aspect, embodiments of this application provide a data transmission method, including:
[0006] Receive a current resource acquisition request for a target page, wherein the current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page;
[0007] Based on the current resource identifier, determine the current request data corresponding to the current resource acquisition sub-request and the current data volume of the current request data;
[0008] Obtain historical resource acquisition requests, and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests;
[0009] Based on the current data volume and the historical request count, determine the data type of the current request data;
[0010] The data transmission path of the currently requested data is determined based on the data type, and the currently requested data is returned to the terminal corresponding to the current resource acquisition request according to the data transmission path.
[0011] Accordingly, embodiments of this application provide a data transmission apparatus, including:
[0012] The message receiving unit is used to receive a current resource acquisition request for a target page, wherein the current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page;
[0013] The resource determination unit is used to determine the current request data corresponding to the current resource acquisition sub-request and the current data volume of the current request data based on the current resource identifier;
[0014] The data query unit is used to obtain historical resource acquisition requests and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests;
[0015] A data processing unit is configured to determine the data type of the currently requested data based on the current data volume and the number of historical requests;
[0016] The data transmission unit is configured to determine the data transmission path of the currently requested data according to the data type, and return the currently requested data to the terminal corresponding to the current resource acquisition request according to the data transmission path.
[0017] In some embodiments, the data query unit may be specifically used to count the page resource requests received within a target statistical period to obtain a set of page resource requests, the set of page resource requests including the current resource acquisition request; take the statistical period in which the current resource acquisition request is located as the current statistical period, determine the previous statistical period within the target statistical period to obtain the target historical statistical period; and filter out the page resource requests corresponding to the target historical statistical period from the set of page resource requests to obtain the historical resource acquisition request.
[0018] In some embodiments, the data query unit may be specifically used to filter out historical resource identifiers corresponding to the current resource identifier of the current request data from the historical resource identifiers to obtain target historical resource identifiers; and count the number of target historical resource identifiers to obtain the number of historical requests.
[0019] In some embodiments, the data processing unit may be specifically used to sort the request data in the page resource request set based on the current data volume to obtain a first sorting position corresponding to the current request data; sort the request data in the historical resource acquisition requests based on the historical request count to obtain a second sorting position corresponding to the current request data; and determine the data type of the current request data according to the first sorting position and the second sorting position.
[0020] In some embodiments, the data processing unit may be specifically configured to extract the page resource sub-request corresponding to each page resource request from the page resource request set, and determine the resource identifier corresponding to the page resource sub-request to obtain a resource identifier set; determine the request data corresponding to each resource identifier in the resource identifier set and the request data volume of the request data, wherein the request data includes the current request data; and sort the request data volume according to the data volume to obtain the first sorting position.
[0021] In some embodiments, the data processing unit may be specifically used to filter out resource identifiers corresponding to a target historical statistical period from the resource identifier set to obtain a target period resource identifier set; if the target period resource identifier set includes a current resource identifier corresponding to the current request data, count the number of resource requests corresponding to each resource identifier in the target period resource identifier set; and sort the number of resource requests according to the number of requests to obtain the second sorting position.
[0022] In some embodiments, the data processing unit may be specifically used to determine that the current requested data is a first data type if the first sorting position is less than a preset first sorting position and the second sorting position is less than a preset second sorting position; and to determine that the current requested data is a second data type if the first sorting position is greater than or equal to the preset first sorting position or the second sorting position is greater than or equal to the preset second sorting position.
[0023] In some embodiments, the data transmission unit may be specifically used to determine the data transmission path as an indirect transmission path if the data type of the currently requested data is a first data type; and to determine the data transmission path as a direct transmission path if the data type of the currently requested data is a second data type.
[0024] In some embodiments, the data transmission unit may be specifically used to: if the data transmission path is the indirect transmission path, obtain a set of edge cloud servers that have established a data connection with the server; query the target edge cloud server corresponding to the terminal from the set of edge cloud servers; and send the current request data to the terminal through the target edge cloud server.
[0025] In some embodiments, the data transmission unit may be specifically used to obtain the current cache information of the target edge cloud server; if the current cache information indicates that the target edge cloud server has not cached the current request data, the current request data is sent to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal; if the current cache information indicates that the target edge cloud server has cached the current request data, a data feedback instruction for the current request data is sent to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal.
[0026] In some embodiments, the data transmission unit may be specifically used to obtain target cache information of the current request data; send the target cache information and the current request data to the target edge cloud server so that the target edge cloud server sends the current request data to the terminal; and update the current cache information based on the target cache information.
[0027] In some embodiments, the data transmission unit may be specifically configured to, if the data transmission path is the direct transmission path, determine the request data that has not been returned to the terminal at the current time from the current request data, obtain a set of remaining request data, the set of remaining request data including the target remaining request data corresponding to each current resource acquisition sub-request; compare the target remaining request data with the remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data; filter out the request data corresponding to the target data transmission volume from the target remaining request data to obtain the request data to be transmitted; and send the request data to be transmitted to the terminal corresponding to the current resource acquisition request based on the target transmission rate.
[0028] In some embodiments, the data transmission unit may be specifically configured to: determine the target transmission parameter value of the target remaining request data in the set of remaining request data based on the remaining data volume of the target remaining request data and the remaining data volume of the other target remaining request data, wherein the target transmission parameter value indicates the transmission priority of the target remaining request data; determine the data transmission weight of the target remaining request data in the current transmission process based on the target transmission parameter value; and determine the target data transmission volume, target transmission window, and target transmission rate of the target remaining request data in the current transmission process based on the target transmission parameter value and the data transmission weight.
[0029] In some embodiments, the data transmission unit may be specifically used to sort the target remaining request data in the remaining request data set according to the data volume to obtain the sorting position corresponding to the target remaining request data; input the sorting position corresponding to the target remaining request data and the remaining data volume into a preset priority calculation rule to obtain the target sending parameter value of the target remaining request data, wherein the sending parameter value indicates the sending priority of the target remaining request data.
[0030] In some embodiments, the data transmission unit may be specifically used to fuse the target transmission parameter values of each target remaining request data to obtain a fused parameter value; and to calculate the ratio between the target transmission parameter value and the fused parameter value to obtain the data transmission weight of the target remaining request data in this transmission process.
[0031] In some embodiments, the data transmission unit may be specifically used to obtain the sending window quota during the current transmission process, and determine the target data transmission volume of the target remaining requested data based on the sending window quota and the data transmission weight; determine the priority position of the target sending parameter value in the sending priority, and determine the target sending window and target transmission rate of the target remaining requested data based on the priority position.
[0032] Secondly, embodiments of this application provide a data transmission method, including:
[0033] When a user's instruction to browse page resources for a target page is received, a current resource acquisition request is generated based on the page resource browsing instruction;
[0034] Send the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page.
[0035] Upon receiving the current request data returned by the server for the current resource identifier, the target page is displayed;
[0036] The system detects the duration of the user's browsing of the target page and determines the connection duration with the server based on the browsing duration.
[0037] Accordingly, embodiments of this application provide a data transmission apparatus, including:
[0038] The instruction receiving unit is used to generate a current resource acquisition request based on the page resource browsing instruction triggered by the user for the target page when it receives the page resource browsing instruction.
[0039] The message sending unit is used to send the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page.
[0040] A page display unit is used to display the target page after receiving the current request data returned by the server for the current resource identifier;
[0041] The connection confirmation unit is used to detect the user's browsing time on the target page and determine the connection duration for connecting to the server based on the browsing time.
[0042] In some embodiments, the connection confirmation unit may be specifically used to: obtain at least one content page located before the target page to obtain a set of historical content pages; count the browsing time of the user on the set of historical content pages and smooth the browsing time to obtain a historical duration smoothing value; detect the browsing time of the user on the target page and calculate the connection duration based on the browsing time and the historical duration smoothing value.
[0043] In some embodiments, the connection confirmation unit may be specifically used to: determine a connection duration smoothing value based on browsing duration and historical duration smoothing value; and weight the connection duration smoothing value to obtain the connection duration.
[0044] Furthermore, embodiments of this application also provide an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to execute the data transmission method provided in embodiments of this application.
[0045] Furthermore, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the data transmission method provided in embodiments of this application.
[0046] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the data transmission methods provided in embodiments of this application.
[0047] This application embodiment receives a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier. Then, based on the current resource identifier, it determines the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request. Next, it acquires historical resource acquisition requests and queries the historical request count corresponding to the current request data from the historical resource acquisition requests. Then, based on the current data volume and the historical request count, it determines the data type of the current request data. Finally, it determines the data transmission path of the current request data according to the data type and returns the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path. Since this scheme is applicable to data transmission scenarios with multiple concurrent requests over long connections, it determines the current request data and the current data volume corresponding to each current resource acquisition sub-request carried in the current resource acquisition request. Based on this, it counts the historical request counts of the current request data, and then determines the data type of the current request data based on the historical request counts and the current data volume. Different data transmission paths are allocated to the current request data according to different data types, thereby implementing differentiated transmission strategies for multiple simultaneously received current resource acquisition sub-requests. This alleviates the impact of data with low transmission performance among multiple current request data on the overall loading time, thereby improving the efficiency of server-side data transmission and, consequently, improving the page loading speed of the user's terminal. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a schematic diagram illustrating an application scenario of the data transmission method provided in the embodiments of this application;
[0050] Figure 2 This is a flowchart illustrating a data transmission method provided in an embodiment of this application;
[0051] Figure 3This is a schematic diagram illustrating the composition of the target page and the current resource acquisition request corresponding to the target page, as provided in the embodiments of this application.
[0052] Figure 4 This is a schematic diagram illustrating the amount of data currently requested on the target page provided in this application embodiment;
[0053] Figure 5 This is a schematic diagram of the statistical period provided in the embodiments of this application;
[0054] Figure 6 This is a schematic diagram illustrating the identification status of multiple historical resource identifiers provided in the embodiments of this application;
[0055] Figure 7 This is a schematic diagram of the data transmission path provided in an embodiment of this application;
[0056] Figure 8 This is another schematic flowchart of the data transmission method provided in the embodiments of this application;
[0057] Figure 9 This is a timing diagram of the data transmission method provided in an embodiment of this application;
[0058] Figure 10 This is a schematic diagram of the structure of a data transmission device provided in an embodiment of this application.
[0059] Figure 11 This is a schematic diagram of another data transmission device provided in an embodiment of this application;
[0060] Figure 12 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0061] The technical solutions described below, with reference to the accompanying drawings, will be clearly and completely described. Obviously, the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0062] This application provides a data transmission method, apparatus, electronic device, and computer-readable storage medium. The data transmission apparatus can be integrated into an electronic device, which may be a server or a user terminal, etc. Specifically, this application provides a data transmission apparatus (which may be referred to as a server for distinction) suitable for a first electronic device, and a resource synchronization apparatus (which may be referred to as a terminal for distinction) suitable for a second electronic device.
[0063] The first electronic device can be a server, which can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud pre-built databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0064] The second electronic device can be a user terminal, which may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0065] In this embodiment, the server and the terminal can communicate via Transmission Control Protocol (TCP). Specifically, a long TCP connection can be used. A long TCP connection means that after a connection is successfully established, the connection is maintained even if there is no data transmission between the two parties. The operation steps of a long TCP connection can include establishing a connection → transmitting data → ... (maintaining the connection) ... → transmitting data → closing the connection. The above steps include: (1) the terminal (client) initiates a connection request to the server (server); (2) the server receives the connection request and the two parties establish a TCP connection; (3) the terminal sends a message to the server; (4) the server responds to the terminal message; (5) after one read / write operation is completed, the TCP connection is not closed; (6) subsequent read / write operations ...; (7) after a long period of operation, the terminal initiates a request to close the connection. Compared with short TCP connections, using a long TCP connection can save a lot of TCP connection establishment and closure operations, reduce waste, and save time.
[0066] For ease of explanation, this application embodiment will use the first electronic device as a server and the second electronic device as a terminal (client) used by the user as an example to introduce the data transmission method.
[0067] Figure 1 A schematic diagram illustrating an application scenario of the data transmission method provided in an embodiment of this application is shown. For example... Figure 1 As shown, a communication connection can be established between a terminal and a server. A server can have one or more terminals establishing communication connections with it.
[0068] Based on this, when the server receives a current resource retrieval request for a target page, which includes a current resource retrieval sub-request corresponding to at least one page resource on the target page and a current resource identifier, the server can determine the current request data and the current data volume corresponding to the current resource retrieval sub-request based on the current resource identifier. Then, the server can retrieve historical resource retrieval requests and query the historical request count corresponding to the current request data. Based on the current data volume and the historical request count, the server determines the data type of the current request data. Finally, the server can determine the data transmission path of the current request data based on the data type and return the current request data to the terminal corresponding to the current resource retrieval request according to the data transmission path.
[0069] For the terminal, upon receiving a page resource browsing instruction triggered by the user for the target page, a current resource retrieval request is generated based on the page resource browsing instruction; then, the current resource retrieval request is sent to the server, which includes a current resource retrieval sub-request corresponding to at least one page resource in the target page and a current resource identifier; after receiving the current request data returned by the server for the current resource identifier, the target page is displayed; then, the browsing duration of the user on the target page is detected, and the connection duration with the server is determined based on the browsing duration.
[0070] It should be noted that, Figure 1 There can be multiple terminals, and multiple terminals can send data access requests to the server at the same time or at different times.
[0071] It is understood that in the specific embodiments of this application, web pages and other related data are involved. When the following embodiments of this application are applied to specific products or technologies, permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0072] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0073] This embodiment will be described from the perspective of a data transmission device, which can be integrated into a first electronic device, which can be a server.
[0074] A data transmission method includes: receiving a current resource acquisition request for a target page, the current resource acquisition request including a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier; then, based on the current resource identifier, determining the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request; subsequently, acquiring historical resource acquisition requests and querying the historical request count corresponding to the current request data from the historical resource acquisition requests; then, based on the current data volume and the historical request count, determining the data type of the current request data; finally, determining the data transmission path of the current request data according to the data type, and returning the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path.
[0075] Figure 2 A flowchart illustrating the data transmission method provided in an embodiment of this application is shown. Figure 2 As shown, the specific process of this data transmission method is as follows:
[0076] 101. Receive a current resource acquisition request for the target page. The current resource acquisition request includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier.
[0077] When a user browses a webpage through a terminal, if the currently viewed webpage is webpage A, and the user wants to browse another webpage (webpage B), the terminal can send a resource retrieval request for webpage B to the server based on the user's input (such as a screen click on webpage B, or a search command). Correspondingly, the server can receive the resource retrieval request for webpage B. In the above application scenario, webpage B is the target page, and the resource retrieval request is the current resource retrieval request.
[0078] Generally, a target page may include at least one page resource, which can take the form of text, images, audio, video, links, etc. For example, a target page may include multiple images, meaning that multiple images together constitute the target page. Alternatively, a target page may include multiple images and multiple paragraphs of text, in which case the multiple images and multiple paragraphs of text together constitute the target page.
[0079] The current resource retrieval request received by the server for the target page includes at least one current resource retrieval sub-request. Each sub-request is a request to retrieve page resources within the target page; therefore, one page resource corresponds to one current resource retrieval sub-request. To facilitate server scheduling of the page resource corresponding to the current resource retrieval sub-request, the sub-request carries a current resource identifier. This identifier identifies the page resource corresponding to the current resource retrieval sub-request sent by the terminal. The current resource identifier can take various forms; for example, it can be a Uniform Resource Identifier (URI), meaning it can be a string identifying the name of a specific internet resource.
[0080] It should be understood that the form and composition of the page content on the target page are determined based on the actual browsing situation of the user. The page content presentation forms exemplified above are merely for illustration and do not limit the actual page content of the target page.
[0081] For ease of explanation, the following will use an example where the target page includes four page resources. Figure 3 This illustration shows a target page provided in an embodiment of this application, and a schematic diagram of the composition of the current resource acquisition request corresponding to the target page. For example... Figure 3 As shown, the target page includes four page resources: page resource 1, page resource 2, page resource 3, and page resource 4. Correspondingly, the current resource retrieval request includes four current resource retrieval sub-requests: current resource retrieval sub-request 1 corresponding to page resource 1, current resource retrieval sub-request 2 corresponding to page resource 2, current resource retrieval sub-request 3 corresponding to page resource 3, and current resource retrieval sub-request 4 corresponding to page resource 4.
[0082] Among them, the current resource acquisition sub-request 1 carries the current resource identifier 1, the current resource acquisition sub-request 2 carries the current resource identifier 2, the current resource acquisition sub-request 3 carries the current resource identifier 3, and the current resource acquisition sub-request 4 carries the current resource identifier 4.
[0083] 102. Based on the current resource identifier, determine the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request.
[0084] After determining the current resource retrieval sub-request and the current resource identifier for each page resource, the server can determine the current request data corresponding to the page resource (i.e., the current resource retrieval sub-request) based on the current resource identifier, and use the data volume of the current request data as the current data volume.
[0085] For example, in Figure 3 Based on the provided example, the data that can be obtained based on the current resource identifier 1 is called Current Request Data 1, the data that can be obtained based on the current resource identifier 2 is called Current Request Data 2, the data that can be obtained based on the current resource identifier 3 is called Current Request Data 3, and the data that can be obtained based on the current resource identifier 4 is called Current Request Data 4. The amount of data in each Current Request Data may be the same or different. Figure 4 This illustration shows the data volume of currently requested data on the target page provided in an embodiment of this application. For example... Figure 4 As shown, the current request data 1, current request data 2, current request data 3, and current request data 4 each correspond to different amounts of current data. The server needs to transmit these four current request data to the terminal (the terminal that sent the current resource retrieval request). During this process, different amounts of current request data may require different transmission times. Generally speaking, the larger the amount of current request data, the longer the transmission time. The transmission time for the server to transmit the above four current request data to the terminal depends on the one with the longest transmission time among the four current request data. Correspondingly, the time it takes for the target page to be fully loaded in the terminal also largely depends on the one with the longest transmission time among the four current request data.
[0086] As mentioned earlier, the server and the terminal can communicate using a long TCP connection. When a current resource acquisition request is received, since the current resource acquisition request includes at least one current resource acquisition sub-request, and each current resource acquisition sub-request corresponds to a current resource identifier, after receiving the current resource acquisition request, the server needs to schedule the corresponding current request data according to each current resource identifier and transmit all the current request data covered by the current resource acquisition request to the terminal in parallel. The above data transmission scenario is the long connection multi-request concurrency scenario.
[0087] 103. Obtain historical resource acquisition requests and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests.
[0088] Historical resource retrieval requests can be understood as resource retrieval requests received by the server that precede the current resource retrieval request. These historical requests may be the same as or different from the current request; that is, the page requested in the historical request may be the same as or different from the target page.
[0089] In this embodiment of the application, obtaining historical resource acquisition requests may include: counting the page resource requests received within a target statistical period to obtain a set of page resource requests, the set of page resource requests including the current resource acquisition request; taking the statistical period in which the current resource acquisition request is located as the current statistical period, determining the previous statistical period within the target statistical period to obtain the target historical statistical period; and filtering out the page resource requests corresponding to the target historical statistical period from the set of page resource requests to obtain the historical resource acquisition requests.
[0090] The server can divide the timeline into multiple time intervals according to preset time lengths. Each time interval corresponds to a statistical period. The server can include received page resource requests into the corresponding statistical period for analysis and management based on their reception time. It should be understood that the specific time length corresponding to the time interval can be set according to actual needs; for example, it could be 1 hour, 2 hours, 1 day, 1 week, etc. Furthermore, the time length corresponding to each statistical period can be the same or different.
[0091] The target statistical period can be understood as all statistical periods recorded by the server since it began performing data statistics. The current statistical period can be understood as the statistical period in which the server receives the current resource acquisition request. All statistical periods within the target statistical period and preceding the current statistical period are considered historical statistical periods. It should be noted that a historical statistical period includes at least one statistical period. For example, a historical statistical period may include the previous statistical period, the statistical period before that, and so on. Figure 5 A schematic diagram of the statistical period provided in an embodiment of this application is shown. For example... Figure 5 As shown, on the time axis T, time t3 is the current time. The server receives the current resource acquisition request at time t3. The statistical period at time t3 is the current statistical period, and the time interval corresponding to the current statistical period is t2-tn (t3 is within this time interval). It should be understood that time tn has not yet arrived. Figure 5 The text is marked with a dashed line.
[0092] Based on this, all statistical periods covered from the start point (0) of the time axis to time tn are collectively referred to as the target statistical period. All statistical periods covered from the start point (0) of the time axis to time t2 are collectively referred to as the historical statistical period. The target statistical period includes both historical statistical periods and the current statistical period.
[0093] In historical statistical periods, the previous statistical period (i.e., the time interval corresponding to t1-t2) is the target historical statistical period. Since the target statistical period includes historical statistical periods, it can also be said that, in the target statistical period, the previous statistical period (i.e., the time interval corresponding to t1-t2) is the target historical statistical period.
[0094] The server compiles all page resource requests received within the target statistical period into a request set, which can be called the page resource request set. It should be noted that the page resource requests in the page resource request set include all page resource requests sent by all terminals (including but not limited to the terminal corresponding to the current resource acquisition request) received by the server within the target statistical period.
[0095] Once the target historical statistical period is determined, all page resource requests received within the corresponding time interval can be filtered from the set of page resource requests. These filtered page resource requests are the historical resource retrieval requests. It should be understood that the number of page resource requests received by the server within the target historical statistical period may be one or more; correspondingly, the number of historical resource retrieval requests may also be one or more.
[0096] In this embodiment, the previous statistical period within the target statistical period is taken as the target historical statistical period, and page resource requests received within the target historical statistical period are obtained to obtain historical resource acquisition requests. The obtained historical resource acquisition requests can be used to determine the number of historical requests corresponding to the current request data. This means that the range for determining the number of current requests is locked to the previous statistical period closest to the current statistical period, which can minimize the amount of data comparison for page resource requests. At the same time, the latest resource acquisition request information can be obtained, thereby improving the accuracy of determining the number of historical requests for the current request data.
[0097] Each historical resource retrieval request includes at least one historical resource retrieval sub-request, and each sub-request corresponds to a historical resource identifier. The purpose of each historical resource retrieval request is to request the server to transmit the corresponding webpage. The difference between historical and current resource retrieval requests lies in the time at which the server receives them. Therefore, referring to the current resource retrieval request, a historical resource retrieval request can include at least one historical resource retrieval sub-request. Each sub-request is a request to retrieve page resources within a webpage; one page resource corresponds to one historical resource retrieval sub-request, and each sub-request carries a resource identifier (referred to as the historical resource identifier for easy distinction).
[0098] Based on this, querying the number of historical requests corresponding to the current request data from the historical resource acquisition requests can include: filtering out the historical resource identifiers that correspond to the current resource identifier of the current request data from the historical resource identifiers to obtain the target historical resource identifier; and counting the number of target historical resource identifiers to obtain the number of historical requests.
[0099] In practical applications, for the same webpage, different terminals may send corresponding resource acquisition requests to the server to obtain that webpage. Furthermore, these terminals may send resource acquisition requests for that webpage to the server at any time. Therefore, for a target page, in addition to being requested by terminals within the current statistical period, it may also be requested by terminals in any statistical period throughout history. Moreover, within the same statistical period, the target page may be requested by terminals multiple times. Since a webpage can include at least one page resource, similarly, for the same page resource, different terminals may send corresponding resource acquisition sub-requests to the server to obtain that page resource. Furthermore, these terminals may send resource acquisition sub-requests for that page resource to the server at any time. Therefore, for any page resource contained within the target page, in addition to being requested by terminals within the current statistical period, it may also be requested by terminals in any statistical period throughout history. Moreover, within the same statistical period, any page resource contained within the target page may be requested by terminals multiple times.
[0100] In response, after determining all historical resource identifiers covered within the target historical statistical period, the server can compare the current resource identifier with the historical resource identifiers, use the historical resource identifiers that are the same as the current resource identifier as the target historical resource identifier, and count the number of target historical resource identifiers to obtain the historical request count of the current request data.
[0101] For example, in the aforementioned example, the current resource acquisition request carries four current resource identifiers: current resource identifier 1, current resource identifier 2, current resource identifier 3, and current resource identifier 4. If the server receives historical resource acquisition requests within the target historical statistical period that carry multiple historical resource identifiers... Figure 6 This diagram illustrates the identification of multiple historical resource identifiers provided in an embodiment of this application. For example... Figure 6As shown, the historical resource identifiers carried in the historical resource retrieval requests received by the server within the target historical statistical period include: historical resource identifier 1 (4 identifiers), historical resource identifier 2 (1 identifier), historical resource identifier 4 (2 identifiers), historical resource identifier 5 (1 identifier), historical resource identifier 7 (1 identifier), historical resource identifier 8 (1 identifier), and historical resource identifier 12 (1 identifier). Therefore, the number of historical resource identifiers 1 that are identical to the current resource identifier 1 is 4, and correspondingly, the number of historical requests corresponding to the current request data 1 is 4. Similarly, the number of historical requests corresponding to the current request data 2 is 1; the number of historical requests corresponding to the current request data 3 is 0; and the number of historical requests corresponding to the current request data 4 is 2.
[0102] 104. Based on the current data volume and the number of historical requests, determine the data type of the currently requested data.
[0103] After determining the current data volume and historical request count of the current requested data, the data type of the current requested data can be determined based on these two factors. In this embodiment, determining the data type of the current requested data based on the current data volume and historical request count may include: sorting the request data in the page resource request set based on the current data volume to obtain a first sorting position corresponding to the current requested data; sorting the request data in historical resource acquisition requests based on the historical request count to obtain a second sorting position corresponding to the current requested data; and determining the data type of the current requested data based on the first and second sorting positions.
[0104] In determining the first sorting position for the current request data, the sorting objects include the request data covered by the set of page resource requests corresponding to the target statistical period. Specifically, the request data volume corresponding to each request data can be sorted in descending order or ascending order to obtain the sorting position of the data volume corresponding to each request data. Since the current request data is one of the above request data, the sorting position of the data volume corresponding to the current request data can be used as the first sorting position.
[0105] In determining the second ranking position corresponding to the current request data, the sorting objects include the request data covered by historical resource acquisition requests corresponding to the target historical statistical period. Specifically, the request counts corresponding to each request data can be sorted in descending order or ascending order to obtain the ranking position of the request counts for each request data. If the current request data is the same as one or more of the above request data, the ranking position of the request counts corresponding to the same request data can be used as the second ranking position.
[0106] After determining the first and second sorting positions corresponding to each currently requested data, the data type of the currently requested data can be determined based on the first and second sorting positions. In this embodiment, the first sorting position (determined based on the current data volume) and the second sorting position (based on the number of historical requests) of the currently requested data are considered comprehensively, that is, the data type of the currently requested data is determined from two dimensions: data volume and request count. This can improve the comprehensiveness and accuracy of the evaluation of the data type of the currently requested data.
[0107] Specifically, sorting the request data in the page resource request set based on the current data volume to obtain the first sorting position corresponding to the current request data may include: extracting the page resource sub-request corresponding to each page resource request in the page resource request set, and determining the resource identifier corresponding to the page resource sub-request to obtain a resource identifier set; determining the request data and the request data volume corresponding to each resource identifier in the resource identifier set, wherein the request data includes the current request data; and sorting the request data volume according to the data volume to obtain the first sorting position.
[0108] In determining the request data corresponding to each resource identifier in the resource identifier set, if two or more identical resource identifiers exist, it indicates that the request data corresponding to these identical resource identifiers is also identical. Therefore, only the request data corresponding to any one of these resource identifiers can be selected, and the amount of request data corresponding to that request data can be determined for subsequent sorting according to data size. It should be understood that the current request data is one member of the request data set.
[0109] For ease of explanation, the data is sorted in descending order of volume. Since the number of resource identifiers in the resource identifier set may gradually increase over time, to visually represent the current request data's ranking within the target statistical period, the sorting result can be normalized after sorting by volume. For example, if there are 200 request data items involved in the sorting, and the current request data's ranking is 10th, then 10 / 200 can be used as the first ranking of that current request data. That is, after normalization, the first ranking of that current request data is 0.05.
[0110] Specifically, sorting the request data in historical resource acquisition requests based on the number of historical requests to obtain the second sorting position corresponding to the current request data may include: filtering out resource identifiers corresponding to the target historical statistical period from the resource identifier set to obtain the target period resource identifier set; if the target period resource identifier set includes the current resource identifier corresponding to the current request data, counting the number of resource requests corresponding to each resource identifier in the target period resource identifier set; and sorting the resource request counts according to the number of requests to obtain the second sorting position.
[0111] For example, in Figure 6 In the provided example, the historical resource identifiers carried in the historical resource retrieval requests received by the server within the target historical statistical period include: historical resource identifier 1 (4 identifiers), historical resource identifier 2 (1 identifier), historical resource identifier 4 (2 identifiers), historical resource identifier 5 (1 identifier), historical resource identifier 7 (1 identifier), historical resource identifier 8 (1 identifier), and historical resource identifier 12 (1 identifier). The set formed by the above historical resource identifiers can be called the target period resource identifier set. The number of each historical resource identifier in the target period resource identifier set is the number of resource requests for that historical resource identifier.
[0112] For ease of explanation, the resources are sorted in descending order of request count. After sorting in descending order of request count, the sorting result can be normalized. For example, in the target period resource identifier set mentioned above, sorting in descending order of request count results in the following order: Historical Resource Identifier 1, Historical Resource Identifier 4, (Historical Resource Identifier 2, Historical Resource Identifier 5, Historical Resource Identifier 7, Historical Resource Identifier 8, Historical Resource Identifier 12), where the order within parentheses is not significant. In this case, for Historical Resource Identifier 1, its first sorting position is its second sorting position. This second sorting position can be obtained by dividing its current position by the total number of historical resource identifiers involved in the sorting (i.e., 1 / 7, approximately 0.14).
[0113] For the current request data 1, the current resource identifier 1 it carries corresponds to the historical resource identifier 1 in the target period resource identifier set, so the second sorting position of the current request data 1 is 0.14.
[0114] Similarly, for the current request data 2, the current resource identifier 2 it carries corresponds to the historical resource identifier 2 in the target period resource identifier set. Since the historical resource identifier 2 is ranked third, it can be calculated that the second ranking of the current request data 2 is 3 / 7, which is approximately 0.43.
[0115] For the current request data 3, the current resource identifier 3 it carries does not have a corresponding historical resource identifier in the target period resource identifier set, indicating that the current request data 3 was not requested in the target historical statistical period, and therefore there is no corresponding second sorting position.
[0116] For the current request data 4, the current resource identifier 4 it carries corresponds to the historical resource identifier 4 in the target period resource identifier set. Since the historical resource identifier 4 is ranked second, it can be calculated that the second ranking of the current request data 4 is 2 / 7, which is approximately 0.29.
[0117] The data type of the currently requested data is determined based on the first sorting position and the second sorting position, which can include the following two cases:
[0118] In the first case, if the first sorting position is less than the preset first sorting position and the second sorting position is less than the preset second sorting position, the current requested data is determined to be of the first data type.
[0119] In the second case, if the first sorting position is greater than or equal to the preset first sorting position, or the second sorting position is greater than or equal to the preset second sorting position, the currently requested data is determined to be of the second data type.
[0120] In this embodiment, the first sorting position reflects the sorting of the requested data volume within the target statistical period. When sorting according to the order of requested data volume from high to low, the smaller the value of the first sorting position calculated by the above method, the larger the current requested data volume of the current requested data. For multiple current requested data involved in the current resource acquisition request, if the current requested data volume of one or more current requested data is significantly higher than that of other current requested data, for example, if the current requested data volume of current requested data 2 is significantly higher than that of other current requested data, it means that during the parallel transmission of these current requested data by the server, the data transmission time of current requested data 2 is very likely to be significantly higher than that of other current requested data, resulting in a long-tail effect in data transmission. In this embodiment, current requested data that are highly likely to exhibit a long-tail effect in data transmission due to their large requested data volume can be referred to as long-tail data. Based on this, the first sorting position can be used to determine whether the current requested data is long-tail data. Specifically, a preset first sorting position can be set. If the first sorting position of the current requested data is less than the preset first sorting position, it can be determined that the current requested data is long-tail data; conversely, if the first sorting position of the current requested data is greater than or equal to the preset first sorting position, it can be determined that the current requested data is not long-tail data.
[0121] The second sorting position reflects the ranking of the current request data within the target historical statistical period based on the number of historical requests. When sorting by the number of requests from largest to smallest, the smaller the value of the second sorting position calculated using the above method, the more historical requests the current request data has had, meaning the current request data was requested more frequently within the target historical statistical period. Therefore, the second sorting position can be used to determine whether the current request data is hot data. Specifically, a preset second sorting position can be set. If the second sorting position of the current request data is less than the preset second sorting position, the current request data can be determined to be hot data; conversely, if the second sorting position of the current request data is greater than or equal to the preset second sorting position, the current request data can be determined not to be hot data.
[0122] It should be noted that the second ranking position can be determined not only based on the number of historical requests for the current request data within the target historical statistical period, but also based on the number of historical requests for the current request data in other statistical periods within the historical statistical period. For example, it can be determined based on the number of historical requests for the current request data within all statistical periods covered by the historical statistical period. Alternatively, the two or more statistical periods preceding the current statistical period can be used as the target historical statistical period, and the number of historical requests for the current request data in the newly defined target historical statistical period can be counted. In this embodiment, using the previous statistical period as the target historical statistical period and determining the number of historical requests for the current request data within that target historical statistical period can determine the request frequency of the current request data in the most recent time interval, making the resulting second ranking position more accurately reflect the activity of the current hot request data.
[0123] In this embodiment, the values of the preset first sorting position and the preset second sorting position can be set according to the actual situation, and this application does not impose any restrictions on them. For example, if the preset first sorting position is set to 0.15 and the preset second sorting position is set to 0.2; and the current request data corresponding to the current resource acquisition request and its sorting status are shown in Table 1 below.
[0124] Table 1. Current Requested Data and Its Sorting
[0125] Current request data First ranking position Second ranking position Data types Current request data 1 0.1 0.14 First data type Current request data 2 0.05 0.43 Second data type Current request data 3 0.3 - Second data type Current request data 4 0.08 0.29 Second data type
[0126] As shown in Table 1, according to the above rules, for the currently requested data 1, its first sorting position is less than the preset first sorting position, and its second sorting position is also less than the preset second sorting position. Therefore, the data type of the currently requested data 1 can be determined to be the first data type. The first data type indicates that the currently requested data simultaneously satisfies the criteria for both long-tail data and hot data.
[0127] As for the currently requested data 2, its first sorting position is lower than the preset first sorting position, but its second sorting position is higher than the preset second sorting position. Therefore, it can be determined that the data type of the currently requested data 2 is the second data type.
[0128] For the currently requested data 3, its first sorting position is greater than the preset first sorting position, and it does not involve the second sorting position. Therefore, it can be determined that the data type of the currently requested data 3 is the second data type.
[0129] For the currently requested data 4, its first sorting position is less than the preset first sorting position, and its second sorting position is greater than the preset second sorting position. Therefore, it can be determined that the data type of the currently requested data 4 is the second data type.
[0130] In this embodiment, the distinction between the first data type and the second data type is based on the criteria for determining long-tail data and hot data. Only when the characteristics of both long-tail data and hot data are met simultaneously is the current requested data classified as the first data type; otherwise, it is classified as the second data type. This method can efficiently and accurately identify the long-tail and hot data present in the current requested data, enabling data type-level sorting for different subsequent transmission methods and laying the foundation for efficient data transmission.
[0131] 105. Determine the data transmission path of the currently requested data based on the data type, and return the currently requested data to the terminal corresponding to the current resource acquisition request according to the data transmission path.
[0132] In this embodiment of the application, for current request data of different data types, the server can return it to the terminal that initiated the current resource acquisition request according to different data transmission paths. Figure 7 A schematic diagram of the data transmission path provided in an embodiment of this application is shown. For example... Figure 7 As shown, this embodiment of the application configures two different data transmission paths: ① a direct transmission path and ② an indirect transmission path. The direct transmission path can be understood as the server directly transmitting the corresponding current request data to the terminal after receiving the current resource acquisition request from the terminal. The indirect transmission path can be understood as the server first transmitting the response current request data to the edge cloud server corresponding to the terminal after receiving the current resource acquisition request from the terminal, and then transmitting it to the terminal via the edge cloud server.
[0133] Determining the data transmission path of the currently requested data based on the data type may include: if the data type of the currently requested data is a first data type, determining the data transmission path as an indirect transmission path; if the data type of the currently requested data is a second data type, determining the data transmission path as a direct transmission path.
[0134] For example, if the data type of the currently requested data 1 is the first data type, the server can transmit the currently requested data 1 to the terminal through an indirect transmission path.
[0135] If the data type of the currently requested data 2 is a second data type, the server can transmit the currently requested data 2 to the terminal via a direct transmission path. Similarly, if the data type of the currently requested data 3 is a second data type, the server can transmit the currently requested data 3 to the terminal via a direct transmission path. If the data type of the currently requested data 4 is a second data type, the server can transmit the currently requested data 4 to the terminal via a direct transmission path. In this embodiment, by matching different data transmission paths to different data types, the transmission pressure of single-path data transmission can be reduced, and the flexibility and efficiency of data transmission can be improved.
[0136] Specifically, according to the data transmission path, returning the current requested data to the terminal corresponding to the current resource acquisition request may include: if the data transmission path is an indirect transmission path, obtaining a set of edge cloud servers that have established data connections with the server; querying the target edge cloud server corresponding to the terminal from the set of edge cloud servers; and sending the current requested data to the terminal through the target edge cloud server.
[0137] Edge cloud servers are a cloud computing service model located at the edge of the network. They can deploy computing, storage, and other tasks at the edge of the network, thereby reducing network latency and improving data processing efficiency. Edge cloud servers have the following characteristics: (1) Proximity to users: Edge cloud servers are deployed at the edge of the network, close to users, which can greatly reduce network latency and improve response speed; (2) Data security: Because edge cloud servers are close to users, user data does not need to be transmitted over long distances, reducing the risk of data leakage; (3) Strong scalability: Edge cloud servers can be deployed in a distributed manner to meet the needs of large-scale data processing and storage; (4) High flexibility: Edge cloud servers can be flexibly configured and expanded according to business needs, and can quickly adapt to changes in business. Compared with traditional cloud computing service models, edge cloud servers reduce network bandwidth requirements due to their proximity to users, thereby reducing costs; and due to the reduction in network latency, edge cloud servers can improve data processing speed and response speed; in addition, edge cloud servers can reduce the distance of data transmission, thereby reducing the risk of data leakage, etc.
[0138] In this embodiment, the edge cloud server set can be understood as a collection of at least one edge cloud server associated with the server. After determining that the data type of the currently requested data is a first data type, the server can query the edge cloud server closest to the terminal from the edge cloud server set, and designate that edge cloud server as the target edge cloud server, thereby sending the currently requested data to the target edge cloud server for transmission to the terminal.
[0139] It should be understood that the edge cloud server closest to the terminal mentioned above can be the edge cloud server closest to the terminal in terms of network communication (i.e., directly associated with the terminal).
[0140] In this embodiment of the application, transmitting the current request data of the first data type to the terminal through the edge cloud server can reduce the demand for network bandwidth, reduce the data transmission distance, thereby improving the data transmission rate and reducing the risk of data leakage.
[0141] In the specific transmission process, sending the current request data to the terminal through the target edge cloud server may include: obtaining the current cache information of the target edge cloud server; if the current cache information indicates that the target edge cloud server has not cached the current request data, sending the current request data to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal; if the current cache information indicates that the target edge cloud server has cached the current request data, sending a data feedback instruction for the current request data to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal.
[0142] For any currently requested data of type 1, at the current moment, the target edge server may already have the currently requested data cached, or it may not have transmitted the currently requested data yet. In order to efficiently utilize the network resources of the edge cloud server and avoid data redundancy, after the server determines that the data type of the currently requested data is type 1 and queries the target edge cloud server, it can further query the cache information of the target edge cloud server at the current moment (i.e., the current cache information).
[0143] If the requested data is not present in the current cache, the server can transmit the requested data to the target edge cloud server. Upon receiving the requested data, the target edge cloud server will then forward it to the terminal. It should be understood that during the process of transmitting the requested data to the target edge cloud server, the server can instruct the target edge cloud server to transmit the requested data to a specific terminal, allowing the target edge cloud server to locate the intended recipient.
[0144] If the requested data exists in the current cache information, the server does not need to send the requested data to the target edge cloud server. In this case, the server can send a data feedback instruction to the target edge cloud server for the requested data. Through the data feedback instruction, the target edge cloud server can be instructed to transmit the requested data to the specific terminal, so that after receiving the data feedback instruction, the target edge cloud server can accurately transmit the requested data to the terminal instructed by the server.
[0145] The server sends the current request data to the target edge cloud server, which may include: obtaining the target cache information of the current request data; sending the target cache information and the current request data to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal; and updating the current cache information based on the target cache information.
[0146] The target cache information may include the caching time of the currently requested data on the target edge cloud server. The cache time can be the cache duration or the cache expiration time, etc. For different currently requested data, their respective cache times can be the same or different. The above cache time can be set or adjusted according to actual conditions, and this application does not impose any restrictions on this.
[0147] After obtaining the target cache information for the currently requested data, the server can send the target cache information to the target edge cloud server. Taking the currently requested data 1 as an example, the target cache information for the currently requested data 1 is called Target Cache Information 1, and the cache time in Target Cache Information 1 is the cache duration. Based on this, if the target edge cloud server has already cached the currently requested data 1, the server can send Target Cache Information 1 to the target edge cloud server. After receiving Target Cache Information 1, the target edge cloud server can recalculate the cache duration for the currently requested data 1, using the current time as the starting point for the cache duration. If the cache duration expires later, the target edge cloud server can clear the currently requested data 1.
[0148] If the target edge cloud server has not yet cached the currently requested data 1, the server can send the target cache information 1 and the currently requested data 1 together to the target edge cloud server. After receiving the target cache information 1 and the currently requested data 1, the target edge cloud server can cache the currently requested data 1 locally. At the same time, the current time is used as the starting point for the cache duration. After the cache duration expires, the target edge cloud server can clear the currently requested data 1.
[0149] In this embodiment of the application, the server sends target cache information to the target edge cloud server, which enables the target edge cloud server to dynamically adjust its local cache, thereby making efficient use of the network resources of the target edge cloud server.
[0150] In this embodiment, returning the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path may further include: if the data transmission path is a direct transmission path, determining the request data that has not been returned to the terminal at the current moment from the current request data to obtain a set of remaining request data, the set of remaining request data including the target remaining request data corresponding to each current resource acquisition sub-request; comparing the target remaining request data with the remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data; filtering out the request data corresponding to the target data transmission volume from the target remaining request data to obtain the request data to be transmitted; and sending the request data to be transmitted to the terminal corresponding to the current resource acquisition request based on the target transmission rate.
[0151] When the data transmission path is a direct transmission path, the server needs to determine the remaining request data (i.e., the request data that has not yet been returned to the terminal) for each current request data corresponding to the current resource acquisition request in the current moment during the process of transmitting the current request data to the terminal. For ease of distinction, the remaining request data corresponding to each current request data in the current moment is called the target remaining request data, and the target remaining request data corresponding to the current resource acquisition request constitutes the set of remaining request data.
[0152] As mentioned earlier, since the data types of the current request data 2, current request data 3, and current request data 4 corresponding to the current resource acquisition request are all of the second data type, the above three current request data need to be transmitted via a direct transmission path. During the process of transmitting the above three current request data to the terminal, the server needs to determine the remaining request data of current request data 2 at the current moment, the remaining request data of current request data 3 at the same current moment, and the remaining request data of current request data 4 at the current moment, respectively. For ease of distinction, in this embodiment, the remaining request data of current request data 2 at the current moment is referred to as target remaining request data 2, the remaining request data of current request data 3 at the current moment is referred to as target remaining request data 3, and the remaining request data of current request data 4 at the current moment is referred to as target remaining request data 4. Based on this, the set of remaining request data corresponding to the current request data includes target remaining request data 2, target remaining request data 3, and target remaining request data 4.
[0153] It should be understood that since the target remaining request data corresponding to each currently requested data is determined based on the amount of data that has not yet been transmitted to the terminal at the current moment, if none of the currently requested data has been transmitted to the terminal at the current moment, then the target remaining request data is the same as the currently requested data. For example, taking currently requested data 2 as an example, if currently requested data 2 has not yet been transmitted to the terminal at the current moment, then the target remaining request data 2 at the current moment is the same as currently requested data 2. Similarly, if currently requested data 3 has not yet been transmitted to the terminal at the current moment, then the target remaining request data 3 at the current moment is the same as currently requested data 3; if currently requested data 4 has also not been transmitted to the terminal at the current moment, then the target remaining request data 4 at the current moment is the same as currently requested data 4.
[0154] In this embodiment of the application, when using a direct transmission path for data transmission, before each data transmission, it is necessary to determine the target remaining request data for each current resource acquisition sub-request at the current moment. If the request data corresponding to some current resource acquisition sub-requests has been transmitted, then the current resource acquisition sub-request has no corresponding target remaining request data, and there is no need to allocate data transmission resources for the current resource acquisition sub-request. Instead, data transmission resources are only allocated to current resource acquisition sub-requests that still have target remaining request data. This means that the server's data transmission resources can always be fully utilized, which can avoid resource waste and thus improve the efficiency of data transmission.
[0155] Once the set of remaining request data and the target remaining request data included in the set of remaining request data are determined, the target remaining request data can be compared with the remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data.
[0156] Specifically, the remaining target request data is compared with the remaining target request data in the remaining request data set to obtain the target data transmission volume and target transmission rate of the remaining target request data. This can include: determining the target transmission parameter value of the remaining target request data in the remaining request data set based on the remaining data volume of the remaining target request data and the remaining data volume of the other remaining target request data, whereby the target transmission parameter value indicates the transmission priority of the remaining target request data; determining the data transmission weight of the remaining target request data in this transmission process based on the target transmission parameter value; and determining the target data transmission volume, target transmission window, and target transmission rate of the remaining target request data in this transmission process based on the target transmission parameter value and the data transmission weight.
[0157] The target sending parameter value is used to indicate the sending priority of the target's remaining requested data. If the sending priorities are sorted in ascending order, the target's remaining requested data with higher sending priority can send more data in one transmission. That is, the higher the sending priority, the larger the proportion of data that can be transmitted in one transmission.
[0158] In this embodiment, the target transmission parameter can be determined based on the amount of remaining target request data. Generally, the larger the amount of remaining target request data, the larger the corresponding target transmission parameter value, that is, the higher the transmission priority of the remaining target request data.
[0159] Each time a server transmits data to a terminal, there is a data transmission limit. If the amount of requested data the server needs to return to the terminal in response to a current resource acquisition request exceeds this limit, the requested data needs to be transmitted in two or more parts. Therefore, after determining the target transmission parameter value corresponding to each target remaining request data, the server can determine the data transmission weight of the target remaining request data in a single transmission process based on that target transmission parameter value. The larger the data transmission weight corresponding to the target remaining request data, the larger the amount of data that can be transmitted in a single transmission process.
[0160] After determining the data transmission weight corresponding to each target remaining request data, the target data transmission volume of the target remaining request data in this transmission process can be determined based on the data transmission weight. For example, if the upper limit of the data transmission volume of the server to the terminal each time is 1000kB, and the data transmission weight of a certain target remaining request data (the actual data volume is 1110kB) is 0.3, then in this transmission process, the target data transmission volume corresponding to this target remaining request data is 300kB.
[0161] In this embodiment, while determining the target data transmission volume of the remaining target request data, the server can also determine the target transmission rate corresponding to the remaining target request data based on the target transmission parameter value. During a single transmission process, the server can configure different target transmission rates for remaining target request data with different target transmission parameter values. Generally, the larger the target transmission parameter value, the larger the target transmission rate of the corresponding remaining target request data. This means that the larger the target transmission parameter value corresponding to the remaining target request data, the greater the data transmission weight of that remaining target request data in a single data transmission, and the greater the target transmission rate.
[0162] In this embodiment, by comparing the remaining data volume corresponding to each target remaining request data, the target transmission parameter value of each target remaining request data is determined (the transmission parameter value reflects the transmission priority of the target remaining request data). Then, based on the target transmission parameter value, the target data transmission volume and target transmission rate of each target remaining request data in one transmission process are determined. In this process, the target remaining request data with a larger remaining data volume has a higher transmission priority, can transmit more data in one transmission process, and is equipped with a higher transmission rate. This ensures that the target remaining request data with a larger remaining data volume can be allocated more data transmission resources, improve its transmission efficiency, reduce data transmission time, and avoid the long tail phenomenon caused by the target remaining request data with a large remaining data volume.
[0163] Specifically, determining the target transmission parameter value of the target remaining request data in the remaining request data set based on the remaining data volume of the target remaining request data and the remaining data volume of other target remaining request data may include: sorting the target remaining request data in the remaining request data set according to the data volume to obtain the sorting position corresponding to the target remaining request data; inputting the sorting position corresponding to the target remaining request data and the remaining data volume into a preset priority calculation rule to obtain the target transmission parameter value of the target remaining request data, wherein the transmission parameter value indicates the transmission priority of the target remaining request data.
[0164] Based on the data listed in Table 1, since the data types of currently requested data 2, currently requested data 3, and currently requested data 4 are all secondary data types, the server needs to transmit currently requested data 2, currently requested data 3, and currently requested data 4 to the terminal via a direct transmission path. If the requested data size of currently requested data 2 is 12MB, the requested data size of currently requested data 3 is 5MB, and the requested data size of currently requested data 4 is 10MB, and none of the above three currently requested data have been transmitted to the terminal at the current moment, then the specific data situation of the remaining request data set corresponding to the current resource acquisition request is shown in Table 2 below.
[0165] Table 2. Data status of the remaining request data set at the current time.
[0166] Remaining request data set Remaining data volume / MB Sort position Target send parameter values Target remaining request data 2 12 3 7.5 Target remaining request data 3 5 1 3 Target remaining request data 4 10 2 6
[0167] As shown in Table 2, the remaining data of the target remaining request data are sorted in ascending order from smallest to largest. The sorting position of target remaining request data 3 is 1, the sorting position of target remaining request data 4 is 2, and the sorting position of target remaining request data 2 is 3.
[0168] Based on this, the specific calculation method for the target sending parameter value corresponding to the remaining request data of each target can be performed using a preset priority calculation rule, which can be expressed as:
[0169] Target transmission parameter value = α * sorting position + (1-α) * data volume
[0170] Here, α is used to adjust the weight ratio between the sorting position and the remaining data volume during the calculation of the target transmission parameter value. The specific value of α can be set according to the actual situation, and the default value is 0.5.
[0171] According to the above calculation method, and taking α = 0.5 as an example, the target sending parameter value corresponding to the remaining target request data 2 is 0.5*3 + 0.5*12 = 7.5, the target sending parameter value corresponding to the remaining target request data 3 is 0.5*1 + 0.5*5 = 3, and the target sending parameter value corresponding to the remaining target request data 4 is 0.5*2 + 0.5*10 = 6.
[0172] It should be understood that the data of the remaining request data set exemplified above is only for the purpose of illustrating the technical solution of this application and does not limit the specific data of the actual remaining request data set.
[0173] In this embodiment, the target sending priority of the target remaining request data is determined by comprehensively considering two dimensions: the size of the remaining data and the sorting position. This can improve the comprehensiveness and accuracy of the evaluation of the target sending priority of each target remaining request data, thereby laying the foundation for the scientific allocation of data transmission resources.
[0174] The process of determining the data transmission weight of the remaining target request data in this transmission process based on the target transmission parameter value may include: fusing the target transmission parameter value of each remaining target request data to obtain a fused parameter value; and calculating the ratio between the target transmission parameter value and the fused parameter value to obtain the data transmission weight of the remaining target request data in this transmission process.
[0175] The process of fusing the target transmission parameter values of the remaining target request data can be understood as follows: summing the target transmission parameter values of each remaining target request data contained in the remaining data set, and using the sum as the fused parameter value. Based on the data shown in Table 2, Table 3 shows the specific data transmission weights of each remaining target request data at the current time. As shown in Table 3, the fused parameter value = 7.5 + 3 + 6 = 16.5.
[0176] Table 3. Data status of the remaining request data set at the current moment.
[0177]
[0178] The data transmission weight corresponding to each target remaining request data can be calculated as follows: Data transmission weight = Target transmission parameter value / Fusion parameter value. For target remaining request data 2, its data transmission weight in this transmission process is 7.5 / 16.5, approximately 0.455; for target remaining request data 3, its data transmission weight in this transmission process is 3 / 16.5, approximately 0.182; and for target remaining request data 4, its data transmission weight in this transmission process is 6 / 16.5, approximately 0.364.
[0179] Specifically, determining the target data transmission volume, target transmission window, and target transmission rate of the remaining target request data in this transmission process based on the target transmission parameter value and data transmission weight may include: obtaining the transmission window quota in this transmission process, and determining the target data transmission volume of the remaining target request data based on the transmission window quota and data transmission weight; determining the priority position of the target transmission parameter value in the transmission priority, and determining the target transmission window and target transmission rate of the remaining target request data based on the priority position.
[0180] The sending window quota can be understood as the upper limit of data transmission volume for each time the server transmits data to the terminal. As mentioned earlier, after determining the data transmission weight corresponding to each target remaining request data, the server can determine the target data transmission volume of the target remaining request data in this transmission process based on the data transmission weight. Taking the data situation shown in Table 3 as an example, if the sending window quota of the server for transmitting data to the terminal each time is 8MB, Table 4 shows the data transmission status of the target remaining request data at the current moment.
[0181] Table 4. Data transmission status of the remaining target request data at the current moment.
[0182]
[0183] As shown in Table 4, the target data transfer volume corresponding to the remaining target request data 2 is 8*0.455=3.64MB, the target data transfer volume corresponding to the remaining target request data 3 is 8*0.182=1.456MB, and the target data transfer volume corresponding to the remaining target request data 4 is 8*0.364=2.912MB.
[0184] Furthermore, as mentioned earlier, while determining the target data transmission volume of the remaining target request data, the server can also determine the target transmission window and target transmission rate corresponding to the remaining target request data based on the target transmission parameter values. The target transmission window can be understood as the data transmission window used during the transmission of the remaining target request data; different target transmission windows can be configured with different data transmission rates and different data transmission volumes.
[0185] For each transmission process, the server can divide the sending window quota into two or more sending windows. Different sending windows can be understood as intervals with different transmission rates. For example, the sending window quota can be divided into high-speed sending windows and low-speed sending windows, where the high-speed sending window is the high-speed transmission interval, and the low-speed sending window is the low-speed transmission interval. Alternatively, the sending window quota can be divided into high-speed sending windows, medium-high-speed sending windows, and low-speed sending windows, where the high-speed sending window is the high-speed transmission interval, the medium-high-speed sending window is the medium-high-speed transmission interval, and the low-speed sending window is the low-speed transmission interval, and so on.
[0186] Let's take the example of a server dividing its sending window quota into three windows: a high-speed sending window (high-speed transmission range), a medium-high-speed sending window (medium-high-speed transmission range), and a low-speed sending window (low-speed transmission range). The window quotas for each of these three windows can be set according to actual needs. For example, the ratio of the window quotas for the high-speed, medium-high-speed, and low-speed transmission ranges can be set to 1.44:1.2:1. That is, the window quota share for the high-speed transmission range is 1.44 / 3.64 = 0.4, the window quota share for the medium-high-speed transmission range is 1.2 / 3.64 = 0.33, and the window quota share for the low-speed transmission range is 1 / 3.64 = 0.27. With a sending window quota of 8MB for each data transmission from the server to the terminal, the window quota for the high-speed transmission range is 8 * 0.4 = 3.2MB, the window quota for the medium-high-speed transmission range is 8 * 0.33 = 2.64MB, and the window quota for the low-speed transmission range is 8 * 0.27 = 2.16MB.
[0187] The transmission rate of each transmission interval can also be set according to the actual situation. For example, the transmission rate ratio of the high-speed transmission interval, the medium-high speed transmission interval, and the low-speed transmission interval can be set to 1.44:1.2:1. If the rate of the low-speed transmission interval is 1MB / s, then the transmission rate of the high-speed transmission interval is 1.44MB / s, the transmission rate of the medium-high speed interval is 1.2MB / s, and the transmission rate of the low-speed transmission interval is 1MB / s.
[0188] Since the remaining requested data in the set is sorted by transmission priority from low to high as follows: remaining requested data 3, remaining requested data 4, and remaining requested data 2, it means that remaining requested data 2 can preferentially utilize the rate corresponding to the high-speed transmission range. Based on the above examples, for remaining requested data 2 (the target data transmission amount corresponding to this transmission process is 3.64MB), 3.2MB of its target data transmission amount can be transmitted to the terminal at a rate of 1.44MB / s, and the remaining 0.44MB of data can be transmitted to the terminal at a rate of 1.2MB / s; for remaining requested data 4 (the target data transmission amount corresponding to this transmission process is 2.912MB), 2.2MB of its target data transmission amount can be transmitted to the terminal at a rate of 1.2MB / s, and the remaining 0.712MB of data can be transmitted to the terminal at a rate of 1MB / s; for remaining requested data 3 (the target data transmission amount corresponding to this transmission process is 1.456MB), it can be transmitted to the terminal at a rate of 1MB / s.
[0189] In this embodiment, the target sending window and target transmission rate of the target remaining request data are determined according to the priority position. The higher the priority position, the better the sending window and the higher the sending rate can be configured. In this way, the appropriate sending window and sending rate can be dynamically allocated for different target remaining request data, so that the server's data transmission resources can be used scientifically and rationally, improving the efficiency of data transmission and reducing the page loading time.
[0190] Once the target data transfer volume, target sending window, and target transmission rate for the remaining target request data for this transmission process are determined, the request data corresponding to the target data transfer volume (i.e., the request data to be transmitted) can be filtered out from the remaining target request data, and the request data to be transmitted can be transmitted to the terminal corresponding to the current resource acquisition request according to the target transmission rate corresponding to the target sending window.
[0191] It should be noted that after this transmission is completed, the amount of remaining data for each target remaining request data in the remaining request data set changes, as shown in Table 5 below.
[0192] Table 5. Data status of the remaining request data set after this transmission is completed.
[0193]
[0194] In Table 5, the amount of data remaining after this transmission is completed is the target data transmission amount for the next transmission process. Therefore, after completing this transmission, the server can update the target remaining request data in the remaining request data set, and calculate the target data transmission amount and target transmission rate corresponding to each updated target remaining request data in the next transmission process according to the aforementioned method. Based on this, the server will transmit the response data to the terminal until all current request data transmissions are completed.
[0195] It should be understood that the specific data shown in the above embodiments are merely for illustrative purposes and do not limit the specific values of the relevant data in actual transmission scenarios.
[0196] As described above, this embodiment of the application receives a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. Then, based on the current resource identifier, it determines the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request. Next, it acquires historical resource acquisition requests and queries the historical request count corresponding to the current request data from the historical resource acquisition requests. Then, based on the current data volume and the historical request count, it determines the data type of the current request data. Finally, it determines the data transmission path of the current request data according to the data type and returns the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path. Since this scheme is applicable to data transmission scenarios with multiple concurrent requests over long connections, it determines the current request data and the current data volume corresponding to each current resource acquisition sub-request carried in the current resource acquisition request. Based on this, it counts the historical request counts of the current request data, and then determines the data type of the current request data based on the historical request counts and the current data volume. Different data transmission paths are allocated to the current request data according to different data types, thereby implementing differentiated transmission strategies for multiple simultaneously received current resource acquisition sub-requests. This alleviates the impact of data with low transmission performance among multiple current request data on the overall loading time, thereby improving the efficiency of server-side data transmission and, consequently, improving the page loading speed of the user's terminal.
[0197] This embodiment will continue to be described from the perspective of a data transmission device, which can be integrated into a second electronic device, which can be a terminal.
[0198] A data transmission method includes: upon receiving a page resource browsing instruction triggered by a user, generating a current resource retrieval request based on the page resource browsing instruction; sending the current resource retrieval request to a server, wherein the current resource retrieval request includes at least one current page resource sub-request, and each current page resource sub-request corresponds to a current resource identifier; upon receiving current request data returned by the server for the current resource identifier, displaying the content page corresponding to the current request data; detecting the user's browsing duration on the content page, and determining the connection duration for connecting to the server for the next page resource browsing instruction based on the browsing duration.
[0199] Figure 8 A flowchart illustrating a data transmission method provided in an embodiment of this application is shown. Figure 8 As shown, the specific process of this resource synchronization method is as follows:
[0200] 201. When a user triggers a page resource browsing command for a target page, generate a current resource acquisition request based on the page resource browsing command.
[0201] When a user browses web pages through a terminal, if the currently viewed web page is web page A, and the user wants to browse other web pages (such as web page B), the user can input a page resource browsing command for web page B through the terminal. For example, the user can perform a screen click operation for web page B on the terminal, or input a search command for web page B, etc. After receiving the page resource browsing command, the terminal can generate a current resource retrieval request based on the page resource browsing command.
[0202] 202. Send a current resource retrieval request to the server. The current resource retrieval request includes a current resource retrieval sub-request corresponding to at least one page resource in the target page and a current resource identifier.
[0203] The terminal can send a generated current resource retrieval request to the server, requesting the server to return web page resources related to web page B. In this case, web page B is the target page for the current resource retrieval request. The target page may include at least one page resource, and these resources can take the form of text, images, audio, video, links, etc. For example, the target page may include multiple images and multiple paragraphs of text; in this case, the multiple images and multiple paragraphs of text together constitute the target page.
[0204] The current resource retrieval request sent by the terminal to the server for the target page includes at least one current resource retrieval sub-request. Each current resource retrieval sub-request is a request to retrieve page resources within the target page; therefore, one page resource corresponds to one current resource retrieval sub-request. The current resource retrieval sub-request carries a current resource identifier, which is used to identify the page resource corresponding to the current resource retrieval sub-request.
[0205] The current resource identifier can take many forms. For example, it can be a Uniform Resource Identifier (URI), which is a string used to identify the name of a certain Internet resource.
[0206] 203. After receiving the current request data returned by the server for the current resource identifier, display the target page.
[0207] After the terminal sends a current resource acquisition request to the server, the server responds to the request by returning the current request data corresponding to each current resource identifier to the terminal, either via a direct transmission path or an indirect transmission path. The specific method by which the server transmits the current request data to the terminal can be found in steps 101-105 above, and will not be elaborated upon here.
[0208] Once the terminal receives the current request data returned by the server, it can display the content page corresponding to the current request data, i.e., the target page (web page B).
[0209] 204. Detect the duration of the user's browsing of the target page, and determine the connection duration with the server based on the browsing duration.
[0210] After the terminal displays the content page, the user can browse it. The terminal can detect the duration of the user's browsing (i.e., browsing time) and adaptively adjust the connection duration between the terminal and the server based on the browsing time. This connection duration can be understood as the keep-alive time between the terminal and the server, that is, the duration for which the terminal continues to maintain a network connection with the server.
[0211] The process of detecting the user's browsing time on the target page and determining the connection duration with the server based on the browsing time may include: obtaining at least one content page preceding the target page to obtain a set of historical content pages; calculating the user's browsing time on the set of historical content pages and smoothing the browsing time to obtain a smoothed historical duration value; detecting the user's browsing time on the target page and calculating the connection duration based on the browsing time and the smoothed historical duration value.
[0212] For example, before a user browses the target page (webpage B), they may have browsed multiple content webpages (including webpage A). To facilitate differentiation, if ordered chronologically, these could include webpage 1, webpage 2, webpage 3, webpage A, and webpage B (the target page). In this case, the terminal can select one or more webpages that are closest to the target page from these content pages to obtain a set of historical content pages. Taking the terminal selecting webpage 3 and webpage A to obtain the set of historical content pages as an example, the terminal can separately calculate the browsing time for webpage 3 and the browsing time for webpage A, and perform a smoothing calculation based on these two browsing times. The resulting smoothed value is the historical duration smoothing value.
[0213] At the same time, the terminal can detect the user's browsing time on the target page, and then determine the connection duration based on the browsing time and historical duration smoothing values. Specifically, a connection duration smoothing value can be determined first based on the browsing time and historical duration smoothing values; the connection duration smoothing value is then weighted to obtain the connection duration.
[0214] The calculation method for the connection duration smoothing value can be expressed as follows:
[0215] Connection duration smoothing value = β * historical duration smoothing value + (1-β) * browsing duration
[0216] β is used to calculate the smoothness weight parameter of the terminal staying on a certain page. This value can be set by the administrator according to the actual situation, and the default value is 0.8.
[0217] After determining the smoothed connection duration value, this smoothed connection duration value can be weighted, that is, the connection duration can be calculated as follows:
[0218] Connection duration = γ * Connection duration smoothing value
[0219] γ represents the weighting value, which can also be set by the administrator according to the actual situation. The default value is 1.2.
[0220] In this embodiment, since the keep-alive duration is a duration calculated based on the user's browsing habits, it means that the keep-alive duration can be dynamically adjusted according to the user's browsing time. Therefore, it is possible to dynamically adjust the duration for which the terminal continues to maintain a connection with the server based on the user's browsing habits, thereby reducing the occupation of network connection resources and achieving efficient utilization of network connection resources.
[0221] As described above, in this embodiment, when the terminal receives a page resource browsing instruction triggered by a user for a target page, it generates a current resource acquisition request based on the page resource browsing instruction. Then, it sends the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Then, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined. This scheme is applicable to data transmission scenarios under long-connection, multi-request concurrency. From the terminal's perspective, it detects the user's browsing habits and dynamically adjusts the duration for which the terminal continues to maintain a connection with the server based on these habits. By dynamically adjusting the terminal's active connection closure duration with the server, on the one hand, it can increase the probability of connection reuse between the terminal and the server, reducing data loading time caused by re-establishing a connection after closure; on the other hand, it can also reduce the occupation of network connection resources, achieving efficient utilization of network connection resources.
[0222] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0223] In this embodiment, the data interaction process between a first electronic device and a second electronic device will be described as an example. The first electronic device can be a server, and the second electronic device can be a terminal. A communication connection is established between the server and the terminal.
[0224] Figure 9 A timing diagram of the data transmission method provided in an embodiment of this application is shown. Figure 9 As shown, a data transmission method has the following specific process:
[0225] 301. When the terminal receives a page resource browsing instruction triggered by the user for the target page, it generates a current resource acquisition request based on the page resource browsing instruction.
[0226] For example, when a user is browsing web pages on a terminal, if the currently viewed web page is A, and the user wants to browse another web page (such as B), the user can input a page resource browsing command for web page B through the terminal. For example, the user can perform a screen click operation for web page B on the terminal, or input a search command for web page B, etc. After receiving the page resource browsing command, the terminal can generate a current resource retrieval request based on the page resource browsing command.
[0227] 302. The terminal sends a current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier.
[0228] For example, a terminal can send a generated current resource retrieval request to a server, requesting the server to return web page resources related to web page B. The current resource retrieval request sent by the terminal to the server for the target page includes at least one current resource retrieval sub-request. Each current resource retrieval sub-request is a request to retrieve page resources within the target page; therefore, one page resource corresponds to one current resource retrieval sub-request. The current resource retrieval sub-request carries a current resource identifier, which is used to identify the page resource corresponding to the current resource retrieval sub-request.
[0229] 303. The server receives the current resource retrieval request for the target page, and determines the current request data and the current data volume of the current request data corresponding to the current resource retrieval sub-request based on the current resource identifier.
[0230] For example, after the server determines the current resource retrieval sub-request and the current resource identifier corresponding to each page resource, it can determine the current request data corresponding to the page resource (i.e., the current resource retrieval sub-request) based on the current resource identifier, and use the data volume of the current request data as the current data volume.
[0231] The server and the terminal can communicate using a long TCP connection. When a current resource acquisition request is received, since the current resource acquisition request includes at least one current resource acquisition sub-request, and each current resource acquisition sub-request corresponds to a current resource identifier, after receiving the current resource acquisition request, the server needs to schedule the corresponding current request data according to each current resource identifier and transmit all the current request data covered by the current resource acquisition request to the terminal in parallel. The above data transmission scenario is the long connection multi-request concurrency scenario.
[0232] 304. The server retrieves historical resource retrieval requests and queries the historical request count corresponding to the current request data from the historical resource retrieval requests.
[0233] For example, the server can count the page resource requests received within a target statistical period to obtain a set of page resource requests, which includes the current resource acquisition request; take the statistical period in which the current resource acquisition request is located as the current statistical period, determine the previous statistical period within the target statistical period to obtain the target historical statistical period; and filter out the page resource requests corresponding to the target historical statistical period from the set of page resource requests to obtain the historical resource acquisition requests.
[0234] A historical resource retrieval request includes at least one historical resource retrieval sub-request, and each historical resource retrieval sub-request corresponds to a historical resource identifier. Based on this, the server can filter out the historical resource identifiers that correspond to the current resource identifier of the current request data from the historical resource identifiers to obtain the target historical resource identifier; the number of target historical resource identifiers is counted to obtain the number of historical requests.
[0235] 305. The server determines the data type of the currently requested data based on the current data volume and the number of historical requests.
[0236] For example, the server can sort the request data in the set of page resource requests based on the current data volume to obtain the first sorting position corresponding to the current request data; sort the request data in the historical resource retrieval requests based on the historical request count to obtain the second sorting position corresponding to the current request data; and determine the data type of the current request data based on the first and second sorting positions.
[0237] For example, the server can extract the page resource sub-request corresponding to each page resource request from the page resource request set, and determine the resource identifier corresponding to the page resource sub-request to obtain a resource identifier set; determine the request data and the request data volume corresponding to each resource identifier in the resource identifier set, the request data including the current request data; sort the request data volume according to the data volume to obtain the first sorting position.
[0238] For example, the server can filter out the resource identifiers corresponding to the target historical statistical period from the resource identifier set to obtain the target period resource identifier set; if the target period resource identifier set includes the current resource identifier corresponding to the current request data, the server can count the number of resource requests corresponding to each resource identifier in the target period resource identifier set; and sort the resource request counts according to the number of requests to obtain the second ranking.
[0239] For example, if the first sorting position is less than the preset first sorting position, and the second sorting position is less than the preset second sorting position, the server can determine that the currently requested data is of the first data type.
[0240] For example, if the first sorting position is greater than or equal to the preset first sorting position, or the second sorting position is greater than or equal to the preset second sorting position, the server can determine that the currently requested data is of the second data type.
[0241] 306. If the data type of the currently requested data is the first data type, the server determines that the data transmission path is an indirect transmission path.
[0242] 307. The server obtains the set of edge cloud servers that have established data connections with the server, queries the target edge cloud server corresponding to the terminal from the set of edge cloud servers, and sends the currently requested data to the terminal through the target edge cloud server.
[0243] For example, the server can obtain the current cache information of the target edge cloud server; if the current cache information indicates that the target edge cloud server has not cached the current requested data, the server can send the current requested data to the target edge cloud server so that the target edge cloud server can send the current requested data to the terminal; if the current cache information indicates that the target edge cloud server has cached the current requested data, the server can send a data feedback instruction for the current requested data to the target edge cloud server so that the target edge cloud server can send the current requested data to the terminal.
[0244] For example, the server can obtain the target cache information of the currently requested data; send the target cache information and the currently requested data to the target edge cloud server so that the target edge cloud server can send the currently requested data to the terminal; and update the current cache information based on the target cache information.
[0245] 308. If the data type of the currently requested data is the second data type, determine the data transmission path as the direct transmission path.
[0246] 309. The server determines the request data that has not been returned to the terminal at the current moment from the current request data, and obtains the remaining request data set. The remaining request data set includes the target remaining request data corresponding to each current resource acquisition sub-request.
[0247] When the data transmission path is a direct transmission path, the server needs to determine the remaining request data for each current request data corresponding to the current resource acquisition request at the current moment, that is, the request data that the current request data has not yet been returned to the terminal at the current moment, during the process of transmitting the current request data to the terminal.
[0248] 310. The server compares the target remaining request data with the remaining target request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data.
[0249] For example, the server can determine the target transmission parameter value of the target remaining request data in the set of remaining request data based on the remaining data volume of the target remaining request data and the remaining data volume of other target remaining request data. The target transmission parameter value indicates the transmission priority of the target remaining request data. Based on the target transmission parameter value, the server can determine the data transmission weight of the target remaining request data in this transmission process. Based on the target transmission parameter value and the data transmission weight, the server can determine the target data transmission volume, target transmission window, and target transmission rate of the target remaining request data in this transmission process.
[0250] For example, the server can sort the target remaining request data in the remaining request data set according to the data volume to obtain the sorting position corresponding to the target remaining request data; input the sorting position corresponding to the target remaining request data and the remaining data volume into the preset priority calculation rules to obtain the target sending parameter value of the target remaining request data, and the sending parameter value indicates the sending priority of the target remaining request data.
[0251] For example, the server can merge the target sending parameter values of each target remaining request data to obtain the merged parameter value; calculate the ratio between the target sending parameter value and the merged parameter value to obtain the data sending weight of the target remaining request data in this transmission process.
[0252] For example, the server can obtain the sending window quota during this transmission process, and determine the target data transmission volume of the remaining target requested data based on the sending window quota and data sending weight; determine the priority position of the target sending parameter value in the sending priority, and determine the target sending window and target transmission rate of the remaining target requested data based on the priority position.
[0253] 311. The server filters out the request data corresponding to the target data transmission volume from the remaining target request data to obtain the request data to be transmitted.
[0254] 312. Based on the target transmission rate, the server sends the request data to be transmitted to the terminal corresponding to the current resource acquisition request.
[0255] Once the server has determined the target data transfer volume and target transfer rate for the remaining target request data for this transmission process, it can filter out the request data (i.e., the request data to be transferred) corresponding to the target data transfer volume from the remaining target request data, and transfer the request data to be transferred to the terminal corresponding to the current resource acquisition request according to the target transfer rate.
[0256] After this transmission is completed, the remaining data volume of each target remaining request data in the remaining request data set changes. The remaining data volume after this transmission is the target data transmission volume for the next transmission process. After completing this transmission, the server can update the target remaining request data in the remaining request data set, and calculate the target data transmission volume and target transmission rate for each updated target remaining request data in the next transmission process according to the aforementioned method. Based on this, the server transmits the response data to the terminal until all current request data transmissions are completed.
[0257] 313. After receiving the current request data returned by the server for the current resource identifier, the terminal displays the target page.
[0258] For example, after a terminal sends a current resource acquisition request to a server, the server responds to the request by returning the current request data corresponding to each current resource identifier to the terminal using a direct transmission path and / or an indirect transmission path. The specific method by which the server transmits the current request data to the terminal can be found in the preceding steps and will not be repeated here.
[0259] Once the terminal receives the current request data returned by the server, it can display the content page corresponding to the current request data, i.e., the target page.
[0260] 314. The terminal detects the user's browsing time on the target page and determines the connection duration with the server based on the browsing time.
[0261] For example, after the terminal displays a content page, the user can browse that page. The terminal can detect the duration of the user's browsing (i.e., browsing time) and adaptively adjust the connection duration between the terminal and the server based on the browsing time. This connection duration can be understood as the keep-alive time between the terminal and the server, that is, the duration for which the terminal continues to maintain a network connection with the server.
[0262] For example, the terminal can obtain at least one content page preceding the target page to get a set of historical content pages; count the browsing time of the user on the set of historical content pages, and smooth the browsing time to get a smoothed historical time value; detect the browsing time of the user on the target page, and calculate the connection time based on the browsing time and the smoothed historical time value.
[0263] For example, the terminal can first determine the connection duration smoothing value based on the browsing duration and the historical duration smoothing value; then, by weighting the connection duration smoothing value, the connection duration can be obtained.
[0264] As described above, this embodiment of the application receives a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. Then, based on the current resource identifier, it determines the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request. Next, it acquires historical resource acquisition requests and queries the historical request count corresponding to the current request data from the historical resource acquisition requests. Then, based on the current data volume and the historical request count, it determines the data type of the current request data. Finally, it determines the data transmission path of the current request data according to the data type and returns the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path. Since this scheme is applicable to data transmission scenarios with multiple concurrent requests over long connections, it determines the current request data and the current data volume corresponding to each current resource acquisition sub-request carried in the current resource acquisition request. Based on this, it counts the historical request counts of the current request data, and then determines the data type of the current request data based on the historical request counts and the current data volume. Different data transmission paths are allocated to the current request data according to different data types, thereby implementing differentiated transmission strategies for multiple simultaneously received current resource acquisition sub-requests. This alleviates the impact of data with low transmission performance among multiple current request data on the overall loading time, thereby improving the efficiency of server-side data transmission and, consequently, improving the page loading speed of the user's terminal.
[0265] Furthermore, in this embodiment, when the terminal receives a page resource browsing instruction triggered by a user for a target page, it generates a current resource acquisition request based on the page resource browsing instruction. Then, it sends the current resource acquisition request to the server, which includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Then, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined. This scheme is applicable to data transmission scenarios under long-connection, multi-request concurrency scenarios. From the terminal's perspective, it detects the user's browsing habits and dynamically adjusts the duration for which the terminal continues to maintain a connection with the server based on these habits. By dynamically adjusting the terminal's active connection closure duration with the server, on the one hand, it can increase the probability of connection reuse between the terminal and the server, reducing data loading time caused by re-establishing a connection after closure; on the other hand, it can also reduce the occupation of network connection resources, achieving efficient utilization of network connection resources.
[0266] To better implement the above methods, this application also provides a data transmission device, which can be integrated into a first electronic device, which can be a server. Figure 10 A schematic diagram of the structure of the data transmission apparatus provided in an embodiment of this application is shown. Figure 10 As shown, the data transmission device may include a message receiving unit 401, a resource determination unit 402, a data query unit 403, a data processing unit 404, and a data transmission unit 405, as follows:
[0267] (1) Message receiving unit 401;
[0268] The message receiving unit 401 is used to receive a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page.
[0269] (2) Resource determination unit 402;
[0270] The resource determination unit 402 is used to determine the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request based on the current resource identifier.
[0271] For example, the resource determination unit 402 can be used to determine the current request data corresponding to the page resource (i.e. the current resource acquisition sub-request) based on the current resource identifier after determining the current resource acquisition sub-request and the current resource identifier for each page resource, and use the data volume of the current request data as the current data volume.
[0272] (3) Data query unit 403;
[0273] The data query unit 403 is used to obtain historical resource acquisition requests and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests.
[0274] For example, the data query unit 403 can be used to count the page resource requests received within the target statistical period to obtain a set of page resource requests, which includes the current resource acquisition request; take the statistical period in which the current resource acquisition request is located as the current statistical period, determine the previous statistical period within the target statistical period to obtain the target historical statistical period; and filter out the page resource requests corresponding to the target historical statistical period from the set of page resource requests to obtain the historical resource acquisition requests.
[0275] For example, the data query unit 403 can be used to filter out the historical resource identifiers that correspond to the current resource identifier of the current request data from the historical resource identifiers to obtain the target historical resource identifier; and count the number of target historical resource identifiers to obtain the number of historical requests.
[0276] (4) Data processing unit 404;
[0277] The data processing unit 404 is used to determine the data type of the currently requested data based on the current data volume and the number of historical requests.
[0278] For example, the data processing unit 404 can be used to sort the request data in the page resource request set based on the current data volume to obtain the first sorting position corresponding to the current request data; sort the request data in the historical resource acquisition requests based on the historical request count to obtain the second sorting position corresponding to the current request data; and determine the data type of the current request data based on the first sorting position and the second sorting position.
[0279] For example, the data processing unit 404 can be specifically used to extract the page resource sub-request corresponding to each page resource request from the page resource request set, and determine the resource identifier corresponding to the page resource sub-request to obtain a resource identifier set; determine the request data and the request data volume corresponding to each resource identifier in the resource identifier set, wherein the request data includes the current request data; and sort the request data volume according to the data volume to obtain the first sorting position.
[0280] For example, the data processing unit 404 can be used to filter out the resource identifiers corresponding to the target historical statistical period from the resource identifier set to obtain the target period resource identifier set; if the target period resource identifier set includes the current resource identifier corresponding to the current request data, the number of resource requests corresponding to each resource identifier in the target period resource identifier set is counted; the number of resource requests is sorted according to the size of the number of requests to obtain the second ranking.
[0281] For example, the data processing unit 404 can be specifically used to determine that the current requested data is a first data type if the first sorting position is less than a preset first sorting position and the second sorting position is less than a preset second sorting position; and to determine that the current requested data is a second data type if the first sorting position is greater than or equal to the preset first sorting position or the second sorting position is greater than or equal to the preset second sorting position.
[0282] (5) Data transmission unit 405;
[0283] The data transmission unit 405 is used to determine the data transmission path of the currently requested data according to the data type, and return the currently requested data to the terminal corresponding to the current resource acquisition request according to the data transmission path.
[0284] For example, the data transmission unit 405 can be specifically used to determine the data transmission path as an indirect transmission path if the data type of the currently requested data is a first data type, and to determine the data transmission path as a direct transmission path if the data type of the currently requested data is a second data type.
[0285] For example, the data transmission unit 405 can be specifically used to obtain a set of edge cloud servers that have established data connections with the server if the data transmission path is an indirect transmission path; query the target edge cloud server corresponding to the terminal from the set of edge cloud servers; and send the currently requested data to the terminal through the target edge cloud server.
[0286] For example, the data transmission unit 405 can be used to obtain the current cache information of the target edge cloud server; if the current cache information indicates that the target edge cloud server has not cached the current requested data, the current requested data is sent to the target edge cloud server so that the target edge cloud server can send the current requested data to the terminal; if the current cache information indicates that the target edge cloud server has cached the current requested data, a data feedback instruction for the current requested data is sent to the target edge cloud server so that the target edge cloud server can send the current requested data to the terminal.
[0287] For example, the data transmission unit 405 can be used to obtain the target cache information of the currently requested data; send the target cache information and the currently requested data to the target edge cloud server so that the target edge cloud server can send the currently requested data to the terminal; and update the current cache information based on the target cache information.
[0288] For example, the data transmission unit 405 can be specifically used to, if the data transmission path is a direct transmission path, determine the request data that has not been returned to the terminal at the current time from the current request data, and obtain a set of remaining request data, which includes the target remaining request data corresponding to each current resource acquisition sub-request; compare the target remaining request data with the other target remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data; filter out the request data corresponding to the target data transmission volume from the target remaining request data to obtain the request data to be transmitted; and send the request data to be transmitted to the terminal corresponding to the current resource acquisition request based on the target transmission rate.
[0289] For example, the data transmission unit 405 can be specifically used to determine the target transmission parameter value of the target remaining request data in the remaining request data set based on the remaining data volume of the target remaining request data and the remaining data volume of the other target remaining request data. The target transmission parameter value indicates the transmission priority of the target remaining request data. Based on the target transmission parameter value, the data transmission weight of the target remaining request data in this transmission process is determined. Based on the target transmission parameter value and the data transmission weight, the target data transmission volume and target transmission rate of the target remaining request data in this transmission process are determined.
[0290] For example, the data transmission unit 405 can be used to sort the target remaining request data in the remaining request data set according to the data volume to obtain the sorting position corresponding to the target remaining request data; input the sorting position corresponding to the target remaining request data and the remaining data volume into a preset priority calculation rule to obtain the target sending parameter value of the target remaining request data, and the sending parameter value indicates the sending priority of the target remaining request data.
[0291] For example, the data transmission unit 405 can be used to fuse the target transmission parameter values of each target remaining request data to obtain the fused parameter values; and calculate the ratio between the target transmission parameter values and the fused parameter values to obtain the data transmission weight of the target remaining request data in this transmission process.
[0292] For example, the data transmission unit 405 can be used to obtain the sending window quota in this transmission process, and determine the target data transmission volume of the remaining target requested data based on the sending window quota and data sending weight; determine the priority position of the target sending parameter value in the sending priority, and determine the target sending window and target transmission rate of the remaining target requested data based on the priority position.
[0293] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0294] As described above, this embodiment of the application receives a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. Then, based on the current resource identifier, it determines the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request. Next, it acquires historical resource acquisition requests and queries the historical request count corresponding to the current request data from the historical resource acquisition requests. Then, based on the current data volume and the historical request count, it determines the data type of the current request data. Finally, it determines the data transmission path of the current request data according to the data type and returns the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path. Since this scheme is applicable to data transmission scenarios with multiple concurrent requests over long connections, it determines the current request data and the current data volume corresponding to each current resource acquisition sub-request carried in the current resource acquisition request. Based on this, it counts the historical request counts of the current request data, and then determines the data type of the current request data based on the historical request counts and the current data volume. Different data transmission paths are allocated to the current request data according to different data types, thereby implementing differentiated transmission strategies for multiple simultaneously received current resource acquisition sub-requests. This alleviates the impact of data with low transmission performance among multiple current request data on the overall loading time, thereby improving the efficiency of server-side data transmission and, consequently, improving the page loading speed of the user's terminal.
[0295] To better implement the above methods, this application also provides a data transmission device, which can be integrated into a second electronic device, which can be a terminal. Figure 11 A schematic diagram of the structure of the data transmission apparatus provided in an embodiment of this application is shown. Figure 11 As shown, the data transmission device may include an instruction receiving unit 501, a message sending unit 502, a page display unit 503, and a connection confirmation unit 505, as follows:
[0296] (1) Command receiving unit 501;
[0297] The instruction receiving unit 501 is used to generate a current resource acquisition request based on the page resource browsing instruction triggered by the user for the target page.
[0298] (2) Message sending unit 502;
[0299] The message sending unit 502 is used to send a current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page.
[0300] (3) Page display unit 503;
[0301] The page display unit 503 is used to display the target page after receiving the current request data returned by the server for the current resource identifier.
[0302] (4) Connect to confirmation unit 505;
[0303] The connection confirmation unit 505 is used to detect the duration of the user's browsing of the target page and, based on the browsing duration, determine the connection duration for connecting to the server.
[0304] For example, the connection confirmation unit 505 can be used to obtain at least one content page preceding the target page to obtain a set of historical content pages; count the browsing time of the user on the set of historical content pages and smooth the browsing time to obtain a smoothed historical time value; detect the browsing time of the user on the target page and calculate the connection duration based on the browsing time and the smoothed historical time value.
[0305] For example, the connection confirmation unit 505 can be used to determine the connection duration smoothing value based on the browsing duration and the historical duration smoothing value; and to obtain the connection duration by weighting the connection duration smoothing value.
[0306] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0307] As described above, in this embodiment, when the terminal receives a page resource browsing instruction triggered by a user for a target page, it generates a current resource acquisition request based on the page resource browsing instruction. Then, it sends the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Then, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined. This scheme is applicable to data transmission scenarios under long-connection, multi-request concurrency. From the terminal's perspective, it detects the user's browsing habits and dynamically adjusts the duration for which the terminal continues to maintain a connection with the server based on these habits. By dynamically adjusting the terminal's active connection closure duration with the server, on the one hand, it can increase the probability of connection reuse between the terminal and the server, reducing data loading time caused by re-establishing a connection after closure; on the other hand, it can also reduce the occupation of network connection resources, achieving efficient utilization of network connection resources.
[0308] This application also provides an electronic device, such as... Figure 12 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:
[0309] The electronic device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will understand that... Figure 10 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0310] The processor 601 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0311] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0312] The electronic device also includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0313] The electronic device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0314] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602 to realize various functions, as follows:
[0315] Upon receiving a current resource retrieval request for a target page, which includes a current resource retrieval sub-request corresponding to at least one page resource on the target page and a current resource identifier, the server can determine the current request data and the current data volume corresponding to the current resource retrieval sub-request based on the current resource identifier. Then, the server can retrieve historical resource retrieval requests and query the historical request count corresponding to the current request data. Based on the current data volume and the historical request count, the server determines the data type of the current request data. Finally, the server can determine the data transmission path of the current request data based on the data type and return the current request data to the terminal corresponding to the current resource retrieval request according to the data transmission path.
[0316] or,
[0317] Upon receiving a user's instruction to browse page resources for a target page, a current resource retrieval request is generated based on the instruction. Then, the current resource retrieval request is sent to the server, including a current resource retrieval sub-request corresponding to at least one page resource on the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Next, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined.
[0318] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0319] As described above, this embodiment of the application receives a current resource acquisition request for a target page. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. Then, based on the current resource identifier, it determines the current request data and the current data volume of the current request data corresponding to the current resource acquisition sub-request. Next, it acquires historical resource acquisition requests and queries the historical request count corresponding to the current request data from the historical resource acquisition requests. Then, based on the current data volume and the historical request count, it determines the data type of the current request data. Finally, it determines the data transmission path of the current request data according to the data type and returns the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path. Since this scheme is applicable to data transmission scenarios with multiple concurrent requests over long connections, it determines the current request data and the current data volume corresponding to each current resource acquisition sub-request carried in the current resource acquisition request. Based on this, it counts the historical request counts of the current request data, and then determines the data type of the current request data based on the historical request counts and the current data volume. Different data transmission paths are allocated to the current request data according to different data types, thereby implementing differentiated transmission strategies for multiple simultaneously received current resource acquisition sub-requests. This alleviates the impact of data with low transmission performance among multiple current request data on the overall loading time, thereby improving the efficiency of server-side data transmission and, consequently, improving the page loading speed of the user's terminal.
[0320] Furthermore, in this embodiment, when the terminal receives a page resource browsing instruction triggered by a user for a target page, it generates a current resource acquisition request based on the page resource browsing instruction. Then, it sends the current resource acquisition request to the server, which includes a current resource acquisition sub-request corresponding to at least one page resource in the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Then, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined. This scheme is applicable to data transmission scenarios under long-connection, multi-request concurrency scenarios. From the terminal's perspective, it detects the user's browsing habits and dynamically adjusts the duration for which the terminal continues to maintain a connection with the server based on these habits. By dynamically adjusting the terminal's active connection closure duration with the server, on the one hand, it can increase the probability of connection reuse between the terminal and the server, reducing data loading time caused by re-establishing a connection after closure; on the other hand, it can also reduce the occupation of network connection resources, achieving efficient utilization of network connection resources.
[0321] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0322] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the data transmission methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0323] Upon receiving a current resource retrieval request for a target page, which includes a current resource retrieval sub-request corresponding to at least one page resource on the target page and a current resource identifier, the server can determine the current request data and the current data volume corresponding to the current resource retrieval sub-request based on the current resource identifier. Then, the server can retrieve historical resource retrieval requests and query the historical request count corresponding to the current request data. Based on the current data volume and the historical request count, the server determines the data type of the current request data. Finally, the server can determine the data transmission path of the current request data based on the data type and return the current request data to the terminal corresponding to the current resource retrieval request according to the data transmission path.
[0324] or,
[0325] Upon receiving a user's instruction to browse page resources for a target page, a current resource retrieval request is generated based on the instruction. Then, the current resource retrieval request is sent to the server, including a current resource retrieval sub-request corresponding to at least one page resource on the target page and a current resource identifier. After receiving the current request data returned by the server for the current resource identifier, the target page is displayed. Next, the user's browsing duration on the target page is detected, and based on the browsing duration, the connection duration with the server is determined.
[0326] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0327] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0328] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the data transmission methods provided in the embodiments of this application, the beneficial effects that any of the data transmission methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0329] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various alternative implementations of the data access aspect described above.
[0330] The data transmission method, apparatus, and computer-readable storage medium provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A data transmission method, characterized in that, include: Receive a current resource acquisition request for a target page, wherein the current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page; Based on the current resource identifier, determine the current request data corresponding to the current resource acquisition sub-request and the current data volume of the current request data; Obtain historical resource acquisition requests, and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests; Based on the current data volume and the historical request count, determine the data type of the current request data; The data transmission path of the currently requested data is determined based on the data type, and the currently requested data is returned to the terminal corresponding to the current resource acquisition request according to the data transmission path.
2. The data transmission method as described in claim 1, characterized in that, The request to obtain historical resources includes: The page resource request set is obtained by counting the page resource requests received within the target statistical period, and the page resource request set includes the current resource acquisition request; The current statistical period is defined as the statistical period in which the current resource acquisition request is located. The previous statistical period of the current statistical period is determined within the target statistical period to obtain the target historical statistical period. The page resource requests corresponding to the target historical statistical period are filtered out from the set of page resource requests to obtain the historical resource acquisition requests.
3. The data transmission method as described in claim 2, characterized in that, The historical resource acquisition request includes at least one historical resource acquisition sub-request, and each historical resource acquisition sub-request corresponds to a historical resource identifier. The step of querying the historical request count corresponding to the current request data from the historical resource acquisition requests includes: The target historical resource identifier is obtained by filtering out the historical resource identifiers that correspond to the current resource identifier of the current request data from the historical resource identifiers. The number of historical resource identifiers is counted to obtain the number of historical requests.
4. The data transmission method as described in claim 1, characterized in that, The step of determining the data type of the current request data based on the current data volume and the historical request count includes: Based on the current data volume, the request data in the page resource request set is sorted to obtain the first sorting position corresponding to the current request data; Based on the historical request count, the request data in the historical resource acquisition requests are sorted to obtain the second sorting position corresponding to the current request data; The data type of the currently requested data is determined based on the first sorting position and the second sorting position.
5. The data transmission method as described in claim 4, characterized in that, Based on the current data volume, the request data in the page resource request set is sorted to obtain the first sorting position corresponding to the current request data, including: Extract the page resource sub-request corresponding to each page resource request from the set of page resource requests, and determine the resource identifier corresponding to the page resource sub-request to obtain the set of resource identifiers; Determine the request data corresponding to each resource identifier in the resource identifier set and the request data volume of the request data, wherein the request data includes the current request data; The requested data is sorted according to its size to obtain the first sorting position.
6. The data transmission method as described in claim 5, characterized in that, The step of sorting the request data in the historical resource acquisition requests based on the historical request count to obtain the second sorting position corresponding to the current request data includes: The resource identifiers corresponding to the target historical statistical period are selected from the resource identifier set to obtain the target period resource identifier set; If the target period resource identifier set includes the current resource identifier corresponding to the current request data, count the number of resource requests corresponding to each resource identifier in the target period resource identifier set; The resource request counts are sorted according to the number of requests to obtain the second sorting position.
7. The data transmission method as described in claim 4, characterized in that, Determining the data type of the currently requested data based on the first sorting position and the second sorting position includes: If the first sorting position is less than a preset first sorting position, and the second sorting position is less than a preset second sorting position, then the currently requested data is determined to be a first data type. If the first sorting position is greater than or equal to the preset first sorting position, or the second sorting position is greater than or equal to the preset second sorting position, the currently requested data is determined to be a second data type.
8. The data transmission method as described in claim 1, characterized in that, Determining the data transmission path of the currently requested data based on the data type includes: If the data type of the currently requested data is a first data type, the data transmission path is determined to be an indirect transmission path; If the data type of the currently requested data is the second data type, the data transmission path is determined to be a direct transmission path.
9. The data transmission method as described in claim 8, characterized in that, The step of returning the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path includes: If the data transmission path is the indirect transmission path, obtain the set of edge cloud servers that have established data connections with the server; Query the target edge cloud server corresponding to the terminal from the set of edge cloud servers; The current request data is sent to the terminal via the target edge cloud server.
10. The data transmission method as described in claim 9, characterized in that, Sending the current request data to the terminal via the target edge cloud server includes: Obtain the current cache information of the target edge cloud server; If the current cache information indicates that the target edge cloud server has not cached the current request data, the current request data is sent to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal. If the current cache information indicates that the target edge cloud server has cached the current request data, a data feedback instruction for the current request data is sent to the target edge cloud server so that the target edge cloud server sends the current request data to the terminal.
11. The data transmission method as described in claim 10, characterized in that, Sending the current request data to the target edge cloud server includes: Obtain the target cache information of the currently requested data; The target cache information and the current request data are sent to the target edge cloud server so that the target edge cloud server can send the current request data to the terminal. The current cache information is updated based on the target cache information.
12. The data transmission method as described in claim 8, characterized in that, The step of returning the current request data to the terminal corresponding to the current resource acquisition request according to the data transmission path includes: If the data transmission path is the direct transmission path, the request data that has not been returned to the terminal at the current time is determined from the current request data to obtain the remaining request data set, which includes the target remaining request data corresponding to each current resource acquisition sub-request; The target remaining request data is compared with the remaining target remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data; Filter out the request data corresponding to the target data transmission volume from the target remaining request data to obtain the request data to be transmitted; Based on the target transmission rate, the request data to be transmitted is sent to the terminal corresponding to the current resource acquisition request.
13. The data transmission method as described in claim 12, characterized in that, The step of comparing the target remaining request data with the remaining target remaining request data in the set of remaining request data to obtain the target data transmission volume and target transmission rate of the target remaining request data includes: Based on the remaining data volume of the target remaining request data and the remaining data volume of the other target remaining request data, the target sending parameter value of the target remaining request data in the set of remaining request data is determined, and the target sending parameter value indicates the sending priority of the target remaining request data; Based on the target sending parameter value, determine the data sending weight of the remaining target request data in this transmission process; Based on the target transmission parameter values and the data transmission weight, the target data transmission volume, target transmission window, and target transmission rate of the remaining target request data in this transmission process are determined.
14. The data transmission method as described in claim 13, characterized in that, The step of determining the target transmission parameter value of the target remaining request data in the set of remaining request data based on the remaining data volume of the target remaining request data and the remaining data volume of the other target remaining request data includes: Sort the target remaining request data in the remaining request data set according to the data volume to obtain the sorting position corresponding to the target remaining request data; The sorting position and remaining data volume corresponding to the target remaining request data are input into a preset priority calculation rule to obtain the target sending parameter value of the target remaining request data. The sending parameter value indicates the sending priority of the target remaining request data.
15. The data transmission method as described in claim 14, characterized in that, The step of determining the data transmission weight of the remaining target request data in this transmission process based on the target transmission parameter value includes: The target sending parameter values of the remaining request data of each target are merged to obtain the merged parameter values; Calculate the ratio between the target sending parameter value and the fused parameter value to obtain the data sending weight of the remaining target request data in this transmission process.
16. The data transmission method as described in claim 14, characterized in that, The step of determining the target data transmission volume, target transmission window, and target transmission rate of the remaining target request data in this transmission process based on the target transmission parameter value and the data transmission weight includes: Obtain the sending window quota during this transmission process, and determine the target data transmission volume of the target remaining requested data based on the sending window quota and the data sending weight; The priority position of the target transmission parameter value in the transmission priority is determined, and based on the priority position, the target transmission window and target transmission rate of the remaining target request data are determined.
17. A data transmission method, characterized in that, include: When a user's instruction to browse page resources for a target page is received, a current resource acquisition request is generated based on the page resource browsing instruction; Send the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. Upon receiving the current request data returned by the server for the current resource identifier, the target page is displayed; The system detects the duration of the user's browsing of the target page and determines the connection duration with the server based on the browsing duration.
18. A data transmission device, characterized in that, include: The message receiving unit is used to receive a current resource acquisition request for a target page, wherein the current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page; The resource determination unit is used to determine the current request data corresponding to the current resource acquisition sub-request and the current data volume of the current request data based on the current resource identifier; The data query unit is used to obtain historical resource acquisition requests and query the number of historical requests corresponding to the current request data from the historical resource acquisition requests; A data processing unit is configured to determine the data type of the currently requested data based on the current data volume and the number of historical requests; The data transmission unit is configured to determine the data transmission path of the currently requested data according to the data type, and return the currently requested data to the terminal corresponding to the current resource acquisition request according to the data transmission path.
19. A data transmission device, characterized in that, include: The instruction receiving unit is used to generate a current resource acquisition request based on the page resource browsing instruction triggered by the user when it receives the page resource browsing instruction. The message sending unit is used to send the current resource acquisition request to the server. The current resource acquisition request includes a current resource acquisition sub-request and a current resource identifier corresponding to at least one page resource in the target page. The page display unit is used to display the content page corresponding to the current request data after receiving the current request data returned by the server for the current resource identifier; The connection confirmation unit is used to detect the user's browsing time on the content page, and based on the browsing time, determine the connection duration for connecting to the server for the next page resource browsing instruction.
20. An electronic device, characterized in that, It includes a processor and a memory, the memory storing an application program, and the processor running the application program within the memory to perform the steps of the data transmission method according to any one of claims 1 to 17.
21. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the data transmission method according to any one of claims 1 to 17.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the data transmission method according to any one of claims 1 to 17.