Resource downloading method and device

By obtaining and degrading the domain name list, the static resource download problem caused by CDN node failure is solved, ensuring the stability of user experience and the normal acquisition of resources.

CN118972344APending Publication Date: 2024-11-15SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410941259.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

When there is a problem with the content distribution network (CDN) node, static resources cannot be obtained normally, affecting the user's browsing experience.

Method used

By obtaining multiple domain names corresponding to the target resource, determining the local default domain name, and generating a downgraded domain name list when the download fails, using the downgraded domain name list to download the target resource to ensure the normal acquisition of static resources and the normal display of browsing pages.

Benefits of technology

In the event of a CDN node failure, other domain names are obtained by degrading the domain name list to download the target resources to ensure that the user experience is not affected, and to ensure the normal download of static resources and the normal display of browsing pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972344A_ABST
    Figure CN118972344A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource downloading method, and the method comprises the steps: obtaining N domain names corresponding to a target resource, and N is a positive integer greater than 1; determining a local default domain name of the target resource according to the domain name; downloading the target resource according to the local default domain name; under the condition that downloading fails, a degraded domain name list of the target resource is obtained, and the degraded domain name list is generated according to the domain name and target information of the client; and downloading the target resource according to the degraded domain name list. According to the technical scheme, disaster recovery can be achieved when the domain name part corresponding to the resource breaks down, and normal display of the browsed page and the browsing experience of a user are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a resource downloading method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] In order to improve the speed at which users access content, more and more platforms use CDN (Content Distribution Network) and deploy static resources (such as pictures, videos, JavaScript and CSS files, etc.) on widely distributed CDN nodes. Users can increase the speed of obtaining static resources by accessing the nearest CDN node.

[0003] However, when problems occur in these CDN nodes, static resources cannot be obtained normally, which will affect the user's browsing pages and affect the user's browsing experience.

[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0005] The embodiments of the present application provide a resource downloading method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0006] One aspect of an embodiment of the present application provides a resource downloading method, the method comprising:

[0007] Obtain N domain names corresponding to the target resource, where N is a positive integer greater than 1;

[0008] Determine a local default domain name of the target resource according to the domain name;

[0009] Downloading the target resource according to the local default domain name;

[0010] In case of download failure, obtaining a downgraded domain name list of the target resource, wherein the downgraded domain name list is generated according to the domain name and target information of the client;

[0011] The target resource is downloaded according to the degraded domain name list.

[0012] Optionally, determining a local default domain name of the target resource according to the domain name includes:

[0013] Get the pre-configured domain ratio for each domain name;

[0014] A local default domain name of the target resource is determined from the domain names according to the domain name ratio.

[0015] Optionally, before determining the local default domain name of the target resource from the domain names according to the domain name ratio, the method further includes:

[0016] Under the condition of obtaining authorization, obtaining target information of the client;

[0017] The determining the local default domain name of the target resource from the domain names according to the domain name ratio includes:

[0018] A local default domain name of the target resource is determined from the domain names according to the domain name ratio and the target information.

[0019] Optionally, determining a local default domain name of the target resource from the domain names according to the domain name ratio and the target information includes:

[0020] Dividing the preset interval into N sub-intervals according to the domain name ratio;

[0021] Determine the domain name corresponding to each of the sub-intervals according to the corresponding relationship between the proportion of each of the sub-intervals to the preset interval and the proportion of the domain names;

[0022] Determine a target value according to the target information;

[0023] Mapping the target value in the preset interval to determine a target sub-interval corresponding to the target value mapping;

[0024] The domain name corresponding to the target sub-interval is used as the local default domain name of the target resource.

[0025] Optionally, the method further comprises:

[0026] Determine a first weight corresponding to each of the domain names according to the domain name ratio;

[0027] Multiplying the first weight by a random number to obtain a second weight corresponding to each domain name;

[0028] The using the domain name corresponding to the target sub-interval as the local default domain name of the target resource includes:

