CN112434237A - Page loading method and device, electronic equipment and storage medium - Google Patents

Page loading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112434237A
CN112434237A CN202011345671.3A CN202011345671A CN112434237A CN 112434237 A CN112434237 A CN 112434237A CN 202011345671 A CN202011345671 A CN 202011345671A CN 112434237 A CN112434237 A CN 112434237A
Authority
CN
China
Prior art keywords
module
file
determining
server
loading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011345671.3A
Other languages
Chinese (zh)
Inventor
张克明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011345671.3A priority Critical patent/CN112434237A/en
Publication of CN112434237A publication Critical patent/CN112434237A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to data processing and provides a page loading method. The method can obtain a page loading request, determine a webpage module to be loaded according to the page loading request, determine the file capacity of the webpage module to be loaded, determine the module identification of the webpage module to be loaded, detect whether the file capacity is larger than a preset threshold value or not, detect whether a configuration library contains the module identification or not, determine a server containing the module identification as an initial server when the file capacity is larger than the preset threshold value and the configuration library does not contain the module identification, determine the initiating position of the page loading request, determine a target server from the initial server according to the initiating position, load a file corresponding to the module identification in the target server, determine the loading times of the file, and store the file when the loading times is detected to be larger than or equal to the configuration value. The invention improves the loading efficiency and further improves the page display effect. The invention also relates to a blockchain, in which the files can be stored.

Description

