A page loading method and device
By receiving page loading requests and determining the corresponding template model and resource files, and directly returning or updating the resource location address, the problem of long-term page loading and high service pressure is solved, and faster page loading and more efficient server resource utilization is achieved.
Patent Information
- Application Number
- CN201910232090.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-26
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2039-03-26
AI Technical Summary
In the prior art, page loading takes a long time, resulting in delays and lags in interface rendering, and it is difficult for background services to ensure the availability of services under high concurrency.
By receiving page loading requests, the corresponding template model and resource files are determined based on feature information, and the metadata and resource information are obtained. If the update timestamps of the metadata and resource information are the same, the resource location address is directly returned to avoid resource compilation; if it is different, the template file and template model are compiled, the compiled resources are generated and the resource file is updated.
Reduces page loading time, reduces server consumption, improves front-end engine execution efficiency, and ensures service availability under high concurrency.
Smart Images

Figure CN111753226B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a page loading method and device. Background Art
[0002] With the rapid development of cloud computing technology and commercial application services, more and more companies are beginning to purchase SaaS (Software-as-a-Service) enterprise services. When using SaaS products and services, users need to customize the WEB interface based on the business model, that is, the business interface supports customization and personalization according to user needs during the SaaS service operation period.
[0003] There are currently two main solutions to meet users' personalized needs for business interfaces:
[0004] 1) Parse different business models through the interface dynamic rendering engine;
[0005] 2) Obtain the information required by the front-end interface through the background service, and return it to the front-end after splicing is completed.
[0006] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0007] 1) The first method requires the backend to return the same model, and then the frontend parses the business model through the browser and splices the interface through the engine, which takes a long time and causes interface rendering delays; and the interface is prone to freeze and flicker, affecting the user experience;
[0008] 2) The second method requires generating an interface in the background and then returning it to the front end, which results in high concurrency pressure on the background service, increases network pressure, consumes application server resources, and makes it difficult to ensure service availability under high concurrency conditions. Summary of the invention
[0009] In view of this, an embodiment of the present invention provides a page loading method and device, which can at least solve the problem of long page loading time and high service pressure in the prior art.
[0010] To achieve the above object, according to one aspect of an embodiment of the present invention, a page loading method is provided, comprising:
[0011] Receive a page loading request, and determine a template model and a resource file corresponding to the page loading request according to feature information in the page loading request;
[0012] The metadata in the template model and the resource information in the resource file are obtained. If the timestamps of the latest updates of the metadata and the resource information are the same, the resource location address information of the resource file is read and returned.
[0013] Optionally, the feature information includes at least an identifier of the template model;
[0014] Determining the template model and resource file corresponding to the page loading request according to the characteristic information in the page loading request includes: searching for the template model according to the identifier of the template model in the page loading request; and obtaining the resource file corresponding to the identifier from a CDN node according to the identifier of the template model.
[0015] Optionally, obtaining a resource file corresponding to the identifier of the template model from a CDN node includes: if there are multiple CDN nodes, determining the current amount of requests to be processed by each CDN node, and extracting the CDN node that currently processes the least amount of requests.
[0016] Optionally, obtaining a resource file corresponding to the identifier of the template model from a CDN node also includes: if the resource file cannot be found in the CDN node, obtaining the resource file corresponding to the identifier from a resource container according to the identifier of the template model.
[0017] Optionally, after obtaining the metadata in the template model and the resource information in the resource file, the method further includes:
[0018] If the timestamps of the latest updates of the metadata and the resource information are different, extracting a template file corresponding to the template model according to the identifier of the template model;
[0019] Compiling the template file and the template model to generate compiled resources, and updating the resource file through the compiled resources; and
[0020] Read and return the resource location address information of the resource file after the resource is updated.
[0021] To achieve the above object, according to another aspect of an embodiment of the present invention, a page loading device is provided, comprising:
[0022] A request processing module, used to receive a page loading request transmitted by a client, and determine a template model and a resource file corresponding to the page loading request according to feature information in the page loading request;
[0023] The version comparison module is used to obtain the metadata in the template model and the resource information in the resource file. If the versions of the metadata and the resource information are the same, the resource location address information of the resource file is read and fed back to the client.
[0024] Optionally, the feature information includes at least an identifier of the template model;
[0025] The request processing module is used to: search for the template model according to the identifier of the template model in the page loading request; and obtain a resource file corresponding to the identifier from a CDN node according to the identifier of the template model.
[0026] Optionally, the request processing module is used to: if there are multiple CDN nodes, determine the current amount of requests to be processed by each CDN node, and extract the CDN node that currently processes the least amount of requests.
[0027] Optionally, the request processing module is further configured to: if the resource file cannot be found in the CDN node, obtain the resource file corresponding to the identifier from a resource container according to the identifier of the template model.
[0028] Optionally, the version comparison module is further used to:
[0029] If the timestamps of the latest updates of the metadata and the resource information are different, extracting a template file corresponding to the template model according to the identifier of the template model;
[0030] Compiling the template file and the template model to generate compiled resources, and updating the resource file through the compiled resources; and
[0031] Read and return the resource location address information of the resource file after the resource is updated.
[0032] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for page loading is provided.
[0033] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the page loading methods described above.
[0034] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned page loading methods is implemented.
[0035] According to the solution provided by the present invention, an embodiment of the above invention has the following advantages or beneficial effects: before compiling resources, for template models that have not changed, the published resource location address can be directly returned, thereby eliminating resource compilation time, reducing page loading time, and at the same time reducing server consumption and improving the execution efficiency of the front-end engine.
[0036] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0038] Figure 1 It is a main flow chart of a page loading method according to an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of information recorded by a template model according to an embodiment of the present invention;
[0040] Figure 3 is a schematic diagram of a specific implementation process according to an embodiment of the present invention;
[0041] Figure 4 is a flow chart of an optional page loading method according to an embodiment of the present invention;
[0042] Figure 5 is a schematic diagram of a system applied to PaaS service according to an embodiment of the present invention;
[0043] Figure 6 is a schematic diagram of main modules of a page loading device according to an embodiment of the present invention;
[0044] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0045] Figure 8 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0047] It should be noted that the embodiments of the present invention are mainly applied to computing application environments and do not rely on any other service systems and can be deployed and integrated independently.
[0048] The terms involved in the present invention are explained as follows:
[0049] Business model: Provides a framework structure for the enterprise from a business perspective to ensure that the enterprise's application system is closely matched with the enterprise's frequently improved business processes.
[0050] Rendering engine: obtains the content of the requested document through the network and displays it in the browser window.
[0051] PaaS (Platform-as-a-Service): A business model that provides the operation and development environment of application services as a service.
[0052] Redirect: Redirect various network requests to other locations through various methods.
[0053] See also Figure 1 , which shows a main flow chart of a page loading method provided by an embodiment of the present invention, comprising the following steps:
[0054] S101: receiving a page loading request, and determining a template model and a resource file corresponding to the page loading request according to feature information in the page loading request;
[0055] S102: Obtain metadata in the template model and resource information in the resource file. If the timestamp of the latest update of the metadata and the resource information is the same, read and return resource location address information of the resource file.
[0056] In the above implementation, for step S101, when the WEB interface needs to be customized, the domain SaaS service client can send a page loading request to the SaaS service server.
[0057] After receiving the request, the resource loading service of the SaaS service will analyze the characteristic information in the request, such as the type of browser, industry information, language used, template model identifier, etc.; then, based on these characteristic information, the template query service is called to determine the template model; for example, if the template model identifier in the request is 1 and the language used is Chinese, the Chinese version of template model 1 is determined.
[0058] The number of template models set can be multiple to increase the diversity of page display, for example:
[0059] 1) Different browsers correspond to different template models; for example, IE browser-Template 1, Google Chrome-Template 2, Firefox-Template 3;
[0060] To obtain the browser type, you can use the getBroserInfo method, for example:
[0061]
[0062] 2) Different industries correspond to different template models; for example, medicine - template 4, physics - template 5, chemistry - template 6;
[0063] 3) Different languages correspond to different template models; for example, Chinese-template 7, English-template 8, Japanese-template 9.
[0064] The template model mainly records the user's design information for the interface. For details, see Figure 2 As shown, it mainly includes three aspects:
[0065] 1) Basic information of the template, used to describe the summary information of the template;
[0066] 2) Template layout information, including layout type and space list, which is used to describe the overall layout of the interface and the display style information of the controls;
[0067] 3) Business object management information, which is used to record the relationship between front-end resources and business model data, and can support data interaction during system operation.
[0068] When designing a business interface, it is usually necessary to lay out the interface. For example, the elements used for layout in HTML include DIV, SPAN, Table, etc. Resource files (files from which the required resources can be read) can create and store various styles, which means that each page control has a place to store its own style.
[0069] It should be noted that direct file reading means searching from the hard disk only when the program is running and needs resources. The resource files are actually still on the hard disk, but the resource files have been mapped to the virtual memory. Compared with directly reading the hard disk files, it has the advantage of fast loading speed. Therefore, the present invention mainly uses resource files for resource acquisition. For the specific method of acquiring resource files, please refer to the subsequent Figure 4 The description will not be repeated here.
[0070] For step S102, the template model will be adjusted according to user needs, and the resource file is compiled and generated through the template model and the template file corresponding to the template model. When the template model changes, the resources in the corresponding resource file will usually change accordingly, specifically, the update timestamp or version changes.
[0071] In the prior art, resource files are compiled for each page record request. If the template model does not change, the compilation of resources in the resource file is repetitive and unnecessary. Based on this consideration, the present invention chooses to determine whether the template model has changed before compiling the resource. If there is no change, it proves that resource compilation is not required.
[0072] Whether the template model has changed depends on whether the timestamp of its last update is the same as (or close to, but the difference is very small) the timestamp of the last update of the resource in the corresponding resource file. For the specific process, see Figure 3 As shown:
[0073] 1) The metadata of the template model is stored in the metadata service. The metadata service can be queried through the identifier of the template model, and the corresponding timestamp can be obtained based on its attribute information.
[0074] Among them, metadata, also known as intermediary data or relay data, is data about data, mainly information describing data properties, used to support functions such as indicating storage location, historical data, resource search, and file records.
[0075] 2) Resource files can be stored in resource containers OSS (Object Storage Service), Baidu Cloud and other cloud services. The present invention mainly uses OSS as an example for explanation. The timestamp of the last update of the required resource file can be obtained through the file version (or timestamp) query service.
[0076] 3) Compare the metadata and the resource's last updated timestamp:
[0077] ① If the two timestamps are the same, it means that the template model has not changed since the last compilation, and the controls, styles and other resources in the corresponding resource file have not changed, that is, there is no need to recompile the resources.
[0078] In this case, the page loading request can be redirected directly to the URL (Uniform Resource Identifier) address of the resource file, or the URL address can be considered to be fed back to the client to eliminate resource compilation time, reduce page rendering time, and improve page loading efficiency.
[0079] ②If the timestamps of the two are different, it means that the template model has been changed, but the resources in the resource file have not been recompiled in time. Specifically:
[0080] Step 1: If the timestamps of the latest updates of the metadata and resource information are different, extract the template file corresponding to the template model according to the identifier of the template model;
[0081] Step 2: compile the template file and the template model to generate compiled resources, and update the resource file through the compiled resources; and
[0082] Step 3: Read and return the resource location address information of the resource file after the resource is updated.
[0083] The template compilation module compiles the template files and template models for front-end resources, and automatically packages the compiled resources into the resource files to update and replace the resources in the resource files; then, the URL address of the updated resource file is returned to the client.
[0084] The template file and the template model here can be in a one-to-one relationship, and the two are similar to test papers and answers, and neither is indispensable. The template file can be a document with a series of personalized settings, for example, a TMP template file that meets the Freemark protocol; and the resource file can include TMP, JS, and HTML files.
[0085] It should be noted that the resources compiled here are for front-end resources. By compiling the front-end resources and template models on the server, and generating an interface and sending it to the front-end, there is no need for the front-end to perform operations such as page splicing, and there is no need for the front-end browser to compile the resources.
[0086] The method provided in the above embodiment can directly return the published resource location address for the unchanged template model before compiling the resources, thereby eliminating the resource compilation time, reducing the page loading time, reducing server consumption, and improving the execution efficiency of the front-end engine.
[0087] See also Figure 4 , shows a schematic flow chart of an optional page loading method according to an embodiment of the present invention, comprising the following steps:
[0088] S401: receiving a page loading request, and determining a template model corresponding to the page loading request according to characteristic information in the page loading request; wherein the characteristic information at least includes an identifier of the template model;
[0089] S402: According to the identifier of the template model, obtain a resource file corresponding to the identifier from a CDN node;
[0090] S403: if the resource file cannot be found in the CDN node, acquiring the resource file corresponding to the identifier from a resource container according to the identifier of the template model;
[0091] S404: Obtain the metadata in the template model and the resource information in the resource file. If the timestamps of the latest updates of the metadata and the resource information are the same, read and return the resource location address information of the resource file.
[0092] In the above implementation, steps S401 and S404 can be respectively referred to Figure 1 The description of steps S101 and S102 is not repeated here.
[0093] In the above implementation, for step S402, the resource file is obtained through the compilation result of the template file and the template model, that is, the file actually requested by the client.
[0094] In order to improve the access efficiency of resource files, the present invention chooses to build CDN nodes (Content Delivery Network) on the network and distributes the resource files in OSS to the CDN nodes.
[0095] See also Figure 3 As shown, the compiled resource file is output to OSS, and the file is distributed to the CDN node through the file publishing service in OSS. Therefore, there can be a mapping relationship between the resource file and the CDN node:
[0096] 1) Many-to-one: multiple resource files are stored on the same CDN node;
[0097] 2) One-to-many: Set up multiple CDN nodes that can complete the same task, and the same resource file will be distributed to these CDN nodes simultaneously. When there are many subsequent page requests, you can choose one from multiple CDN nodes with the same function to provide service, thereby increasing service capacity and improving service efficiency.
[0098] For the above method 2), it usually relies on edge servers deployed in various places. The CDN nodes enable users to obtain the required resource files nearby through the load balancing, content distribution, scheduling and other functional modules of the central platform, and reduce network congestion, thereby improving user access response speed and hit rate.
[0099] In addition to the above-mentioned method of OSS distributing files to CDN nodes, CDN nodes can also request resource file modification timestamps from OSS at a certain interval (e.g. 1s) and compare them with existing resource files to determine whether the stored resources have changed. If there are changes, the new files will replace the old files to achieve resource updates.
[0100] In addition, CDN nodes can be set according to region, usage, etc. Taking regional settings as an example, there are North China 1, North China 2, Northwest 1, East China 2, South China 1, etc.
[0101] Different CDN nodes will respond to different regions and different network requests (page loading requests), and the determination of CDN nodes can be achieved through the client HTTP protocol and load balancing technology; load balancing technology distributes the network traffic as evenly as possible to several servers or CDN nodes that can complete the same task for processing, such as the CDN node with the lowest current processing volume, to avoid the unfavorable situation that some CDN nodes are overloaded while others are idle, which can not only improve the overall network traffic, but also improve the overall performance of the network.
[0102] Resource files are still mainly identified and obtained based on the identifier of the template model, for example, template model 1-resource file 1, and resource file 1 stores information such as the style of template model 1 and corresponding controls.
[0103] There are many ways to read resource files, for example:
[0104] 1) System.Resources.ResourceReader reads resource file information;
[0105] 2) Through the getResource method of the class class of this class;
[0106] 3)Test.class.getClassLoader().getResource, where the location of the resource file is relatively fixed.
[0107] In the above manner, whenever a resource file is needed, it can be read from the CDN node first, so as to improve the file reading speed.
[0108] For step S403, the resource files in the CDN node are all transmitted through OSS, so there may be a situation where some resource files have not been updated. In this case, the load balancing will forward the request to the data source of OSS to obtain the resource files from OSS, specifically, through the identification of the template model.
[0109] The method provided in the above embodiment can achieve the effect of obtaining files nearby by obtaining resource files from CDN nodes, while reducing the number of times files are obtained from OSS, and has the function of reducing network congestion and improving file access response speed and hit rate; however, if the resource file cannot be found in the CDN node, it can also be queried in OSS, thereby ensuring the acquisition of the resource file.
[0110] Here combined Figure 2 , supplement the generation of template model:
[0111] The template model can be developed in a certain way through a single-page application (one page can complete all tasks, and jumping to a new page is not allowed); for example, add, delete, modify, and query the historical business model, and then bind the attributes of the business model to the UI elements through itemkey; for example, the text input box itemkey = 'person', the data in the input box corresponds to the person of the business model.
[0112] The development method here can be JS+html, php, jsp, vue, etc. The present invention mainly uses JS+html method. Compared with other methods, JS+html method is not affected by the page frame.
[0113] The business model attributes here may include business data structures, such as: person, name, old, money; UI elements may include: left alignment, right alignment, color, control type, whether it is required to enter, whether it is read-only, etc.
[0114] The template model can be constructed after calling the template saving service. Compared with the prior art, the template model provided by the present invention supports information management of business objects.
[0115] In addition, the template model can also be modified to meet the user's personalized needs for the WEB interface. Specifically,
[0116] The user performs a change operation on the WEB interface in the client, and the client responds to the change operation by sending a corresponding change request to the SaaS service;
[0117] The SaaS service changes the template model according to the change information in the change request, recompiles the generated resources, and updates the resource files; then it feeds back the URL address of the updated resource files to the client;
[0118] The client receives the new URL address and opens the changed interface. The overall process realizes the visualization of the template design interface and the interactive operation at runtime.
[0119] See also Figure 5 , shows a system 500 applied to PaaS services, specifically including: design module, template model, template engine, resource publishing; wherein:
[0120] 1) Design module 501, used to complete the modification operation of the business template model and bind the attributes of the business template model to the interface UI elements;
[0121] 2) Template model 502, calling the template saving service, saving the template designed by the design template, and constructing a template model for recording the user's design information on the interface.
[0122] 3) Template engine 503, used to determine the corresponding template model and resource file for the page loading request transmitted by the client, and compare whether the timestamps of the last update of the two are the same;
[0123] If they are the same, the resource file URL address is fed back to the client;
[0124] If they are not the same, it indicates that the template model has changed, but the resource file has not been updated. The template model and template file need to be compiled to generate compiled resources, and the resources in the resource file are updated; and the URL address of the resource file after the resource is updated is sent to the client.
[0125] 4) Resource publishing 504, distributing resource files in OSS to CDN nodes, so as to facilitate the subsequent extraction of resource files from CDN nodes, improve the efficiency of resource file acquisition, reduce the number of visits to OSS, and reduce network congestion.
[0126] PaaS is a cloud service between IaaS and SaaS models, which provides an environment for the development and operation of applications. IaaS mainly provides infrastructure services such as virtual computing, storage, and databases, SaaS provides users with cloud-based applications, and PaaS provides developers with an environment for building applications. Therefore, the present invention is mainly implemented in a PaaS device to obtain page services from SaaS.
[0127] The present invention provides a set of devices that can parse business models, compile and implement front-end static resources, dynamically publish front-end resources, and support dynamic query of templates. The device can be deployed and integrated independently of the business system as a PaaS service. In addition, the device segments the interface generation cycle, provides a template designer for users to customize the interface online, and saves the structure of the template model while supporting the ability to dynamically compile, refresh, and publish front-end resource files, thereby improving the efficiency of compilation to a certain extent.
[0128] See also Figure 6 , which shows a schematic diagram of main modules of a page loading device 600 provided by an embodiment of the present invention, including:
[0129] The request processing module 601 is used to receive a page loading request and determine a template model and a resource file corresponding to the page loading request according to feature information in the page loading request;
[0130] The version comparison module 602 is used to obtain the metadata in the template model and the resource information in the resource file, and if the timestamps of the latest update of the metadata and the resource information are the same, read and return the resource location address information of the resource file.
[0131] In the implementation device of the present invention, the characteristic information at least includes the identification of the template model;
[0132] The request processing module 601 is used to:
[0133] Searching for the template model according to the identifier of the template model in the page loading request;
[0134] According to the identifier of the template model, a resource file corresponding to the identifier is obtained from a CDN node.
[0135] In the implementation device of the present invention, the request processing module 601 is used to:
[0136] If there are multiple CDN nodes, the current request volume to be processed by each CDN node is determined, and the CDN node that currently processes the least number of requests is extracted.
[0137] In the implementation device of the present invention, the request processing module 601 is also used for:
[0138] If the resource file cannot be found in the CDN node, the resource file corresponding to the identifier is obtained from a resource container according to the identifier of the template model.
[0139] In the implementation device of the present invention, the version comparison module 602 is further used for:
[0140] If the timestamps of the latest updates of the metadata and the resource information are different, extracting a template file corresponding to the template model according to the identifier of the template model;
[0141] Compiling the template file and the template model to generate compiled resources, and updating the resource file through the compiled resources; and
[0142] Read and return the resource location address information of the resource file after the resource is updated.
[0143] In addition, the specific implementation content of the page loading device described in the embodiment of the present invention has been described in detail in the above-mentioned page loading method, so the repeated content will not be described again here.
[0144] Figure 7 An exemplary system architecture 700 is shown to which the page loading method or the page loading apparatus according to the embodiment of the present invention can be applied.
[0145] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705 (just an example). Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0146] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0147] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0148] The server 705 may be a server that provides various services, such as a backend management server (only for example) that supports shopping websites browsed by users using the terminal devices 701, 702, and 703. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only for example) to the terminal device.
[0149] It should be noted that the page loading method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the page loading device is generally disposed in the server 705 .
[0150] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0151] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0152] like Figure 8As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0153] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0154] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0155] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0156] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0157] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a request processing module and a version comparison module block. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the request processing module may also be described as "determining a template model and resource file corresponding to a page loading request".
[0158] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0159] Receive a page loading request, and determine a template model and a resource file corresponding to the page loading request according to feature information in the page loading request;
[0160] The metadata in the template model and the resource information in the resource file are obtained. If the timestamps of the latest updates of the metadata and the resource information are the same, the resource location address information of the resource file is read and returned.
[0161] According to the technical solution of the embodiment of the present invention, before compiling resource files, for template models and resource files that have not changed before the last compilation, the published resource location address can be directly returned, thereby reducing server consumption, improving the execution efficiency of the front-end engine, and reducing page loading time. In addition, the distribution of resource files by CDN nodes can improve the efficiency of obtaining resource files; but if the query cannot be found in the CDN node, it can be queried in the OSS, which ensures the acquisition of resource files.
[0162] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A page loading method, characterized in that: include: Receive a page loading request, and determine a template model and resource file corresponding to the page loading request according to feature information in the page loading request; wherein the template model is used to record user design information of the interface, including basic information and layout information of the template and business object management information, and the business object management information is used to record the association relationship between the front-end resources and the business model data to support data interaction during system operation; The metadata in the template model and the resource information in the resource file are obtained. If the timestamps of the latest updates of the metadata and the resource information are the same, the resource location address information of the resource file is read and returned.
2. The method according to claim 1, characterized in that The characteristic information at least includes an identifier of the template model; The step of determining a template model and a resource file corresponding to the page loading request according to the feature information in the page loading request includes: Searching for the template model according to the identifier of the template model in the page loading request; According to the identifier of the template model, the resource file corresponding to the identifier is obtained from the CDN node.
3. The method according to claim 2, characterized in that The acquiring, according to the identifier of the template model, a resource file corresponding to the identifier from a CDN node includes: If there are multiple CDN nodes, the current request volume to be processed by each CDN node is determined, and the CDN node that currently processes the least number of requests is extracted.
4. The method according to claim 2, characterized in that: The acquiring, according to the identifier of the template model, a resource file corresponding to the identifier from a CDN node also includes: If the resource file cannot be found in the CDN node, the resource file corresponding to the identifier is obtained from a resource container according to the identifier of the template model.
5. The method according to claim 1, characterized in that: After obtaining the metadata in the template model and the resource information in the resource file, the method further includes: If the timestamps of the latest updates of the metadata and the resource information are different, extracting a template file corresponding to the template model according to the identifier of the template model; Compiling the template file and the template model to generate compiled resources, and updating the resource file through the compiled resources; and Read and return the resource location address information of the resource file after the resource is updated.
6. A page loading device, characterized in that: include: A request processing module, used to receive a page loading request, and determine a template model and resource file corresponding to the page loading request according to characteristic information in the page loading request; wherein the template model is used to record the user's design information for the interface, including basic information and layout information of the template and business object management information, and the business object management information is used to record the association relationship between the front-end resources and the business model data to support data interaction during system operation; The version comparison module is used to obtain the metadata in the template model and the resource information in the resource file, and if the timestamps of the latest update of the metadata and the resource information are the same, read and return the resource location address information of the resource file.
7. The device according to claim 6, characterized in that The characteristic information at least includes an identifier of the template model; The request processing module is used to: Searching for the template model according to the identifier of the template model in the page loading request; According to the identifier of the template model, a resource file corresponding to the identifier is obtained from a CDN node.
8. The device according to claim 7, characterized in that The request processing module is used to: If there are multiple CDN nodes, the current request volume to be processed by each CDN node is determined, and the CDN node that currently processes the least number of requests is extracted.
9. The device according to claim 7, characterized in that The request processing module is further used for: If the resource file cannot be found in the CDN node, the resource file corresponding to the identifier is obtained from a resource container according to the identifier of the template model.
10. The device according to claim 6, characterized in that The version comparison module is also used for: If the timestamps of the latest updates of the metadata and the resource information are different, extracting a template file corresponding to the template model according to the identifier of the template model; Compiling the template file and the template model to generate compiled resources, and updating the resource file through the compiled resources; and Read and return the resource location address information of the resource file after the resource is updated.
11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Webpage resource cache control method, device and system
CN102456035A
Page loading method, device and system
CN106294379A
Webpage resource loading method and webpage resource loading apparatus
CN107798023A