[0029] Adjusting the second weight of the domain name corresponding to the target sub-interval so that the adjusted second weight is greater than the second weight of the remaining domain names;

[0030] The domain names are sorted in descending order according to the second weights of all the domain names, and the domain name ranked first is used as the local default domain name of the target resource.

[0031] Optionally, the step of sorting the domain names in descending order according to the second weights of all the domain names and using the domain name ranked first as the local default domain name of the target resource includes:

[0032] Obtain the downgraded domain name list according to the sorting result;

[0033] The downloading of the target resource according to the downgraded domain name list includes:

[0034] Polling starts from the second domain name in the degraded domain name list until the target resource is downloaded successfully or the last domain name in the degraded domain name list is polled.

[0035] Optionally, the method further comprises:

[0036] Monitor and record downloads for each domain name;

[0037] Evaluating the connectivity of each of the domain names according to the download situation;

[0038] When the connectivity of the local default domain name meets the preset condition, a new local default domain name is determined according to the remaining domain names of the target resource and the corresponding connectivity.

[0039] Another aspect of an embodiment of the present application provides a resource downloading device, the device comprising:

[0040] A first acquisition module is used to acquire N domain names corresponding to the target resource, where N is a positive integer greater than 1;

[0041] A determination module, used to determine a local default domain name of the target resource according to the domain name;

[0042] A download module, used to download the target resource according to the local default domain name;

[0043] A second acquisition module, configured to acquire a degraded domain name list of the target resource in case of a download failure, wherein the degraded domain name list is generated according to the domain name and target information of the client;

[0044] The downgrade module is used to download the target resource according to the downgraded domain name list.

[0045] Another aspect of an embodiment of the present application provides a computer device, including:

[0046] at least one processor; and

[0047] a memory communicatively coupled to the at least one processor;

[0048] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0049] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0050] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0051] The above technical solution adopted in the embodiment of the present application may have the following advantages:

[0052] By obtaining N domain names corresponding to the target resource, the local default domain name is determined based on the N domain names, and the target resource is downloaded based on the local default domain name; when the download fails, a downgraded domain name list generated based on the domain name and the target information of the client is obtained, and the target resource is downloaded based on the downgraded domain name list. In the event of a failure in a certain domain name, other domain names can be obtained through the downgraded domain name list to download the target resource, thereby ensuring the normal download of static resources and the normal display of the corresponding browsing page, and ensuring that the user's browsing experience is not affected. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0054] Figure 1 The following schematically shows an operating environment diagram of the resource downloading method according to the first embodiment of the present application;

[0055] Figure 2 The flowchart of the resource downloading method according to the first embodiment of the present application is schematically shown;

[0056] Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S202;

[0057] Figure 4 Schematically shows Figure 2 Another sub-step flow chart of step S202;

[0058] Figure 5The newly added process of the resource downloading method according to the first embodiment of the present application is schematically shown;

[0059] Figure 6 Schematically shows Figure 4 Flow chart of sub-steps of step S408;

[0060] Figure 7 Another newly added process of the resource downloading method according to the first embodiment of the present application is schematically shown;

[0061] Figure 8 A diagram schematically shows an application example of the resource downloading method of the first embodiment of the present application;

[0062] Fig. 9 A block diagram of a resource downloading device according to Embodiment 2 of the present application is schematically shown; and

[0063] Fig.10 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0065] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0066] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0067] First, the following terms are explained:

[0068] Content Delivery Network (CDN) is a strategically deployed overall system that aims to enable users to obtain the required content nearby, solve the problem of Internet network congestion, and improve the response speed of users visiting websites.

[0069] Static resources usually refer to those resources in web applications that do not change frequently or do not need to be reloaded from the server frequently. These resources remain basically unchanged during the life cycle of the web application and are usually provided directly to the client through the HTTP protocol.

[0070] Load balancing is a technology that distributes network traffic, requests or workloads to multiple servers or computing resources. Its purpose is to improve the performance, reliability and scalability of the system. In a high-traffic or high-load network environment, a single server may not be able to handle all requests or workloads. Load balancing distributes traffic to multiple servers so that each server can share the load evenly, thereby improving the processing capacity of the entire system.