Page loading method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a page loading method and apparatus, an electronic device, and a storage medium.
Background
With the increase and diversification of the web page function modules, the file amount corresponding to the function modules and the code amount of each file are increased. However, when a page is loaded, files corresponding to all functional modules in the page are called from the server to load the whole page, and due to the problems of large number of files corresponding to the functional modules, large code amount in the files and the like, the file calling efficiency is low, the page loading efficiency is low, and the page display effect is affected.
Disclosure of Invention
In view of the above, it is desirable to provide a page loading method, a page loading apparatus, an electronic device, and a storage medium, which can improve loading efficiency and further improve page display effect.
In one aspect, the present invention provides a page loading method applied in an electronic device, where the electronic device communicates with a content distribution network, the content distribution network includes a plurality of servers, and the page loading method includes:
acquiring a page loading request, and determining a webpage module to be loaded according to the page loading request;
determining the file capacity of the webpage module to be loaded, and determining the module identification of the webpage module to be loaded;
detecting whether the file capacity is larger than a preset threshold value or not, and detecting whether a configuration library contains the module identification or not;
when the file capacity is larger than the preset threshold value and the configuration library does not contain the module identifier, determining a server containing the module identifier from the content distribution network as an initial server;
determining the initiating position of the page loading request, and determining a target server from the initial server according to the initiating position;
loading a file corresponding to the module identifier in the target server, and determining the loading times of the file;
and when the loading times are detected to be larger than or equal to the configuration value, storing the file.
According to a preferred embodiment of the present invention, the determining, according to the page loading request, a to-be-loaded web page module includes:
analyzing the page loading request to obtain data information carried by the page loading request;
acquiring a first preset label and a second preset label from a label library, wherein the first preset label is used for indicating a webpage, and the second preset label is used for indicating a position;
acquiring information corresponding to the first preset label from the data information as a webpage to be accessed, and acquiring information corresponding to the second preset label from the data information as a position to be accessed;
and acquiring a module corresponding to the webpage to be accessed and the position to be accessed simultaneously from a configuration module library as the webpage module to be loaded.
According to a preferred embodiment of the present invention, the determining, from the content distribution network, a server including the module identifier as an initial server includes:
obtaining a module list of each server in the content distribution network;
detecting whether the module list contains the module identification or not, and determining the module list containing the module identification as a target list;
and determining the server corresponding to the target list as the initial server.
According to a preferred embodiment of the present invention, when the module identifier is included in the configuration library, the method further includes:
acquiring a script corresponding to the module identifier from the configuration library;
and executing the script to respond to the page loading request.
According to a preferred embodiment of the present invention, the determining the initiation location of the page loading request and the determining the target server from the initial server according to the initiation location includes:
acquiring a preset log table and determining the acquisition time of the page loading request;
acquiring a position corresponding to the acquisition time from the preset log table as the initiating position;
acquiring the geographical position of the initial server, and determining the position closest to the initiating position from the geographical position as a target position;
and determining a server corresponding to the target position from the initial server as the target server.
According to a preferred embodiment of the present invention, the loading the file corresponding to the module identifier in the target server includes:
acquiring an idle thread from a preset thread pool, wherein the preset thread pool stores a plurality of threads;
acquiring the request capacity processed by the idle thread from a log table, and acquiring the processing time of the idle thread for processing the request capacity;
dividing the request capacity by the processing time to obtain the processing efficiency of the idle thread;
determining an idle thread with the highest processing efficiency as a target thread, and acquiring information corresponding to the module identifier from the target server as the file;
and calling the target thread to load the file.
According to a preferred embodiment of the present invention, after loading the file corresponding to the module identifier in the target server, the method further includes:
detecting whether the file is loaded successfully;
when the file loading is detected to be successful, acquiring the loading times of the file;
and storing the mapping relation between the module identification and the loading times.
In another aspect, the present invention further provides a page loading apparatus, operating in an electronic device, where the electronic device communicates with a content distribution network, the content distribution network includes a plurality of servers, and the page loading apparatus includes:
the acquisition unit is used for acquiring a page loading request and determining a webpage module to be loaded according to the page loading request;
the determining unit is used for determining the file capacity of the webpage module to be loaded and determining the module identifier of the webpage module to be loaded;
the detection unit is used for detecting whether the file capacity is larger than a preset threshold value or not and detecting whether the module identification is contained in a configuration library or not;
the determining unit is further configured to determine, when the file capacity is greater than the preset threshold and the configuration library does not include the module identifier, a server including the module identifier from the content distribution network as an initial server;
the determining unit is further configured to determine an initiating location of the page loading request, and determine a target server from the initial server according to the initiating location;
the loading unit is used for loading the file corresponding to the module identifier in the target server and determining the loading times of the file;
and the storage unit is used for storing the file when the loading times is detected to be greater than or equal to a configuration value.
In another aspect, the present invention further provides an electronic device, including:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the page loading method.
In another aspect, the present invention further provides a computer-readable storage medium, in which computer-readable instructions are stored, and the computer-readable instructions are executed by a processor in an electronic device to implement the page loading method.
According to the technical scheme, the webpage module to be loaded is determined instead of the whole webpage, a certain efficiency basis can be provided for the subsequent page loading, further, the initial server can be accurately determined from the content distribution network, in addition, the position of the target server is closest to the initiating position, so that the file loading efficiency can be improved, and when the file loading frequency reaches a certain value, the file is stored, so that the file loading efficiency with higher loading frequency can be improved. According to the invention, the webpage module to be loaded is loaded without loading the whole webpage, so that the loading efficiency can be improved, the file is loaded from the target server closest to the initiating position, and the loading efficiency can be improved and the page display effect can be further improved because the position of the target server is closest to the initiating position.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the page loading method of the present invention.
FIG. 1a is a flowchart of an embodiment of determining a module of a web page to be loaded according to the present invention.
FIG. 1b is a flow diagram of one embodiment of the present invention for determining an initial server.
FIG. 1c is a flowchart of another embodiment of a page loading method of the present invention.
FIG. 1d is a flow diagram of one embodiment of the present invention for determining a target server.
FIG. 1e is a flowchart of an embodiment of loading a file according to the invention.
FIG. 2 is a functional block diagram of a preferred embodiment of the page loading apparatus of the present invention.
FIG. 3 is a schematic structural diagram of an electronic device implementing a page loading method according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a page loading method according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The page loading method is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to computer readable instructions set or stored in advance, and the hardware of the electronic devices includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), a smart wearable device, and the like.
The electronic device may include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of a plurality of network electronic devices, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network electronic devices.
The network in which the electronic device is located includes, but is not limited to: the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
The electronic device is in communication with a content distribution network that includes a plurality of servers.
S10, acquiring a page loading request, and determining a webpage module to be loaded according to the page loading request.
In at least one embodiment of the invention, the page load request may be triggered by a user of the electronic device. The data information carried by the page loading request comprises a first preset tag, a second preset tag, a request number and the like.
In at least one embodiment of the present invention, the to-be-loaded web page module refers to a viewing requirement module of the user.
Referring to fig. 1a, fig. 1a is a flowchart of an embodiment of determining a module of a web page to be loaded according to the present invention. In at least one embodiment of the present invention, the determining, by the electronic device, the to-be-loaded web page module according to the page loading request includes:
s100, analyzing the page loading request to obtain data information carried by the page loading request.
The data information comprises a first preset label, a second preset label, a request number and the like.
By analyzing the page loading request, the data information can be quickly acquired.
S101, a first preset label and a second preset label are obtained from a label library, wherein the first preset label is used for indicating a webpage, and the second preset label is used for indicating a position.
Wherein, a plurality of predefined tags are stored in the tag library. For example, the first preset tag may be wangye, and the second preset tag may be address.
S102, acquiring information corresponding to the first preset label from the data information as a webpage to be accessed, and acquiring information corresponding to the second preset label from the data information as a position to be accessed.
The webpage to be accessed refers to a webpage which a user needs to access. Further, the position to be visited refers to a position in the web page to be visited, where the access is required.
S103, acquiring a module corresponding to the webpage to be accessed and the position to be accessed from a configuration module library as the webpage module to be loaded.
And the configuration module library stores a plurality of function modules of a plurality of webpages. Further, the webpage module to be loaded refers to a module that needs to be loaded in the webpage to be accessed.
And the webpage module to be loaded can be accurately determined through the mapping relation between the first preset label and the webpage to be accessed and the mapping relation between the second preset label and the position to be accessed.
In at least one embodiment of the invention, by determining the webpage module to be loaded instead of determining the whole webpage, a certain efficiency basis can be provided for subsequently loading the webpage.
S11, determining the file capacity of the webpage module to be loaded, and determining the module identification of the webpage module to be loaded.
In at least one embodiment of the present invention, the file capacity refers to a capacity of a code corresponding to the to-be-loaded web page module, the module identifier refers to an identifier corresponding to the to-be-loaded web page module, and the module identifier has uniqueness.
In at least one embodiment of the present invention, the determining, by the electronic device, the file capacity of the to-be-loaded web page module, and determining the module identifier of the to-be-loaded web page module includes:
acquiring a third preset label and a fourth preset label from the label library, wherein the third preset label is used for indicating capacity, and the fourth preset label is used for indicating identification;
acquiring information corresponding to the webpage module to be loaded and the third preset label from the configuration module library as the file capacity;
and acquiring information corresponding to the webpage module to be loaded and the fourth preset label from the configuration module library as the module identification.
By pre-storing the capacity and the identification in the configuration module library, the determining efficiency of the file capacity and the module identification can be improved.
S12, detecting whether the file capacity is larger than a preset threshold value, and detecting whether the configuration library contains the module identification.
In at least one embodiment of the present invention, the preset threshold may be set according to a storage size of the electronic device, and the configuration library is located in the electronic device.
In at least one embodiment of the present invention, the electronic device compares the file capacity with the preset threshold, so as to determine whether the file capacity is greater than the preset threshold.
In at least one embodiment of the present invention, the electronic device traverses the configuration library, and can determine whether the module identifier is stored in the configuration library.
And S13, when the file capacity is larger than the preset threshold and the configuration library does not contain the module identifier, determining the server containing the module identifier from the content distribution network as an initial server.
In at least one embodiment of the present invention, the content distribution network is a network formed by a plurality of servers, and the initial server refers to a server in the content distribution network that includes the module identifier.
Referring to FIG. 1b, FIG. 1b is a flow chart of one embodiment of the present invention for determining an initial server. In at least one embodiment of the present invention, the determining, by the electronic device, the server including the module identifier as an initial server from the content distribution network includes:
s130, obtaining a module list of each server in the content distribution network.
Each server corresponds to one module list, and each module list stores a plurality of module identifications contained in the corresponding server.
S131, detecting whether the module list contains the module identification, and determining the module list containing the module identification as a target list.
In this embodiment, the electronic device traverses all identifiers in the module list, compares the traversed identifiers with the module identifiers, determines that the module list includes the module identifiers when the traversed identifiers are the same as the module identifiers, and determines that the module list including the module identifiers is the target list.
S132, determining the server corresponding to the target list as the initial server.
For example: the content distribution network comprises a server a, a server b and a server c, the module identifier is mokuai, the module list acquired by the server a is a module list 1, the module list acquired by the server b is a module list 2, and the module list acquired by the server c is a module list 3, whether the mokuai is included in the module list 1, the module list 2 and the module list 3 is detected respectively, when the mokuai is detected to be included in the module list 2, the module list 2 is determined as a target list, and further, the server b is determined as the initial server by the electronic equipment.
Through the implementation mode, all the servers containing the module identifiers can be accurately determined from the content distribution network, and the integrity of the initial server is improved.
Further, referring to fig. 1c, fig. 1c is a flowchart of another embodiment of the page loading method of the present invention. In this embodiment, the page loading method shown in fig. 1a to 1b is improved, and in at least one embodiment of the present invention, when the configuration library includes the module identifier, the method further includes:
s1300, obtaining the script corresponding to the module identification from the configuration library.
And the configuration library stores module identifications, scripts corresponding to the module identifications and the like. Further, the script is to load a code corresponding to the module identifier.
And the script can be accurately acquired from the configuration library through the module identification.
S1301, the script is operated to respond to the page loading request.
In this embodiment, a manner in which the electronic device runs the script belongs to the prior art, and details thereof are not repeated herein.
In this embodiment, by running the script, the loading of the module corresponding to the module identifier can be implemented, that is: and completing the response of the page loading request.
Through the implementation mode, the corresponding script does not need to be obtained from a third party, so that the loading efficiency of the script can be improved, and the response efficiency of the page loading request is further improved.
S14, determining the initiating position of the page loading request, and determining the target server from the initial server according to the initiating position.
In at least one embodiment of the present invention, the initiating location refers to a location from which the page loading request is issued, and the target server refers to an initial server closest to the initiating location.
Referring to FIG. 1d, FIG. 1d is a flow chart of an embodiment of the invention for determining a target server. In at least one embodiment of the present invention, the determining, by the electronic device, an initiation location of the page loading request, and determining, from the initial server, a target server according to the initiation location includes:
s140, acquiring a preset log table, and determining the acquisition time of the page loading request.
The preset log table stores information related to the requested operation, such as: and storing the mapping relation between the time and the position of the acquisition request in the preset log table. Further, the obtaining time refers to a time for obtaining the page loading request.
And S141, acquiring a position corresponding to the acquisition time from the preset log table as the initiating position.
In this embodiment, the initiating location refers to a location where the page loading request is issued.
S142, obtaining the geographical position of the initial server, and determining the position closest to the initiating position from the geographical positions as a target position.
In this embodiment, the IP address of the initial server is obtained, and further, the electronic device determines a location corresponding to the IP address as the geographic location.
In this embodiment, when there are a plurality of initial servers, there are a plurality of geographic locations, and the electronic device calculates a distance between each geographic location and the initiation location, obtains the distance between each geographic location, and determines the geographic location with the smallest distance as the target location.
In other embodiments, when the initial server is unique and, accordingly, the geographic location is also unique and the electronic device determines the geographic location as the target location.
And S143, determining a server corresponding to the target position from the initial servers as the target server.
Wherein the target server refers to an initial server at the target location.
Through the implementation mode, the target server closest to the initiating position can be determined, and the efficiency of calling and loading the program from the server is improved.
S15, loading the file corresponding to the module identification in the target server, and determining the loading times of the file.
Referring to FIG. 1e, FIG. 1e is a flowchart of an embodiment of loading a file according to the present invention. In at least one embodiment of the present invention, the loading, by the electronic device, the file corresponding to the module identifier in the target server includes:
s150, obtaining an idle thread from a preset thread pool, wherein the preset thread pool stores a plurality of threads.
The idle thread is a thread in an idle state, and a request queue in the idle thread is empty.
S151, acquiring the request capacity processed by the idle thread from a log table, and acquiring the processing time of the idle thread for processing the request capacity.
The request capacity refers to the capacity of requests processed by the idle thread, for example, the request capacity may be 20G; further, the processing time refers to the time taken for the request corresponding to the requested capacity to be processed, and for example, the processing time may be 2S.
S152, dividing the request capacity by the processing time to obtain the processing efficiency of the idle thread.
Wherein, the processing efficiency refers to the efficiency of the idle thread processing request. For example, the processing efficiency may be 10G/S.
S153, determining the idle thread with the highest processing efficiency as a target thread, and acquiring information corresponding to the module identifier from the target server as the file.
By acquiring the file from the target server, the file can be acquired quickly because the target server is closest to the initiating position of the page loading request.
S154, calling the target thread to load the file.
By loading the file stored in the target server, the loading efficiency of the file can be improved because the position of the target server is closest to the initiating position, and in addition, the file is loaded by using the idle thread with the highest processing efficiency, and the loading speed of the file can be improved because the target thread does not need to wait for processing other requests, and the target thread has the highest efficiency among the idle threads.
In at least one embodiment of the present invention, after loading the file corresponding to the module identifier in the target server, the method further includes:
detecting whether the file is loaded successfully;
when the file loading is detected to be successful, acquiring the loading times of the file;
and storing the mapping relation between the module identification and the loading times.
Through the implementation mode, the mapping relation can be recorded when the file is loaded successfully, so that the loading times of the file can be determined subsequently.
Specifically, the detecting whether the file is loaded successfully includes:
detecting whether information is displayed in the webpage module to be loaded;
and when detecting that the information is displayed in the webpage module to be loaded, determining that the file is loaded successfully.
By the implementation method, whether the file is loaded successfully or not can be accurately determined.
In at least one embodiment of the present invention, the determining, by the electronic device, the number of times of loading the file includes:
and determining the mapping number of the mapping relation, and determining the mapping number as the loading times.
By the implementation method, the loading times of the successful loading of the file can be quickly determined.
And S16, when the loading times are detected to be larger than or equal to the configuration value, storing the file.
It is emphasized that the file may also be stored in a node of a blockchain in order to further ensure the privacy and security of the file.
In at least one embodiment of the present invention, the configuration value may be a preset number of times, and a value of the configuration value may be set according to a requirement of the user.
In at least one embodiment of the present invention, when the loading frequency of the file reaches the configuration value, the file is stored, and since the file does not need to be acquired from the content distribution network, the loading efficiency of the file whose loading frequency reaches the configuration value can be improved.
In at least one embodiment of the invention, after storing the file, the method further comprises:
acquiring the request number, and generating prompt information according to the request number;
displaying the prompt information in a preset screen;
and deleting the file when a preset button in the preset screen is triggered.
The preset screen may be a display screen of the electronic device, or a terminal display screen communicating with the electronic device.
Further, the preset button refers to a button for deleting confirmation.
Through the embodiment, whether the file is reserved or not can be determined according to the user requirement.
According to the technical scheme, the webpage module to be loaded is determined instead of the whole webpage, a certain efficiency basis can be provided for the subsequent page loading, further, the initial server can be accurately determined from the content distribution network, in addition, the position of the target server is closest to the initiating position, so that the file loading efficiency can be improved, and when the file loading frequency reaches a certain value, the file is stored, so that the file loading efficiency with higher loading frequency can be improved. According to the invention, the webpage module to be loaded is loaded without loading the whole webpage, so that the loading efficiency can be improved, the file is loaded from the target server closest to the initiating position, and the loading efficiency can be improved and the page display effect can be further improved because the position of the target server is closest to the initiating position.
FIG. 2 is a functional block diagram of the page loading apparatus according to the preferred embodiment of the present invention. The page loading device 11 includes an obtaining unit 110, a determining unit 111, a loading unit 112, a storing unit 113, an executing unit 114, a detecting unit 115, a generating unit 116, a presenting unit 117, and a deleting unit 118. The module/unit referred to herein is a series of computer readable instruction segments that can be accessed by the processor 13 and perform a fixed function and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
The obtaining unit 110 obtains a page loading request, and determines a web page module to be loaded according to the page loading request.
In at least one embodiment of the invention, the page load request may be triggered by a user of the electronic device. The data information carried by the page loading request comprises a first preset tag, a second preset tag, a request number and the like.
In at least one embodiment of the present invention, the to-be-loaded web page module refers to a viewing requirement module of the user.
In at least one embodiment of the present invention, the determining, by the obtaining unit 110 according to the page loading request, that the webpage module to be loaded includes:
analyzing the page loading request to obtain data information carried by the page loading request;
acquiring a first preset label and a second preset label from a label library, wherein the first preset label is used for indicating a webpage, and the second preset label is used for indicating a position;
acquiring information corresponding to the first preset label from the data information as a webpage to be accessed, and acquiring information corresponding to the second preset label from the data information as a position to be accessed;
and acquiring a module corresponding to the webpage to be accessed and the position to be accessed simultaneously from a configuration module library as the webpage module to be loaded.
The configuration module library is used for storing a plurality of function modules of a plurality of webpages, wherein a plurality of predefined tags are stored in the tag library, and further, a plurality of function modules of a plurality of webpages are stored in the configuration module library.
And the webpage module to be loaded can be accurately determined through the mapping relation between the first preset label and the webpage to be accessed and the mapping relation between the second preset label and the position to be accessed.
In at least one embodiment of the invention, by determining the webpage module to be loaded instead of determining the whole webpage, a certain efficiency basis can be provided for subsequently loading the webpage.
The determining unit 111 determines the file capacity of the webpage module to be loaded, and determines the module identifier of the webpage module to be loaded.
In at least one embodiment of the present invention, the file capacity refers to a capacity of a code corresponding to the to-be-loaded web page module, the module identifier refers to an identifier corresponding to the to-be-loaded web page module, and the module identifier has uniqueness.
In at least one embodiment of the present invention, the determining unit 111 determines the file capacity of the to-be-loaded web page module, and determining the module identifier of the to-be-loaded web page module includes:
acquiring a third preset label and a fourth preset label from the label library, wherein the third preset label is used for indicating capacity, and the fourth preset label is used for indicating identification;
acquiring information corresponding to the webpage module to be loaded and the third preset label from the configuration module library as the file capacity;
and acquiring information corresponding to the webpage module to be loaded and the fourth preset label from the configuration module library as the module identification.
By pre-storing the capacity and the identification in the configuration module library, the determining efficiency of the file capacity and the module identification can be improved.
The detecting unit 115 detects whether the file capacity is greater than a preset threshold, and detects whether the configuration library includes the module identifier.
In at least one embodiment of the present invention, the preset threshold may be set according to a storage size of the electronic device, and the configuration library is located in the electronic device.
In at least one embodiment of the present invention, the detecting unit 115 compares the file capacity with the preset threshold, and can determine whether the file capacity is greater than the preset threshold.
In at least one embodiment of the present invention, the detecting unit 115 traverses the configuration library and can determine whether the module identifier is stored in the configuration library.
When the file capacity is greater than the preset threshold and the configuration library does not include the module identifier, the determining unit 111 determines, from the content distribution network, a server including the module identifier as an initial server.
In at least one embodiment of the present invention, the content distribution network is a network formed by a plurality of servers, and the initial server refers to a server in the content distribution network that includes the module identifier.
In at least one embodiment of the present invention, the determining unit 111 determines, from the content distribution network, a server including the module identifier as an initial server, including:
obtaining a module list of each server in the content distribution network;
detecting whether the module list contains the module identification or not, and determining the module list containing the module identification as a target list;
and determining the server corresponding to the target list as the initial server.
Through the implementation mode, all the servers containing the module identifiers can be accurately determined from the content distribution network, and the integrity of the initial server is improved.
In at least one embodiment of the present invention, when the configuration library includes the module identifier, the obtaining unit 110 obtains a script corresponding to the module identifier from the configuration library;
the execution unit 114 executes the script in response to the page load request.
Through the implementation mode, the corresponding script does not need to be obtained from a third party, so that the loading efficiency of the script can be improved, and the response efficiency of the page loading request is further improved.
The determining unit 111 determines an initiating location of the page loading request, and determines a target server from the initial server according to the initiating location.
In at least one embodiment of the present invention, the initiating location refers to a location from which the page loading request is issued, and the target server refers to an initial server closest to the initiating location.
In at least one embodiment of the present invention, the determining unit 111 determines an initiating location of the page loading request, and determining a target server from the initial server according to the initiating location includes:
acquiring a preset log table and determining the acquisition time of the page loading request;
acquiring a position corresponding to the acquisition time from the preset log table as the initiating position;
acquiring the geographical position of the initial server, and determining the position closest to the initiating position from the geographical position as a target position;
and determining a server corresponding to the target position from the initial server as the target server.
Through the implementation mode, the target server closest to the initiating position can be determined, and the efficiency of calling and loading the program from the server is improved.
The loading unit 112 loads a file corresponding to the module identifier in the target server, and determines the loading times of the file.
In at least one embodiment of the present invention, the loading unit 112 loads the file corresponding to the module identifier in the target server, including:
acquiring an idle thread from a preset thread pool, wherein the preset thread pool stores a plurality of threads;
acquiring the request capacity processed by the idle thread from a log table, and acquiring the processing time of the idle thread for processing the request capacity;
dividing the request capacity by the processing time to obtain the processing efficiency of the idle thread;
determining an idle thread with the highest processing efficiency as a target thread, and acquiring information corresponding to the module identifier from the target server as the file;
and calling the target thread to load the file.
By loading the file stored in the target server, the loading efficiency of the file can be improved because the position of the target server is closest to the initiating position, and in addition, the file is loaded by using the idle thread with the highest processing efficiency, and the loading speed of the file can be improved because the target thread does not need to wait for processing other requests, and the target thread has the highest efficiency among the idle threads.
In at least one embodiment of the present invention, after loading the file corresponding to the module identifier in the target server, the detecting unit 115 detects whether the file is loaded successfully;
when it is detected that the file is successfully loaded, the obtaining unit 110 obtains the number of times of loading the file;
the storage unit 113 stores a mapping relationship between the module identifier and the number of loads.
Through the implementation mode, the mapping relation can be recorded when the file is loaded successfully, so that the loading times of the file can be determined subsequently.
In at least one embodiment of the present invention, the loading unit 112 determines the number of times of loading the file includes:
and determining the mapping number of the mapping relation, and determining the mapping number as the loading times.
By the implementation method, the loading times of the successful loading of the file can be quickly determined.
When it is detected that the number of loads is greater than or equal to a configuration value, the storage unit 113 stores the file.
It is emphasized that the file may also be stored in a node of a blockchain in order to further ensure the privacy and security of the file.
In at least one embodiment of the present invention, the configuration value may be a preset number of times, and a value of the configuration value may be set according to a requirement of the user.
In at least one embodiment of the present invention, when the loading frequency of the file reaches the configuration value, the file is stored, and since the file does not need to be acquired from the content distribution network, the loading efficiency of the file whose loading frequency reaches the configuration value can be improved.
In at least one embodiment of the present invention, after storing the file, the generating unit 116 obtains the request number, and generates a prompt message according to the request number;
the presentation unit 117 presents the prompt information in a preset screen;
when a preset button in the preset screen is triggered, the deletion unit 118 deletes the file.
The preset screen may be a display screen of the electronic device, or a terminal display screen communicating with the electronic device.
Further, the preset button refers to a button for deleting confirmation.
Through the embodiment, whether the file is reserved or not can be determined according to the user requirement.
According to the technical scheme, the webpage module to be loaded is determined instead of the whole webpage, a certain efficiency basis can be provided for the subsequent page loading, further, the initial server can be accurately determined from the content distribution network, in addition, the position of the target server is closest to the initiating position, so that the file loading efficiency can be improved, and when the file loading frequency reaches a certain value, the file is stored, so that the file loading efficiency with higher loading frequency can be improved. According to the invention, the webpage module to be loaded is loaded without loading the whole webpage, so that the loading efficiency can be improved, the file is loaded from the target server closest to the initiating position, and the loading efficiency can be improved and the page display effect can be further improved because the position of the target server is closest to the initiating position.
Fig. 3 is a schematic structural diagram of an electronic device implementing a page loading method according to a preferred embodiment of the present invention.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions, such as a page loader, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 executes an operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the various page loading method embodiments described above, such as the steps shown in fig. 1.
Illustratively, the computer readable instructions may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing specific functions, which are used for describing the execution process of the computer readable instructions in the electronic device 1. For example, the computer readable instructions may be divided into an acquisition unit 110, a determination unit 111, a loading unit 112, a storage unit 113, an execution unit 114, a detection unit 115, a generation unit 116, a presentation unit 117, and a deletion unit 118.
The memory 12 may be used for storing the computer readable instructions and/or modules, and the processor 13 implements various functions of the electronic device 1 by executing or executing the computer readable instructions and/or modules stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. The memory 12 may include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other memory.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by hardware that is configured to be instructed by computer readable instructions, which may be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer readable instructions comprise computer readable instruction code which may be in source code form, object code form, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying said computer readable instruction code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM).
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In conjunction with fig. 1, the memory 12 in the electronic device 1 stores computer-readable instructions to implement a page loading method, and the processor 13 can execute the computer-readable instructions to implement:
acquiring a page loading request, and determining a webpage module to be loaded according to the page loading request;
determining the file capacity of the webpage module to be loaded, and determining the module identification of the webpage module to be loaded;
detecting whether the file capacity is larger than a preset threshold value or not, and detecting whether a configuration library contains the module identification or not;
when the file capacity is larger than the preset threshold value and the configuration library does not contain the module identifier, determining a server containing the module identifier from the content distribution network as an initial server;
determining the initiating position of the page loading request, and determining a target server from the initial server according to the initiating position;
loading a file corresponding to the module identifier in the target server, and determining the loading times of the file;
and when the loading times are detected to be larger than or equal to the configuration value, storing the file.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer readable instructions, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions when executed by the processor 13 are further configured to implement the steps of:
acquiring a page loading request, and determining a webpage module to be loaded according to the page loading request;
determining the file capacity of the webpage module to be loaded, and determining the module identification of the webpage module to be loaded;
detecting whether the file capacity is larger than a preset threshold value or not, and detecting whether a configuration library contains the module identification or not;
when the file capacity is larger than the preset threshold value and the configuration library does not contain the module identifier, determining a server containing the module identifier from the content distribution network as an initial server;
determining the initiating position of the page loading request, and determining a target server from the initial server according to the initiating position;
loading a file corresponding to the module identifier in the target server, and determining the loading times of the file;
and when the loading times are detected to be larger than or equal to the configuration value, storing the file.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the present invention may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A page loading method is applied to an electronic device, the electronic device is communicated with a content distribution network, the content distribution network comprises a plurality of servers, and the page loading method is characterized by comprising the following steps:
acquiring a page loading request, and determining a webpage module to be loaded according to the page loading request;
determining the file capacity of the webpage module to be loaded, and determining the module identification of the webpage module to be loaded;
detecting whether the file capacity is larger than a preset threshold value or not, and detecting whether a configuration library contains the module identification or not;
when the file capacity is larger than the preset threshold value and the configuration library does not contain the module identifier, determining a server containing the module identifier from the content distribution network as an initial server;
determining the initiating position of the page loading request, and determining a target server from the initial server according to the initiating position;
loading a file corresponding to the module identifier in the target server, and determining the loading times of the file;
and when the loading times are detected to be larger than or equal to the configuration value, storing the file.
2. The page loading method according to claim 1, wherein the determining the webpage module to be loaded according to the page loading request comprises:
analyzing the page loading request to obtain data information carried by the page loading request;
acquiring a first preset label and a second preset label from a label library, wherein the first preset label is used for indicating a webpage, and the second preset label is used for indicating a position;
acquiring information corresponding to the first preset label from the data information as a webpage to be accessed, and acquiring information corresponding to the second preset label from the data information as a position to be accessed;
and acquiring a module corresponding to the webpage to be accessed and the position to be accessed simultaneously from a configuration module library as the webpage module to be loaded.
3. The page loading method of claim 1, wherein said determining a server containing said module identification from said content delivery network as an initial server comprises:
obtaining a module list of each server in the content distribution network;
detecting whether the module list contains the module identification or not, and determining the module list containing the module identification as a target list;
and determining the server corresponding to the target list as the initial server.
4. The page loading method of claim 1, wherein when the module identification is included in the configuration library, the method further comprises:
acquiring a script corresponding to the module identifier from the configuration library;
and executing the script to respond to the page loading request.
5. The page loading method according to claim 1, wherein said determining an originating location of said page loading request and determining a target server from said originating server according to said originating location comprises:
acquiring a preset log table and determining the acquisition time of the page loading request;
acquiring a position corresponding to the acquisition time from the preset log table as the initiating position;
acquiring the geographical position of the initial server, and determining the position closest to the initiating position from the geographical position as a target position;
and determining a server corresponding to the target position from the initial server as the target server.
6. The page loading method according to claim 1, wherein said loading the file corresponding to said module id in said target server comprises:
acquiring an idle thread from a preset thread pool, wherein the preset thread pool stores a plurality of threads;
acquiring the request capacity processed by the idle thread from a log table, and acquiring the processing time of the idle thread for processing the request capacity;
dividing the request capacity by the processing time to obtain the processing efficiency of the idle thread;
determining an idle thread with the highest processing efficiency as a target thread, and acquiring information corresponding to the module identifier from the target server as the file;
and calling the target thread to load the file.
7. The page loading method of claim 1, wherein after loading the file in the target server corresponding to the module identification, the method further comprises:
detecting whether the file is loaded successfully;
when the file loading is detected to be successful, acquiring the loading times of the file;
and storing the mapping relation between the module identification and the loading times.
8. A page loading apparatus, operating in an electronic device, the electronic device communicating with a content distribution network, the content distribution network including a plurality of servers, the page loading apparatus comprising:
the acquisition unit is used for acquiring a page loading request and determining a webpage module to be loaded according to the page loading request;
the determining unit is used for determining the file capacity of the webpage module to be loaded and determining the module identifier of the webpage module to be loaded;
the detection unit is used for detecting whether the file capacity is larger than a preset threshold value or not and detecting whether the module identification is contained in a configuration library or not;
the determining unit is further configured to determine, when the file capacity is greater than the preset threshold and the configuration library does not include the module identifier, a server including the module identifier from the content distribution network as an initial server;
the determining unit is further configured to determine an initiating location of the page loading request, and determine a target server from the initial server according to the initiating location;
the loading unit is used for loading the file corresponding to the module identifier in the target server and determining the loading times of the file;
and the storage unit is used for storing the file when the loading times is detected to be greater than or equal to a configuration value.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the page loading method of any of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium stores therein computer-readable instructions which are executed by a processor in an electronic device to implement the page loading method according to any one of claims 1 to 7.
CN202011345671.3A 2020-11-25 2020-11-25 Page loading method and device, electronic equipment and storage medium Pending CN112434237A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011345671.3A CN112434237A (en) 2020-11-25 2020-11-25 Page loading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011345671.3A CN112434237A (en) 2020-11-25 2020-11-25 Page loading method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112434237A true CN112434237A (en) 2021-03-02

