Disclosure of Invention
The embodiment of the disclosure at least provides a data distribution method and device.
In a first aspect, an embodiment of the present disclosure provides a data distribution method, including:
obtaining browser attribute information of a plurality of clients in a target area corresponding to a plurality of distribution nodes respectively;
Determining the browser distribution condition in a target area corresponding to each distribution node based on the browser attribute information;
Determining a preference browser patch corresponding to the distribution node based on the browser distribution condition;
And sending the preference browser patch to the distribution node, so that the distribution node caches the preference browser patch and sends the preference browser patch to the client under the condition that a service request sent by the client with browser attribute information matched with the preference browser patch is received.
In an optional embodiment, the determining, based on the browser attribute information, a browser distribution condition in a target area corresponding to the distribution node includes:
Based on the browser attribute information, determining version information corresponding to each of the browsers of the plurality of clients in the target area;
and determining the browser distribution condition in the target area based on the number of clients corresponding to each version information in the target area.
In an optional implementation manner, the determining, based on the browser distribution situation, a preferred browser patch corresponding to the distribution node includes:
Based on the ratio of the number of the browsers corresponding to each version information to the total number of the browsers in the browser subsection situation, selecting a preference browser from the browsers corresponding to each version information;
And determining the browser patches required by the preference browser as preference browser patches corresponding to the distribution nodes.
In an alternative embodiment, determining the browser patches required by the preferred browser includes:
Determining a first characteristic supported by the preference browser based on the attribute information of the preference browser;
determining, based on the first characteristic, a second characteristic absent from the preference browser to access the target service;
based on the second characteristic, a browser patch required by the preferred browser is determined.
In an alternative embodiment, the method further comprises:
Responding to a browser patch acquisition request sent by the distribution node, and generating a newly added browser patch matched with target browser attribute information based on the target browser attribute information indicated by the browser patch acquisition request;
and sending the generated newly-added browser patch to the distribution node, so that the distribution node sends the newly-added browser patch to the client under the condition that the distribution node receives a service request sent by the client of which the browser attribute information is matched with the newly-added browser patch.
In an alternative embodiment, the method further comprises:
And sending the preference browser patches and/or the newly-added browser patches sent to each distribution node to a global cache database, so that the distribution node obtains the target browser patches from the global cache database and sends the target browser patches to the client under the condition that the distribution node receives a service request sent by the client, wherein the browser attribute information of the service request is matched with the target browser patches stored in the global cache database.
In a second aspect, an embodiment of the present disclosure further provides a data distribution apparatus, including:
The acquisition module is used for acquiring the browser attribute information of a plurality of clients in the target areas corresponding to the distribution nodes respectively;
the first determining module is used for determining the browser distribution condition in a target area corresponding to each distribution node based on the browser attribute information;
The second determining module is used for determining a preference browser patch corresponding to the distributing node based on the browser distribution condition;
And the sending module is used for sending the preference browser patch to the distribution node so that the distribution node caches the preference browser patch and sends the preference browser patch to the client under the condition that a service request sent by the client with the browser attribute information matched with the preference browser patch is received.
In an alternative embodiment, the first determining module is specifically configured to:
Based on the browser attribute information, determining version information corresponding to each of the browsers of the plurality of clients in the target area;
and determining the browser distribution condition in the target area based on the number of clients corresponding to each version information in the target area.
In an alternative embodiment, the second determining module is specifically configured to:
Based on the ratio of the number of the browsers corresponding to each version information to the total number of the browsers in the browser subsection situation, selecting a preference browser from the browsers corresponding to each version information;
And determining the browser patches required by the preference browser as preference browser patches corresponding to the distribution nodes.
In an alternative embodiment, the second determining module is further configured to:
Determining a first characteristic supported by the preference browser based on the attribute information of the preference browser;
determining, based on the first characteristic, a second characteristic absent from the preference browser to access the target service;
based on the second characteristic, a browser patch required by the preferred browser is determined.
In an alternative embodiment, the apparatus further comprises a generating module configured to:
Responding to a browser patch acquisition request sent by the distribution node, and generating a newly added browser patch matched with target browser attribute information based on the target browser attribute information indicated by the browser patch acquisition request;
and sending the generated newly-added browser patch to the distribution node, so that the distribution node sends the newly-added browser patch to the client under the condition that the distribution node receives a service request sent by the client of which the browser attribute information is matched with the newly-added browser patch.
In an alternative embodiment, the apparatus further includes a caching module configured to:
And sending the preference browser patches and/or the newly-added browser patches sent to each distribution node to a global cache database, so that the distribution node obtains the target browser patches from the global cache database and sends the target browser patches to the client under the condition that the distribution node receives a service request sent by the client, wherein the browser attribute information of the service request is matched with the target browser patches stored in the global cache database.
In a third aspect, the disclosed embodiments also provide an electronic device comprising a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is in operation, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fourth aspect, the presently disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the first aspect, or any of the possible implementations of the first aspect.
The data distribution method and device provided by the embodiment of the disclosure acquire browser attribute information of a plurality of clients in target areas corresponding to a plurality of distribution nodes respectively, determine browser distribution conditions in the target areas corresponding to the distribution nodes based on the browser attribute information for each distribution node, determine preference browser patches corresponding to the distribution nodes based on the browser distribution conditions, send the preference browser patches to the distribution nodes so that the distribution nodes cache the preference browser patches, and send the preference browser patches to the clients under the condition that service requests sent by the clients with the browser attribute information matched with the preference browser patches are received. According to the embodiment of the disclosure, the distribution nodes are deployed to carry out regional distribution on the browser patches, so that the time consumed by the client for acquiring the browser patches can be effectively reduced, the webpage access speed is improved, the browser distribution condition in the target area is determined based on the browser attribute information, and the preference browser patches of the distribution nodes are determined according to the browser distribution condition, so that the distribution nodes preferentially cache the preference browser patches, the probability of requesting patches from the server by the distribution nodes is reduced, the page access speed is improved, the transmission of useless patches can be reduced, and the waste of network resources is avoided.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the embodiments of the present disclosure, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
It should be noted that like reference numerals and letters refer to like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The term "and/or" is used herein to describe only one relationship, and means that three relationships may exist, for example, A and/or B, and that three cases exist, A alone, A and B together, and B alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, may mean including any one or more elements selected from the group consisting of A, B and C.
In order to solve the technical problems of larger communication delay and longer patch transmission time between a client and a server, the present disclosure provides a data distribution method and device, by deploying a distribution node, the time consumed by the client for acquiring the browser patch can be effectively reduced, the web page access speed is improved, the browser distribution situation in a target area is determined based on browser attribute information, and the preference browser patch of the distribution node is determined according to the browser distribution situation, so that the distribution node preferentially caches the preference browser patch, the probability of requesting the patch from the server by the distribution node is reduced, the page access speed is further improved, the transmission of useless patches can be reduced, and the waste of network resources is avoided.
For the sake of understanding the present embodiment, first, a detailed description will be given of a data distribution system disclosed in the present embodiment, and referring to fig. 1, which is a schematic diagram of a data distribution system provided in the present embodiment, the data distribution system provided in the present embodiment includes a plurality of distribution nodes, a global cache database, and a server, where the distribution nodes, the global cache database, and the server may communicate with each other, and the distribution nodes may also communicate with a client. When the client accesses the target website, the client can send a request to the distribution node, the distribution node locally caches various browser patches, can select the corresponding browser patches based on the browser attribute information corresponding to the client, and send the browser patches to the client, so that the client can access the target website, the server can generate patches required by the distribution node and send the patches to the distribution node, and the global cache database can be used as a cache database of all content distribution nodes and also caches various browser patches. In order to better explain the generation of the browser patch and the cache distribution of the server, the embodiment of the disclosure provides a data distribution method, and an execution subject of the data distribution method can be the server.
Referring to fig. 2, a flowchart of a data distribution method according to an embodiment of the disclosure is shown, where the method includes steps S201 to S204, where:
s201, browser attribute information of a plurality of clients in target areas corresponding to the distribution nodes is obtained.
The method comprises the steps that a distribution node can be deployed in a plurality of areas, the area to which the distribution node belongs is the target area, when a client accesses a website, an access request can be sent to the distribution node of the area to which the client belongs, browser attribute information of a plurality of clients in the target area corresponding to each distribution node can be obtained, wherein the browser attribute information of the plurality of clients in the target area can be obtained in a sampling and sampling investigation mode, and the browser attribute information can comprise at least one of version information of a browser, browser identification information, application program interfaces required by the browser, patches required by the browser, interfaces supported by the browser and the like.
S202, determining the browser distribution condition in a target area corresponding to each distribution node based on the browser attribute information.
In this step, for each distribution node, the number of each version of the browser and the total number of acquired browser attribute information in the browser attribute information corresponding to the distribution node may be determined, and based on this, the browser distribution situation in the target area may be determined, where the browser distribution situation may include the usage ratio of each version of the browser in the corresponding target area, that is, the ratio of the number of the browsers corresponding to each version of the information to the total number of the browsers.
For example, version information of each browser may be determined based on the browser attribute information, and then, based on the number of browsers corresponding to each version information, a distribution situation of the browsers in the target area may be determined.
S203, determining a preference browser patch corresponding to the distribution node based on the browser distribution condition.
In this step, the server may determine, according to the browser distribution situation, a preferred browser from multiple clients, specifically, may determine, based on a ratio of the number of browsers corresponding to each version information to the total number of browsers in the browser division situation, that a browser with the ratio being greater than or equal to a preset ratio is a preferred browser, and then may determine a browser patch corresponding to the preferred browser as a preferred browser patch.
The browser patch corresponding to the preference browser can be determined according to version information of the browser, and exemplary, the first characteristic supported by the browser can be determined according to the version information of the browser, and then based on the first characteristic supported by the browser and the characteristic required by the access target, the second characteristic lacking in the preference browser to access the target service is determined, and patch files corresponding to the second characteristics are packaged, so that the browser patch required to be installed by the browser under the version information can be generated.
S204, sending the preference browser patch to the distribution node so that the distribution node caches the preference browser patch and sends the preference browser patch to the client under the condition that a service request sent by the client with browser attribute information matched with the preference browser patch is received.
In this way, different preference browser patches are sent to the corresponding distribution nodes, so that the distribution nodes can cache the preference browser patches, when a request of a client is received, the browser patches matched with the client can be searched from the local cache, and as more browsers corresponding to the preference browser patches exist in a target area to which the distribution nodes belong, the possibility of searching in the local cache is high, the frequency of requesting the browser patches from a server by the distribution nodes can be greatly reduced, network communication is effectively reduced, and the speed of accessing target services by the client is improved.
When the distributing node cannot find the browser patch matched with the browser attribute information, a browser patch obtaining request can be sent to the server, the server responds to the browser patch obtaining request, generates a new browser patch matched with the target browser attribute information based on the target browser attribute information indicated by the browser patch obtaining request, and sends the new browser patch to the distributing node, so that the distributing node can send the received new browser patch to the client matched with the browser information.
After the preferred browser patches and/or newly added browser patches of each distribution node are sent to the corresponding distribution node, the patches can be sent to the global cache database, when the distribution node performs browser patch inquiry, the local cache and the cloud disk cache can be inquired first, if not found, the global cache database can be inquired again, the global cache database can comprise browser patches corresponding to all distribution nodes, and if not found yet, a browser patch acquisition request can be sent to the server, so that the probability of the server to generate repeated browser patches can be reduced, and computing resources can be saved.
The data distribution method comprises the steps of obtaining browser attribute information of a plurality of clients in target areas corresponding to a plurality of distribution nodes respectively, determining browser distribution conditions in the target areas corresponding to the distribution nodes based on the browser attribute information for each distribution node, determining preference browser patches corresponding to the distribution nodes based on the browser distribution conditions, sending the preference browser patches to the distribution nodes so that the distribution nodes cache the preference browser patches, and sending the preference browser patches to the clients when service requests sent by the clients with the browser attribute information matched with the preference browser patches are received. According to the embodiment of the disclosure, the distribution nodes are deployed to carry out regional distribution on the browser patches, so that the time consumed by the client for acquiring the browser patches can be effectively reduced, the webpage access speed is improved, the browser distribution condition in the target area is determined based on the browser attribute information, and the preference browser patches of the distribution nodes are determined according to the browser distribution condition, so that the distribution nodes preferentially cache the preference browser patches, the probability of requesting patches from the server by the distribution nodes is reduced, the page access speed is improved, the transmission of useless patches can be reduced, and the waste of network resources is avoided.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiments of the present disclosure further provide a data distribution device corresponding to the data distribution method, and since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to that of the data distribution method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 3, a schematic diagram of a data distribution apparatus according to an embodiment of the disclosure is shown, where the apparatus includes:
An obtaining module 310, configured to obtain browser attribute information of a plurality of clients in a target area corresponding to each of the plurality of distribution nodes;
A first determining module 320, configured to determine, for each distribution node, a browser distribution condition in a target area corresponding to the distribution node based on the browser attribute information;
A second determining module 330, configured to determine, based on the browser distribution situation, a preferred browser patch corresponding to the distribution node;
And the sending module 340 is configured to send the preference browser patch to the distribution node, so that the distribution node caches the preference browser patch, and sends the preference browser patch to the client when receiving a service request sent by the client whose browser attribute information matches with the preference browser patch.
According to the data distribution device provided by the embodiment of the disclosure, the distribution nodes are deployed to carry out regional distribution on the browser patches, so that the time consumed by a client for acquiring the browser patches can be effectively reduced, the webpage access speed is improved, the browser distribution situation in a target area is determined based on the browser attribute information, and the preference browser patches of the distribution nodes are determined according to the browser distribution situation, so that the distribution nodes preferentially cache the preference browser patches, the probability of requesting patches from a server by the distribution nodes is reduced, the page access speed is improved, the sending of useless patches can be reduced, and the waste of network resources is avoided.
In an alternative embodiment, the first determining module 320 is specifically configured to:
Based on the browser attribute information, determining version information corresponding to each of the browsers of the plurality of clients in the target area;
and determining the browser distribution condition in the target area based on the number of clients corresponding to each version information in the target area.
In an alternative embodiment, the second determining module 330 is specifically configured to:
Based on the ratio of the number of the browsers corresponding to each version information to the total number of the browsers in the browser subsection situation, selecting a preference browser from the browsers corresponding to each version information;
And determining the browser patches required by the preference browser as preference browser patches corresponding to the distribution nodes.
In an alternative embodiment, the second determining module 330 is further configured to:
Determining a first characteristic supported by the preference browser based on the attribute information of the preference browser;
determining, based on the first characteristic, a second characteristic absent from the preference browser to access the target service;
based on the second characteristic, a browser patch required by the preferred browser is determined.
In an alternative embodiment, the apparatus further comprises a generating module configured to:
Responding to a browser patch acquisition request sent by the distribution node, and generating a newly added browser patch matched with target browser attribute information based on the target browser attribute information indicated by the browser patch acquisition request;
and sending the generated newly-added browser patch to the distribution node, so that the distribution node sends the newly-added browser patch to the client under the condition that the distribution node receives a service request sent by the client of which the browser attribute information is matched with the newly-added browser patch.
In an alternative embodiment, the apparatus further includes a caching module configured to:
And sending the preference browser patches and/or the newly-added browser patches sent to each distribution node to a global cache database, so that the distribution node obtains the target browser patches from the global cache database and sends the target browser patches to the client under the condition that the distribution node receives a service request sent by the client, wherein the browser attribute information of the service request is matched with the target browser patches stored in the global cache database.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Corresponding to the data distribution method in fig. 1, the embodiment of the present disclosure further provides an electronic device 400, as shown in fig. 4, which is a schematic structural diagram of the electronic device 400 provided in the embodiment of the present disclosure, including:
The electronic device comprises a processor 41, a memory 42 and a bus 43, wherein the memory 42 is used for storing execution instructions, and comprises a memory 421 and an external memory 422, the memory 421 is also called an internal memory, and is used for temporarily storing operation data in the processor 41 and data exchanged with the external memory 422 such as a hard disk, the processor 41 exchanges data with the external memory 422 through the memory 421, and when the electronic device 400 operates, the processor 41 and the memory 42 are communicated through the bus 43, so that the processor 41 executes the following instructions:
obtaining browser attribute information of a plurality of clients in a target area corresponding to a plurality of distribution nodes respectively;
Determining the browser distribution condition in a target area corresponding to each distribution node based on the browser attribute information;
Determining a preference browser patch corresponding to the distribution node based on the browser distribution condition;
And sending the preference browser patch to the distribution node, so that the distribution node caches the preference browser patch and sends the preference browser patch to the client under the condition that a service request sent by the client with browser attribute information matched with the preference browser patch is received.
In an alternative embodiment, in the instructions executed by the processor 41, the determining, based on the browser attribute information, a browser distribution condition in a target area corresponding to the distribution node includes:
Based on the browser attribute information, determining version information corresponding to each of the browsers of the plurality of clients in the target area;
and determining the browser distribution condition in the target area based on the number of clients corresponding to each version information in the target area.
In an alternative embodiment, in the instructions executed by the processor 41, the determining, based on the browser distribution situation, a preferred browser patch corresponding to the distribution node includes:
Based on the ratio of the number of the browsers corresponding to each version information to the total number of the browsers in the browser subsection situation, selecting a preference browser from the browsers corresponding to each version information;
And determining the browser patches required by the preference browser as preference browser patches corresponding to the distribution nodes.
In an alternative embodiment, the determining, in the instructions executed by the processor 41, a browser patch required by the preferred browser includes:
Determining a first characteristic supported by the preference browser based on the attribute information of the preference browser;
determining, based on the first characteristic, a second characteristic absent from the preference browser to access the target service;
based on the second characteristic, a browser patch required by the preferred browser is determined.
In an alternative embodiment, the instructions executed by the processor 41 further include:
Responding to a browser patch acquisition request sent by the distribution node, and generating a newly added browser patch matched with target browser attribute information based on the target browser attribute information indicated by the browser patch acquisition request;
and sending the generated newly-added browser patch to the distribution node, so that the distribution node sends the newly-added browser patch to the client under the condition that the distribution node receives a service request sent by the client of which the browser attribute information is matched with the newly-added browser patch.
In an alternative embodiment, the instructions executed by the processor 41 further include:
And sending the preference browser patches and/or the newly-added browser patches sent to each distribution node to a global cache database, so that the distribution node obtains the target browser patches from the global cache database and sends the target browser patches to the client under the condition that the distribution node receives a service request sent by the client, wherein the browser attribute information of the service request is matched with the target browser patches stored in the global cache database.
The disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the data distribution method described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present disclosure further provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to perform the steps of the data distribution method described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein in detail.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
It should be noted that the foregoing embodiments are merely specific implementations of the disclosure, and are not intended to limit the scope of the disclosure, and although the disclosure has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that any modification, variation or substitution of some of the technical features described in the foregoing embodiments may be made or equivalents may be substituted for those within the scope of the disclosure without departing from the spirit and scope of the technical aspects of the embodiments of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.