[0071] SDK (Software Development Kit) is a collection of programming tools and library files used to create application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. SDK is usually provided by software developers to help third-party developers call specific software functions, use software services or access hardware interfaces.

[0072] SSR (Server Side Rendering) is a traditional rendering method, where the server sends the rendered complete page to the client. This reduces the number of HTTP requests from the client to the server, speeds up the response, and is generally used for performance optimization of the first screen.

[0073] CSR (Client Side Rendering) is a popular rendering method that relies on JS running on the client. The first request sent by the user can only get a small part of the guiding HTML code. The second request will request more JS files containing HTML strings.

[0074] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:

[0075] In the related art, static resources are deployed on widely distributed nodes of CDN. Users can access the nearest CDN node to increase the speed of obtaining static resources. However, when problems occur in some CDN nodes, static resources cannot be obtained normally, which will have a significant impact on the user's browsing page and affect the user experience.

[0076] To this end, the embodiment of the present application provides a resource downloading technical solution. In this technical solution, when a domain name of a static resource fails, it can be downgraded to another domain name for access, thereby ensuring the normal display of the browsing page and ensuring that the user experience is not affected. See below for details.

[0077] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0078] like Figure 1 As shown, the operating environment diagram includes: service platform 2, network 4, client 6, where:

[0079] The service platform 2 may be composed of a single or multiple computing devices. The multiple computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.

[0080] The service platform 2 may be configured to communicate with the client 6 or the like via a network 4. The network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network 4 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.

[0081] The service platform 2 can provide storage, reading, downloading, writing, querying, deleting and other services, such as providing static resource download services to clients through multiple domain names.

[0082] Client 6 can be a Windows, Android TM ) or iOS operating systems, such as smartphones, tablet devices, laptop computers, virtual reality devices, gaming devices, set-top boxes, in-vehicle terminals, and smart TVs. Based on the above operating systems, various applications, such as browsers, can be run.

[0083] The client 6 can provide / configure a user access page, which is used to download corresponding static resources from the service platform 2 to the client 6 for display, etc.

[0084] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.

[0085] The following describes the technical solution of the present application through multiple embodiments, taking the client as the execution subject. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.

[0086] Embodiment 1

[0087] Figure 2 The flowchart of the resource downloading method according to the first embodiment of the present application is schematically shown.

[0088] like Figure 2 As shown, the resource downloading method may include steps S200 to S208, wherein:

[0089] Step S200, obtaining N domain names corresponding to the target resource, where N is a positive integer greater than 1.

[0090] Step S202: determining the local default domain name of the target resource according to the domain name.

[0091] Step S204: Download the target resource according to the local default domain name.

[0092] Step S206: in case of download failure, obtain a downgraded domain name list of the target resource, wherein the downgraded domain name list is generated according to the domain name and target information of the client.

[0093] Step S208: Download the target resource according to the downgraded domain name list.

[0094] The resource downloading method provided in this embodiment obtains N domain names corresponding to the target resource, determines a local default domain name according to the N domain names, and downloads the target resource according to the local default domain name; when the download fails, obtains a downgraded domain name list generated according to the domain name and the target information of the client, and downloads the target resource according to the downgraded domain name list. In the event of a failure in a certain domain name, other domain names can be obtained through the downgraded domain name list to download the target resource, thereby ensuring the normal download of static resources and the normal display of corresponding browsing pages, and ensuring that the user's browsing experience is not affected.

[0095] The following combination Figure 2 , each step in steps S200 to S208 and other optional steps are described in detail.

[0096] Step S200 , obtain N domain names corresponding to the target resource, where N is a positive integer greater than 1.

[0097] The client can read the remote configuration of the service platform to obtain N domain names corresponding to the target resources and domain name-related configurations.

[0098] Step S202 , determine the local default domain name of the target resource based on the domain name.