Family

ID=74697806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011345671.3A Pending CN112434237A (en) 2020-11-25 2020-11-25 Page loading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112434237A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174691A (en) * 2022-06-22 2022-10-11 平安普惠企业管理有限公司 Big data loading method, device, equipment and medium based on page request

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120079361A1 (en) * 2010-09-27 2012-03-29 International Business Machines Corporation System, method, and program for generating web page
CN104424239A (en) * 2013-08-27 2015-03-18 北大方正集团有限公司 Resource file loading method and device
CN104573025A (en) * 2015-01-12 2015-04-29 北京京东尚科信息技术有限公司 Method and system for increasing page loading rate
CN105701113A (en) * 2014-11-27 2016-06-22 国际商业机器公司 Method and device for optimizing webpage pre-loading
CN110334297A (en) * 2018-03-08 2019-10-15 腾讯科技(深圳)有限公司 Loading method, terminal, server and the storage medium of terminal page
CN110765379A (en) * 2019-09-20 2020-02-07 苏州达家迎信息技术有限公司 Method and device for loading resource file, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120079361A1 (en) * 2010-09-27 2012-03-29 International Business Machines Corporation System, method, and program for generating web page
CN104424239A (en) * 2013-08-27 2015-03-18 北大方正集团有限公司 Resource file loading method and device
CN105701113A (en) * 2014-11-27 2016-06-22 国际商业机器公司 Method and device for optimizing webpage pre-loading
CN104573025A (en) * 2015-01-12 2015-04-29 北京京东尚科信息技术有限公司 Method and system for increasing page loading rate
CN110334297A (en) * 2018-03-08 2019-10-15 腾讯科技(深圳)有限公司 Loading method, terminal, server and the storage medium of terminal page
CN110765379A (en) * 2019-09-20 2020-02-07 苏州达家迎信息技术有限公司 Method and device for loading resource file, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174691A (en) * 2022-06-22 2022-10-11 平安普惠企业管理有限公司 Big data loading method, device, equipment and medium based on page request
CN115174691B (en) * 2022-06-22 2023-09-05 山西数字政府建设运营有限公司 Big data loading method, device, equipment and medium based on page request