[0099] When determining the local default domain name of the target resource based on multiple domain names, the client can randomly determine a domain name from the multiple domain names as the local default domain name of the target resource; or, based on historical data (such as historical download records), select the domain name used last time as the local default domain name of the target resource, and so on.

[0100] Step S204 , download the target resource according to the local default domain name.

[0101] The client requests to download the target resource according to the local default domain name. When the service platform receives the client's request, it navigates the client to the corresponding CDN node according to the local default domain name to download the target resource.

[0102] Step S206 , in case of download failure, obtain the downgraded domain name list of the target resource, where the downgraded domain name list is generated according to the domain name and the target information of the client.

[0103] The target information of the client may include the geographical location of the client, network status information, device type, or historical download data.

[0104] For example, the client may sort the download success rates of various domain names of the target resource according to historical download data, thereby obtaining a list of downgraded domain names.

[0105] The downgraded domain name list of the target resource can be generated after all the domain names corresponding to the target resource are obtained, or it can be generated based on the domain names corresponding to the target resource when the download fails. In the case of a download failure, the local default domain name can be excluded and the downgraded domain name list can be generated based on the remaining domain names.

[0106] Step S208 , download the target resources according to the downgraded domain name list.

[0107] The client can poll the domain names in the downgraded domain name list until the target resource is successfully downloaded or all domain names are polled. If the downgraded domain name list contains the local default domain name, the client can start polling from the second domain name in the list.

[0108] In an optional embodiment, in step S202, the local default domain name of the target resource is determined according to the domain name, such as Figure 3 As shown, it may include steps S300 to S302:

[0109] Step S300, obtaining a pre-configured domain name ratio for each domain name.

[0110] Step S302: determining a local default domain name of the target resource from the domain names according to the domain name ratio.

[0111] The pre-configured domain name ratio for each domain name can be configured by the service platform according to actual conditions. For example, if the domain names corresponding to the target resources are D1, D2, and D3, the service platform can configure the domain name ratio to 1:1:1; if the bandwidth resources of the D1 domain name are sufficient, the domain name ratio can be configured to 2:1:1; or, if the D2 domain name fails, the domain name ratio can be configured to 1:0:1, and so on.

[0112] When the client determines the local default domain name of the target resource from the domain names according to the domain name ratio, the domain name with the highest domain name ratio can be directly used as the local default domain name, or the ratio of each domain name can be multiplied by a random number between 0 and 1, and the result is used as the weight of each domain name. The weights of each domain name are then sorted, and the domain name ranked first is used as the local default domain name.

[0113] In the above optional embodiment, by obtaining the pre-configured domain name ratio of each domain name, determining the local default domain name of the target resource from the domain names according to the domain name ratio, the access traffic of each domain name can be configured according to the domain name ratio to achieve the purpose of load balancing, thereby improving the flexibility of managing resource access.

[0114] In an optional embodiment, before step S302, that is, before determining the local default domain name of the target resource from the domain names according to the domain name ratio, the resource download method of the embodiment of the present application may also include: obtaining the target information of the client under the condition of obtaining authorization; accordingly, step S302 may include: determining the local default domain name of the target resource from the domain names according to the domain name ratio and the target information.

[0115] For example, if the client's target information is the historical download data of each domain name, the weight corresponding to each domain name can be comprehensively determined based on the domain name ratio and the historical download data, and then the weight of each domain name is sorted, and finally the domain name with the largest weight is selected as the local default domain name of the target resource.

[0116] In the above optional embodiment, by obtaining the target information of the client, the local default domain name of the target resource is determined from the domain names according to the domain name ratio and the target information of the client. The local default domain name can be further determined based on the domain name ratio and the target information of the client. While achieving load balancing, the local default domain name can be made more in line with the actual situation of the client, which is more conducive to the smooth download of the target resource.

[0117] In an optional embodiment, the local default domain name of the target resource is determined from the domain name according to the domain name ratio and the target information, such as Figure 4 As shown, it may include steps S400 to S408:

[0118] Step S400: Divide the preset interval into N sub-intervals according to the domain name ratio.

[0119] Step S402: determining the domain name corresponding to each sub-interval according to the corresponding relationship between the proportion of each sub-interval to the preset interval and the proportion of the domain name.

[0120] Step S404, determining the target value according to the target information.

[0121] Step S406, mapping the target value in a preset interval, and determining a target sub-interval corresponding to the target value mapping.

[0122] Step S408: Use the domain name corresponding to the target sub-interval as the local default domain name of the target resource.

[0123] For example, the preset interval is an interval of [0,100). If the domain names are D1, D2, and D3, and the domain name ratio is 2:2:1, then they can be divided into three sub-intervals of [0,40), [40,80), and [80,100) according to the domain name ratio. Correspondingly, the ratio of each sub-interval to the preset interval is also 2:2:1. Then, according to the corresponding relationship between the two ratios, the domain name corresponding to each sub-interval can be determined. For example, the three sub-intervals of [0,40), [40,80), and [80,100) correspond to the three domain names of D1, D2, and D3 respectively, and two domain names with the same ratio can be specified arbitrarily or in a certain order.

[0124] In the above step S404, the target information can be certain information configured by the service platform for each client or the corresponding user of the client, such as user ID information. The target information belongs to a certain numerical range, such as the range of 0-255. After obtaining the target information, the target information can be directly used as the target value, or the target information can be processed in a certain way and the processed result can be used as the target value.

[0125] Assuming that the target information is directly used as the target value, in the above step S406, the number 0-255 can be mapped in the interval [0,100) to determine the target sub-interval corresponding to the target value mapping. For example, if the target value is 150, 150 can be divided by 255 and then multiplied by 100, and the result is about 58.82, which falls in the target sub-interval [40,80). Then the domain name D2 corresponding to [40,80) can be used as the local default domain name of the target resource.

[0126] In the above optional embodiment, the preset interval is divided into N sub-intervals according to the domain name ratio, and the domain name corresponding to each sub-interval is determined according to the corresponding ratio; the target value is determined according to the target information of the client, the target value is mapped in the preset interval, the target sub-interval corresponding to the target value is determined, and the domain name corresponding to the target sub-interval is used as the local default domain name of the target resource. By combining the domain name ratio and the target information of the client to determine the local default domain name of the target resource, the access traffic of each client can be effectively and purposefully managed to achieve load balancing of each domain name.

[0127] In an optional embodiment, if Figure 5 As shown, the resource downloading method may further include steps S500 to S502:

[0128] Step S500: determining a first weight corresponding to each domain name according to the domain name ratio.

[0129] Step S502: multiply the first weight by a random number to obtain a second weight corresponding to each domain name.

[0130] Accordingly, in the above step S408, the domain name corresponding to the target sub-interval is used as the local default domain name of the target resource, such as Figure 6 As shown, it may include steps S504 to S506:

[0131] Step S504: adjust the second weight of the domain name corresponding to the target sub-interval so that the adjusted second weight is greater than the second weight of the remaining domain names.

[0132] Step S506: sort the domain names in descending order according to the second weights of all the domain names, and use the domain name ranked first as the local default domain name of the target resource.

[0133] The first weight corresponding to each domain name can be directly obtained according to the domain name ratio. For example, if the corresponding domain names are three domain names D1, D2, and D3, and the domain name ratio is 2:2:1, the corresponding first weights can be: 0.4, 0.4, and 0.2.

[0134] When the first weight is multiplied by a random number to obtain the second weight, it can be multiplied by a random number of 0-1. Assuming that the random number of D1 is 0.4, the random number of D2 is 0.3, and the random number of D3 is 0.5, the second weights of D1, D2, and D3 are 0.16, 0.12, and 0.1.

[0135] If the domain name corresponding to the target sub-interval is D2, the weight of D2 is adjusted so that the adjusted second weight is greater than the second weights of the remaining domain names, for example, the weight of D2 is adjusted to 0.5.