Similar Documents

Publication Publication Date Title
CN110084486B (en) Resource management method and device
CN113050900B (en) Screen sharing method, device, equipment and storage medium
KR102242219B1 (en) Method and device for preventing the server from being attacked
CN112632163B (en) Big data report export method and related equipment
CN111797351A (en) Page data management method and device, electronic equipment and medium
CN112860737B (en) Data query method and device, electronic equipment and readable storage medium
CN112416583A (en) High-frequency request processing method and device, electronic equipment and storage medium
CN112948418A (en) Dynamic query method, device, equipment and storage medium
CN112433705A (en) Script generation method and device, electronic equipment and storage medium
CN112711398A (en) Method, device and equipment for generating buried point file and storage medium
CN112363935A (en) Data joint debugging method and device, electronic equipment and storage medium
CN114372060A (en) Data storage method, device, equipment and storage medium
CN112134968A (en) Domain name access method and device, electronic equipment and storage medium
CN112434237A (en) Page loading method and device, electronic equipment and storage medium
CN112527280A (en) Interface display method and device, server and readable storage medium
CN112819305A (en) Service index analysis method, device, equipment and storage medium
CN112434062A (en) Quasi-real-time data processing method, device, server and storage medium
CN116360769A (en) Code generation method, device, equipment and storage medium
CN112817742B (en) Data migration method, device, equipment and storage medium
CN111857883B (en) Page data checking method and device, electronic equipment and storage medium
CN112632098A (en) Dynamic generation method of structured query statement and related equipment
CN112395319A (en) Cache sharing method, device, server and storage medium
CN114003784A (en) Request recording method, device, equipment and storage medium
CN112685253A (en) Front-end error log collection method, device, equipment and storage medium
CN112926293B (en) Method, device and equipment for switching form items and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
AD01 Patent right deemed abandoned

Effective date of abandoning: 20240510

AD01 Patent right deemed abandoned