[0136] After the adjustment, the second weights of all domain names are sorted from large to small, and the first-ranked domain name is used as the local default domain name of the target resource. In the above example, since D2 has the largest second weight, D2 is used as the local default domain name of the target resource.

[0137] In the above optional embodiment, the first weight of each domain name is determined according to the domain name ratio, and the second weight of each domain name is obtained by multiplying the first weight by a random number. The second weight of the domain name corresponding to the target sub-interval is adjusted so that the adjusted second weight of the domain name corresponding to the target sub-interval is greater than the second weight of the remaining domain names. Then the second weights of all domain names are sorted, and the domain name at the top of the sort is taken as the local default domain name of the target resource. Since the target sub-interval is obtained based on the target information of the client, the local default domain name corresponding to the client can be determined based on the target information of the client, so that clients in different parts (different target sub-intervals) correspond to different local default domain names, thereby realizing the diversion of access traffic and load balancing of each domain name.

[0138] In an optional embodiment, in step S506, the domain names are sorted in descending order according to the second weights of all domain names, and the first-ranked domain name is used as the local default domain name of the target resource, which may include: obtaining a downgraded domain name list according to the sorting result; accordingly, step S208 may include: starting polling from the second domain name in the downgraded domain name list until the target resource is successfully downloaded or the last domain name in the downgraded domain name list is polled.

[0139] Taking the above example, after adjustment, the second weights of D1, D2, and D3 are 0.16, 0.5, and 0.1, and the result of sorting the second weights of all domain names is: D2 (0.5), D1 (0.16), and D3 (0.1), which is the downgraded domain name list. Since D2 is the local default domain name and has failed to be downloaded, the second domain name D1 in the downgraded domain name list is polled until the target resource is successfully downloaded or the third domain name D3 is also polled.

[0140] In the above optional embodiment, by obtaining a downgraded domain name list according to the sorting result, the downgraded domain name list can be obtained while determining the local default domain name; and when downloading the target resource according to the downgraded domain name list, polling starts from the second domain name in the downgraded domain name list until the target resource is successfully downloaded or the downgraded domain name list is polled until the last domain name is downloaded. When the local default domain name fails to be downloaded, the target resource can be downloaded through other domains, thereby increasing the probability of successful download of the target resource and reducing the impact on the user's browsing page.

[0141] In an optional embodiment, if Figure 7 As shown, the resource downloading method may further include steps S600 to S604:

[0142] Step S600, monitor and record the download status of each domain name.

[0143] Step S602: Evaluate the connectivity of each domain name according to the download status.

[0144] Step S604: when the connectivity of the local default domain name meets the preset condition, a new local default domain name is determined according to the remaining domain names of the target resource and the corresponding connectivity.

[0145] During the resource download process, the success or failure of each domain name download is recorded, and the connectivity of each domain name is determined based on the recorded download status.

[0146] The preset condition may include setting a threshold for the connectivity indicator, and when the connectivity of the local default domain name is lower than the threshold, determining a new local default domain name according to the remaining domain names and the corresponding connectivity.

[0147] In the above optional embodiments, by monitoring and recording the download status of each domain name, the connectivity of each domain name is evaluated according to the download status, and when the connectivity of the local default domain name meets the preset conditions, a new local default domain name is determined according to the remaining domain names of the target resource and the corresponding connectivity. When the connectivity of the local default domain name is poor, the new local default domain name can be replaced, thereby improving the success rate of resource downloading and reducing the impact on the user's browsing page.

[0148] In an optional embodiment, the resource download method provided in the embodiment of the present application is applied to the SDK preset by the client. It is understandable that in actual applications, the resource download method can also be directly written into the corresponding code of the client; and when applied to the SDK preset by the client, there is no need to write all the codes from scratch, which can significantly simplify the development process, improve development efficiency, and also help to ensure the compatibility and stability of the system.

[0149] In order to make this application easier to understand, the following Figure 8An exemplary application is provided.

[0150] As shown in the figure, the client uses the preset SDK to download static resources. The general process may include:

[0151] 1. The SDK is initialized on the client side and reads the remote configuration of the service platform, where the remote configuration may include the domain name ratios preset for each domain name;

[0152] 2. After the remote switch is turned on, the local global configuration is generated based on the relevant information of the client and the read remote configuration. The local global configuration includes the local default domain name and the downgraded domain name list. The relevant information of the client and the local global configuration can be stored in the browser's cookie. In order to be compatible with both SSR and CSR rendering methods, the same identifier can be used in the cookie;

[0153] 3. Use the local default domain name to download static resources (such as pictures). Whether the download of static resources is successful or not, the preset tracker will be called to record the connectivity of the domain name. If the connectivity of the local default domain name exceeds a preset threshold, the local default domain name will be replaced;

[0154] 4. If the download fails, call the SDK to replace the candidate domain name according to the downgraded domain name list for download until the static resource is downloaded successfully or all domain names are replaced and the download still fails.

[0155] Embodiment 2

[0156] Fig. 9 The block diagram of the resource downloading device 700 according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig. 9 As shown, the apparatus 700 may include: a first acquisition module 710, a determination module 720, a download module 730, a second acquisition module 740 and a downgrade module 750, wherein:

[0157] A first acquisition module 710 is used to acquire N domain names corresponding to the target resource, where N is a positive integer greater than 1;

[0158] A determination module 720, configured to determine a local default domain name of the target resource according to the domain name;

[0159] A download module 730, configured to download the target resource according to the local default domain name;

[0160] A second acquisition module 740 is used to acquire a degraded domain name list of the target resource in case of a download failure, wherein the degraded domain name list is generated according to the domain name and target information of the client;

[0161] The demotion module 750 is used to download the target resource according to the demotion domain name list.

[0162] In an optional embodiment, the determination module 720 is further configured to:

[0163] Get the pre-configured domain ratio for each domain name;

[0164] A local default domain name of the target resource is determined from the domain names according to the domain name ratio.

[0165] In an optional embodiment, the device 700 is further used for:

[0166] Under the condition of obtaining authorization, obtaining target information of the client;

[0167] The determination module 720 is further configured to:

[0168] A local default domain name of the target resource is determined from the domain names according to the domain name ratio and the target information.

[0169] In an optional embodiment, the determination module 720 is further configured to:

[0170] Dividing the preset interval into N sub-intervals according to the domain name ratio;

[0171] Determine the domain name corresponding to each of the sub-intervals according to the corresponding relationship between the proportion of each of the sub-intervals to the preset interval and the proportion of the domain names;

[0172] Determine a target value according to the target information;

[0173] Mapping the target value in the preset interval to determine a target sub-interval corresponding to the target value mapping;

[0174] The domain name corresponding to the target sub-interval is used as the local default domain name of the target resource.

[0175] In an optional embodiment, the device 700 is further used for:

[0176] Determine a first weight corresponding to each of the domain names according to the domain name ratio;

[0177] Multiplying the first weight by a random number to obtain a second weight corresponding to each domain name;

[0178] The determination module 720 is further configured to:

[0179] Adjusting the second weight of the domain name corresponding to the target sub-interval so that the adjusted second weight is greater than the second weight of the remaining domain names;

[0180] The domain names are sorted in descending order according to the second weights of all the domain names, and the domain name ranked first is used as the local default domain name of the target resource.

[0181] In an optional embodiment, the determination module 720 is further configured to:

[0182] Obtain the downgraded domain name list according to the sorting result;

[0183] The downgrade module 750 is also used to:

[0184] Polling starts from the second domain name in the degraded domain name list until the target resource is downloaded successfully or the last domain name in the degraded domain name list is polled.

[0185] In an optional embodiment, the device 700 is further used for:

[0186] Monitor and record downloads for each domain name;

[0187] Evaluating the connectivity of each of the domain names according to the download situation;

[0188] When the connectivity of the local default domain name meets the preset condition, a new local default domain name is determined according to the remaining domain names of the target resource and the corresponding connectivity.

[0189] In an optional embodiment, the device 700 is applied to a SDK preset by the client.

[0190] Embodiment 3

[0191] Fig.10 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the resource download method according to the third embodiment of the present application is shown schematically. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.10 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0192] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program code of the resource download method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0193] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0194] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0195] It should be pointed out that Fig.10 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0196] In this embodiment, the resource downloading method stored in the memory 10010 may also be divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiment of the present application.

[0197] Embodiment 4

[0198] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the resource downloading method in the embodiment are implemented.

[0199] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEP ROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the resource download method in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0200] Embodiment 5

[0201] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0202] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0203] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A resource downloading method, characterized in that: The method comprises: Obtain N domain names corresponding to the target resource, where N is a positive integer greater than 1; Determine a local default domain name of the target resource according to the domain name; Downloading the target resource according to the local default domain name; In case of download failure, obtaining a downgraded domain name list of the target resource, wherein the downgraded domain name list is generated according to the domain name and target information of the client; The target resource is downloaded according to the degraded domain name list.

2. The method according to claim 1, characterized in that The determining the local default domain name of the target resource according to the domain name includes: Get the pre-configured domain ratio for each domain name; A local default domain name of the target resource is determined from the domain names according to the domain name ratio.

3. The method according to claim 2, characterized in that Before determining the local default domain name of the target resource from the domain names according to the domain name ratio, the method further includes: Under the condition of obtaining authorization, obtaining target information of the client; The determining the local default domain name of the target resource from the domain names according to the domain name ratio includes: A local default domain name of the target resource is determined from the domain names according to the domain name ratio and the target information.

4. The method according to claim 3, characterized in that The determining the local default domain name of the target resource from the domain names according to the domain name ratio and the target information includes: Dividing the preset interval into N sub-intervals according to the domain name ratio; Determine the domain name corresponding to each of the sub-intervals according to the corresponding relationship between the proportion of each of the sub-intervals to the preset interval and the proportion of the domain names; Determine a target value according to the target information; Mapping the target value in the preset interval to determine a target sub-interval corresponding to the target value mapping; The domain name corresponding to the target sub-interval is used as the local default domain name of the target resource.

5. The method according to claim 4, characterized in that The method further comprises: Determine a first weight corresponding to each of the domain names according to the domain name ratio; Multiplying the first weight by a random number to obtain a second weight corresponding to each domain name; The using the domain name corresponding to the target sub-interval as the local default domain name of the target resource includes: Adjusting the second weight of the domain name corresponding to the target sub-interval so that the adjusted second weight is greater than the second weight of the remaining domain names; The domain names are sorted in descending order according to the second weights of all the domain names, and the domain name ranked first is used as the local default domain name of the target resource.

6. The method according to claim 5, characterized in that The step of sorting the domain names in descending order according to the second weights of all the domain names and using the first-ranked domain name as the local default domain name of the target resource includes: Obtain the downgraded domain name list according to the sorting result; The downloading of the target resource according to the downgraded domain name list includes: Polling starts from the second domain name in the degraded domain name list until the target resource is downloaded successfully or the last domain name in the degraded domain name list is polled.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Monitor and record downloads for each domain name; Evaluating the connectivity of each of the domain names according to the download situation; When the connectivity of the local default domain name meets the preset condition, a new local default domain name is determined according to the remaining domain names of the target resource and the corresponding connectivity.

8. A resource downloading device, characterized in that: The device comprises: A first acquisition module is used to acquire N domain names corresponding to the target resource, where N is a positive integer greater than 1; A determination module, used to determine a local default domain name of the target resource according to the domain name; A download module, used to download the target resource according to the local default domain name; A second acquisition module, configured to acquire a degraded domain name list of the target resource in case of a download failure, wherein the degraded domain name list is generated according to the domain name and target information of the client; The downgrade module is used to download the target resource according to the downgraded domain name list.

9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.