Page rendering method, device, storage medium and program product
By querying the cache database in the page request and generating component data, the problem of low cache hit rate is solved, and the page loading speed is improved.
Patent Information
- Application Number
- CN202510830232.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-06-20
AI Technical Summary
In the prior art, when page caching is performed by combining reverse proxy and content distribution network, the cache hit rate is low, resulting in slow page loading speed.
After receiving the page request, first query the component data of the component to be updated from the cache database. If it exists, it will be sent directly. If it does not exist, it will be generated and sent, which will avoid repeated rendering of the entire page and improve the cache hit rate.
Through component-level caching and data generation, the cache hit rate is improved and the page loading speed is improved.
Smart Images

Figure CN120354025B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a page rendering method, device, storage medium, and program product. Background Art
[0002] With the continuous evolution of internet technology and increasing user experience requirements, the performance and interactive experience of web applications have become key indicators of their quality. First-page loading speed, smooth page interaction, and personalized content presentation all directly impact user satisfaction and loyalty with web applications.
[0003] Currently, for page rendering, entire pages and complete resources are cached through a combination of reverse proxies and content delivery networks, resulting in low cache hit rates and, in turn, slower page load times. Summary of the Invention
[0004] The present application provides a page rendering method, device, storage medium and program product to at least solve the problems of low cache hit rate and slow page loading speed in related technologies.
[0005] In a first aspect, the present application provides a page rendering method, the method comprising:
[0006] Receive a page request sent by a user through a client; the page includes multiple components; the page request includes user information;
[0007] If it is determined that the page request type corresponding to the page request is page rendering, obtaining component identification information of the component to be updated from the page request, and determining whether component data of the component to be updated is included in a first preset database based on the component identification information; the first preset database includes a plurality of cached component data;
[0008] If it is determined that the component data of the component to be updated is included in the first preset database, the component data of the component to be updated is sent to the client;
[0009] If it is determined that the component data of the component to be updated is not included in the first preset database, the component data of the component to be updated is generated based on the component identification information and user information of the component to be updated, and the component data of the component to be updated is encapsulated into a target response, and the target response is sent to the client.
[0010] In a second aspect, the present application further provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the page rendering method provided in the first aspect above when executing the computer program.
[0011] In a third aspect, the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the page rendering method provided in the first aspect are implemented.
[0012] In a fourth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the page rendering method provided in the first aspect above.
[0013] Through the page rendering method, device, storage medium and program product provided by the present application, since each page is composed of multiple components, when a page request sent by a user through a client is received, the page request is read. If it is determined that the page request type corresponding to the page request is page rendering, the component identification information of the component to be updated is obtained from the page request. According to the component identification information of the component to be updated, a search is performed from a first preset database that caches multiple component data to determine whether the first preset database includes the component data of the component to be updated corresponding to the component identification information to be updated. If the first preset database includes the component data of the component to be updated, the component data of the component to be updated is directly updated. The component data is sent to the client. If the first preset database does not include the component data of the component to be updated, the component data of the component to be updated is generated according to the component identification information and user information of the component to be updated, and the component data of the component to be updated is encapsulated as a target response, and the target response is sent to the client, thereby avoiding the need to re-render the entire page after receiving the page rendering request. Instead, a component-level cache is set. For pages that only need to render at least one component, the cached component data is directly obtained from the first preset database, or the corresponding component data is regenerated, thereby avoiding repeated rendering, improving the cache hit rate, and thus improving the page loading speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0015] Figure 1 An application scenario diagram of the page rendering method provided in an embodiment of the present application;
[0016] Figure 2 A schematic diagram of a flow chart of a page rendering method provided in one embodiment of the present application;
[0017] Figure 3 A flowchart of a page rendering method provided in another embodiment of the present application;
[0018] Figure 4 A schematic diagram of the structure of a page rendering device provided in one embodiment of the present application;
[0019] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0021] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0022] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0023] In addition, this application involves conducting big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and using artificial intelligence technology to make automated decisions, and making technical solutions that have a significant impact on personal rights and interests based on the results of automated decisions. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decisions; if the user chooses to reject, the expert decision-making process will be entered.
[0024] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0025] With the continuous evolution of internet applications, users' demands for web page loading speeds, interactive responsiveness, and personalized experiences are increasing. To improve page performance and user experience, page rendering optimization currently relies primarily on caching entire pages and complete resources through a combination of reverse proxies and content distribution networks. However, as business grows and user interactions progress, some data on a page may be frequently updated. Therefore, when any part of the page content changes, the entire cached page may become invalid, requiring the page data to be regenerated, resulting in a low cache hit rate and, in turn, slower page loading speeds.
[0026] Therefore, when facing the above technical problems, the component data corresponding to the component is cached. After receiving the page request, it is first determined whether the component data of the component to be updated exists in the cache. If not, new component data of the component to be updated is generated, thereby avoiding a low hit rate for the page cache data. Specifically, after receiving a page request sent by the user through the client, if the page request type corresponding to the page request is page rendering, the first preset database that caches multiple component data is first queried to see whether the component data of the component to be updated included in the page request exists. If the component data of the component to be updated exists in the first preset database, the component data of the component to be updated is directly obtained from the first preset database and returned to the client. If the component data of the component to be updated does not exist in the first preset database, the component data of the component to be updated is generated according to the identification information of the component to be updated and the user information, and the component data of the component to be updated is encapsulated as a target response, and the target response is sent to the client. Compared with only caching the entire page data, caching the component data of highly reused components can improve the cache hit rate, and if there is no component data of the component to be updated in the cache, the component data of the component to be updated is generated, which can improve the page loading speed.
[0027] Figure 1 This is an application scenario diagram of the page rendering method provided in the embodiment of this application. Figure 1As shown, the application scenario provided by this embodiment includes: a server 10 and a client 20. The page rendering method is applied to the server 10. The user can trigger a page request on the operation interface provided by the client 20 and send it to the server 10. After receiving the page request sent by the client 20, the server 10 determines the page request type corresponding to the page request. The page request includes user information. If the server 10 determines that the page request type corresponding to the page request is page rendering, it obtains the component identification information of the component to be updated from the page request, and determines whether the first preset database including multiple cached component data includes the component data of the component to be updated. If the first preset database includes the component data of the component to be updated, the component data of the component to be updated is directly obtained from the first preset database and sent to the client 20. If the first preset database does not include the component data of the component to be updated, the server generates the component data of the component to be updated based on the component identification information and user information of the component to be updated, encapsulates the component data of the component to be updated into a target response, and sends the target response to the client 20.
[0028] Figure 2 A flow chart of a page rendering method provided in an embodiment of the present application is shown as follows: Figure 2 The page rendering method provided in this embodiment is applied to a server. The page rendering method provided in this embodiment specifically includes the following steps:
[0029] S201: Receive a page request sent by a user through a client.
[0030] The server includes a request access device, a routing controller device, a cache manager device, an intelligent prefetcher device, a prefetch engine device, an intelligent enhancer device, a rendering assembler device, and a process service device.
[0031] It is understandable that by adding a layer of middleware content processing (MCP) server in the client and backend architecture, it is agreed to accept and schedule all page rendering and data requests.
[0032] Specifically, the request access device is responsible for intercepting and authenticating all Hypertext Transfer Protocol (HTTP) / Hypertext Transfer Protocol Secure (HTTPS) requests initiated by the browser, parsing user information, and passing page requests and context information to subsequent devices. The routing controller device is responsible for obtaining preset routing information from the process service device and, based on the user information and preset routing information, determining the page request type, making functional decisions, and generating and sending instructions. The cache manager device is responsible for managing multiple levels of cache, such as component-level cache, in-memory cache, and distributed server network edge cache; performing cache queries according to instructions from the routing controller device, and is responsible for reading, writing, and synchronizing cached data. The rendering assembler device is responsible for acquiring data, rendering components, and assembling the results into the final output according to the preset process orchestration. The process service device is responsible for process definition, orchestration, storage, and providing routing and process query services to other devices. The intelligent prefetcher device is responsible for predicting the user's likely next action based on user context and historical behavior and triggering prefetch tasks. The prefetch engine device is used to asynchronously and concurrently execute prefetch tasks in the background, load resources in advance and cache them. The intelligent enhancer device is used to use artificial intelligence models to inject personalized or enhanced elements into page content.
[0033] Among them, the intelligent enhancer device supports plug-in expansion and hot plugging.
[0034] The process service includes process definition and management, supporting static analysis of backend code to generate business processes. Operations personnel can also create or edit custom processes, graphically displaying the complete steps from "request access" to "page rendering and return," helping operations and development teams quickly understand tasks, module calls, and data flows at each stage. This flow chart, defined in a standardized business process model and notation (or a custom process domain-specific language), is directly parsed by the process engine and converted into an "execution graph," driving the rendering assembler to execute tasks sequentially or in parallel.
[0035] It is understandable that operation and maintenance personnel are also users, but their user role is operation and maintenance personnel.
[0036] Authentication refers to the process of verifying whether a user, device, or system has a legitimate identity and corresponding permissions. Its core purpose is to confirm whether the visitor is a legitimate subject and determine the scope of resources and operating permissions that the visitor can access.
[0037] Furthermore, the request access device, routing controller device, and cache manager device are deployed at the edge nodes of the distributed server network (Content Delivery Network, CDN) to reduce network latency and improve response speed. The intelligent prefetcher device, prefetch engine device, intelligent enhancer device, rendering assembler device, and process service device are deployed in the central computer room.
[0038] The page includes multiple components, and the page request includes user information.
[0039] Optionally, the user request is an HTTP or HTTPS request, which may be a page opening request or a page partial update request, etc., which is not limited in this embodiment.
[0040] Among them, the page partial update request is an AJAX request.
[0041] Asynchronous JavaScript and XML (AJAX) is an asynchronous communication technology that allows web pages to send requests to the server and update part of the content through JavaScript without refreshing the entire page.
[0042] Specifically, in this embodiment, the user sends a page request to the server through the operation page corresponding to the client. The domain name system sends the page request to the edge node of the nearest distributed server network (Content Delivery Network, CDN) based on the user's geographic location, and the edge node receives the page request.
[0043] Optionally, the user information may include user identification information, user device information, and user geographic location, etc., which are not limited in this embodiment.
[0044] It is understandable that the Domain Name System (DNS) is one of the core infrastructures of the Internet. It is used to convert human-readable domain names into computer-recognizable IP addresses. It is a distributed, layered system whose core components and functions are scattered across multiple servers and network nodes.
[0045] S202: If it is determined that the page request type corresponding to the page request is page rendering, component identification information of the component to be updated is obtained from the page request, and based on the component identification information, it is determined whether component data of the component to be updated is included in the first preset database.
[0046] The first preset database includes a plurality of cached component data.
[0047] Optionally, the first preset database may be a remote dictionary server (Remote Dictionary Server, Redis) database, etc., which is not limited in this embodiment.
[0048] Optionally, the first preset database may be located in a local memory, or in an edge node memory, or in a central computer room, etc., which is not limited in this embodiment.
[0049] Among them, the remote dictionary server database is an open source, memory-based, high-performance key-value pair storage database that supports multiple data structures and has persistence, high availability and distribution features.
[0050] The component identification information is information that uniquely identifies the component.
[0051] The components to be updated are components that need to be updated or replaced during page rendering.
[0052] It can be understood that the first preset database stores component data of multiple components in the form of key-value pairs, wherein the key of the key-value pair may be component identification information, and the value of the corresponding key-value pair may be component data.
[0053] Specifically, in this embodiment, if the routing controller device in the server determines that the page request type of the page request is page rendering, it sends an instruction to the cache manager device in the server, where the instruction includes the page request. The cache manager device obtains the component identification information of the component to be updated from the page request, and uses the component identification information of the component to be updated as a key to query.
[0054] S203: If it is determined that the component data of the component to be updated is included in the first preset database, the component data of the component to be updated is sent to the client.
[0055] Specifically, in this embodiment, if the cache manager device in the server determines that there is a key-value pair corresponding to the component identification information in the first preset database, it obtains the component data corresponding to the component identification information, encapsulates the component data of the component to be updated into a target response, and sends it to the client.
[0056] S204: If it is determined that the component data of the component to be updated is not included in the first preset database, the component data of the component to be updated is generated based on the component identification information and user information of the component to be updated, and the component data of the component to be updated is encapsulated into a target response, and the target response is sent to the client.
[0057] The target response is a response that includes component data for the component to be updated, and may be an HTTP response. An HTTP response is a message returned by a server to a client after receiving an HTTP request from the client. It informs the client of the request processing result and provides relevant data.
[0058] Specifically, in this embodiment, if the cache manager device in the server determines that the key-value pair corresponding to the component identification information does not exist in the first preset database, it sends the page request to the rendering splicer device, and the rendering splicer device obtains the preset task execution process corresponding to the page request from the process service device in the server, generates component data of the component to be updated according to the preset task execution process, and splices the component data of the component to be updated into a complete Hypertext Markup Language (HTML) file according to the preset splicing strategy, and adds preset JSON data to form a target response. The rendering splicer device in the server sends the target response to the client.
[0059] Optionally, the preset JSON data is pre-set and can be independently set according to needs, and is not limited in this embodiment.
[0060] Specifically, since each page is composed of multiple components, when a page request sent by a user through a client is received, the page request is read. If it is determined that the page request type corresponding to the page request is page rendering, the component identification information of the component to be updated is obtained from the page request. According to the component identification information of the component to be updated, a search is performed in a first preset database that caches multiple component data to determine whether the first preset database includes the component data of the component to be updated corresponding to the component identification information to be updated. If the first preset database includes the component data of the component to be updated, the component data of the component to be updated is directly sent to the client. If the first preset database does not include the component data of the component to be updated, the component data of the component to be updated is generated according to the component identification information of the component to be updated and user information, and the component data of the component to be updated is encapsulated as a target response, and the target response is sent to the client. This avoids the need to re-render the entire page after receiving the page rendering request. Instead, a component-level cache is set. For pages that only need to render at least one component, the cached component data is directly obtained from the first preset database, or the corresponding component data is regenerated, thereby avoiding repeated rendering, improving the cache hit rate, and thereby improving the page loading speed.
[0061] As an optional implementation, based on the above embodiment, after receiving a page request sent by a user through a client, the method further includes:
[0062] Get user information from the page request;
[0063] Parse the user information to obtain the parsed user information;
[0064] Create a target field and add the parsed user information to the target field;
[0065] Adds the target field to the page request.
[0066] The target field is the field where user information is added.
[0067] Specifically, in this embodiment, the server's request access device parses user information from the user session token in the page request using JSON Web Tokens, obtaining user identification information, user role, user device information, and other information. The server's request access device then creates a target field, writes the parsed user information into the target field, and writes the target field, with the parsed user information added, into the request header of the page request.
[0068] Optionally, the user identification information is information that uniquely identifies the user, and may be a user account, etc., which is not limited in this embodiment.
[0069] Optionally, the user role is a user role, which may be a common user, an operation and maintenance personnel, etc., and is not limited in this embodiment.
[0070] The user device information refers to the information of the device used by the user.
[0071] It is understandable that after the target field is added to the request header of the user request, the target field will be transmitted along with the transmission of the page request, and the internal devices in all servers can consistently and conveniently access the same user information.
[0072] Request headers are a set of key-value pairs that a client appends to a request message when it sends a page request to a server. They convey additional information about the request, helping the server understand the client's intent, process the request, and return an appropriate response.
[0073] It is understandable that when the rendering splicer device generates a target response and sends it to the client, it deletes the target field.
[0074] If the user has historical operation information, the access requesting device of the server obtains the historical operation information corresponding to the user according to the user identification information, and also adds the historical operation information corresponding to the user to the target field.
[0075] Specifically, since each node needs to parse the session token to obtain user information during the request processing process, after obtaining the page request, the session token included in the user request is parsed, and the parsed user information is added to the target field, and further added to the request header of the page request. Therefore, when performing corresponding operations or judgments based on the page request, there is no need to repeatedly parse the session token information, and the user information stored in the target field can be directly read, which reduces performance overhead and improves the efficiency of page request processing.
[0076] As an optional implementation manner, based on any of the above embodiments, the method further includes:
[0077] Get preset routing information based on page requests;
[0078] Determine the page request type corresponding to the page request from the preset routing information.
[0079] The preset routing information is a pre-set routing rule that defines how to map a page request to a corresponding processing program according to the characteristics of the page request.
[0080] Specifically, in this embodiment, the request access device in the server sends the page request to the routing controller device through the intranet, the routing controller device in the server obtains the preset routing information from the preset database of the process service device in the server, and the routing controller device in the server matches the corresponding routing rules from the preset routing information according to the page address in the page request, and determines the page request type corresponding to the page request according to the specific field in the matched routing rule.
[0081] Optionally, in this embodiment, operations and maintenance personnel can pre-define request types for different Uniform Resource Locator (URL) path patterns through the process service device. The routing controller in the server searches the retrieved preset routing information for a path and method that matches the current request. Upon finding a matching routing rule, the routing controller determines the corresponding page request type from the preset fields defined in the rule.
[0082] Among them, a uniform resource locator is an address used to locate and access Internet resources.
[0083] Wherein, the corresponding routing rules are matched from the preset routing information according to the page address in the page request, including the routing path and method corresponding to the page request.
[0084] Optionally, the preset routing information can be independently set according to needs, which is not limited in this embodiment.
[0085] Specifically, by presetting routing information, all routing rules can be centrally managed, avoiding the scattered definition of routes in the code and improving the maintainability of the code.
[0086] As an optional implementation, based on any of the above embodiments, the page request further includes a page address corresponding to the component to be updated;
[0087] If it is determined that the component data of the component to be updated is not included in the first preset database, the method further includes:
[0088] determining whether the second preset database includes target page data;
[0089] If the second preset database includes the target page data, sending the target page data to the client;
[0090] Generate component data of the component to be updated based on the component identification information and user information of the component to be updated, including:
[0091] If the target page data is not included in the second preset database, the component data of the component to be updated is generated based on the component identification information and user information of the component to be updated.
[0092] The second preset database is a database for storing cached page data. The second preset database is located in the local memory. The target page data is the page data corresponding to the page address of the component to be updated; and the second preset database includes a plurality of cached page data.
[0093] The page address corresponding to the component to be updated is in the form of a uniform resource locator.
[0094] Specifically, in this embodiment, the cache manager device in the server searches the second preset database according to the page address corresponding to the component to be updated, and determines whether the page data of the corresponding page address is cached in the second preset database. If it is determined that the target page data exists in the second preset database, the target page data is directly sent to the client. If the page data of the corresponding page address is cached in the second preset database, the page request is sent to the rendering splicer device. The rendering splicer device obtains the preset task execution process corresponding to the page request from the process service device in the server, generates the component data of the component to be updated according to the preset task execution process, and splices the component data of the component to be updated into a complete Hypertext Markup Language (HTML) file according to the preset splicing strategy, and adds preset JSON data to form a target response. The rendering splicer device in the server sends the target response to the client.
[0095] Specifically, the server first queries the component-level cache. If the cached component data for the component to be updated does not exist in the first preset database, it further queries the page-level cache (such as the complete page data). This multi-level cache reduces direct calls to backend services and improves response speed.
[0096] As an optional implementation manner, based on any of the above embodiments, generating component data of the component to be updated based on the component identification information and user information of the component to be updated includes:
[0097] Determining whether the user turns on a preset intelligent enhancement function based on the user information;
[0098] If it is determined that the user has enabled the preset intelligent enhancement function, original component data of the component to be updated is obtained, and target enhancement data is generated based on the component identification information of the component to be updated and user information using the first preset model;
[0099] Determine the original component data and target enhanced data of the component to be updated as the component data of the component to be updated;
[0100] If it is determined that the user has not enabled the preset intelligent enhancement function, original component data of the component to be updated is obtained, and the original component data of the component to be updated is determined as the component data of the component to be updated.
[0101] The intelligent enhancement function refers to the function of enhancing the generated component data by using a preset large model. The target enhanced data is the data generated using the intelligent enhancement function.
[0102] The original component data of the component to be updated is the data of the component to be updated without the intelligent enhancement function.
[0103] Optionally, the first preset model may be a lightweight language model or reasoning model, etc., which may be independently set according to needs and is not limited in this embodiment.
[0104] Specifically, in this embodiment, after receiving a page request, the routing controller in the server determines, based on the user information in the page request, whether the user corresponding to the user identification information included in the user information has enabled a preset intelligent enhancement function. If the user has enabled the preset intelligent enhancement function, the routing controller in the server adds the information indicating that the user has enabled the preset intelligent enhancement function to a target field, adds the target field to the page request, and sends the page request with the target field added to the rendering and splicing device in the server. The rendering and splicing device retrieves the original component data of the component to be updated from a preset database via a data interface and sends the original component data and the target field to the intelligent enhancement device. The intelligent enhancement device uses a first preset model and generates target enhancement data based on the original component data and the target field, and determines the original component data and the target enhancement data of the component to be updated as the component data of the component to be updated. If the routing controller in the server determines that the user has not enabled the preset intelligent enhancement function, the routing controller adds the information indicating that the user has not enabled the preset intelligent enhancement function to a target field, adds the target field to the page request, and sends the page request with the target field added to the rendering and splicing device in the server. The rendering and splicing device obtains original component data of the component to be updated from a preset database through a data interface, and determines the original component data of the component to be updated as the component data of the component to be updated.
[0105] It is understandable that the user can independently choose whether to enable the preset intelligent enhancement function in the user interface of the client.
[0106] Wherein, the intelligent enhancement device includes a first preset model.
[0107] For example, assume a user enables a preset intelligent enhancement function, and the target field includes user identification information, user role, user device, and user history. The user sends a request to update a shopping page. The intelligent enhancement device inputs the original component data and the target field into a first preset model. The first preset model analyzes the user history, user role, and user device, analyzes the user's personal characteristics, and outputs corresponding shopping recommendations or generates detailed descriptions of items on the page based on the user's personal characteristics. The generated shopping recommendations or detailed descriptions of items on the page are then output as target enhancement data.
[0108] It is understandable that the target enhancement data generated can be set according to the process service device. The rendering and splicing device in the server will obtain the corresponding execution process according to different paths, and the execution process includes the type of intelligent enhancement.
[0109] Specifically, the system determines whether the user has enabled the intelligent enhancement function. If the user has enabled the intelligent enhancement function, the system uses the first preset model to generate target enhancement data, providing personalized content to the user, thereby improving the user experience. If the user has not enabled the intelligent enhancement function, the system directly returns the original component data, ensuring the availability of basic functions and avoiding forced reliance on intelligent functions.
[0110] As an optional implementation, based on any of the above embodiments, the component data of the component to be updated is encapsulated into a target response, including:
[0111] Get the page template of the page corresponding to the component to be updated;
[0112] Create the target response object;
[0113] Fill the component data of the component to be updated into the page template of the page corresponding to the component to be updated to obtain the page data corresponding to the component to be updated;
[0114] The target response object is used to encapsulate the page data corresponding to the component to be updated to obtain the target response.
[0115] The target response object is an object that encapsulates the page data corresponding to the component to be updated.
[0116] Optionally, the page template of the page corresponding to the component to be updated is a template including a page frame.
[0117] Specifically, in this embodiment, the rendering and stitching engine in the server retrieves the page template corresponding to the component to be updated from a preset database, parses the page template, identifies the placeholders or dynamic fields in the template, maps the component data of the component to be updated to the placeholders in the page template, and renders the component data into the template through the template engine to generate complete page data, thereby obtaining the page data corresponding to the component to be updated. Furthermore, a target response object is initialized, and the page data corresponding to the component to be updated is assigned to the response body field of the target response object, thereby obtaining the target response.
[0118] Among them, the template engine is a tool used to combine dynamic data with static templates to generate the final output.
[0119] Optionally, the template engine can be independently configured according to needs, which is not limited in this embodiment.
[0120] Optionally, the target response object may be an HTTP response object, etc., which is not limited in this embodiment.
[0121] Specifically, after the component data of the component to be updated is generated, the page data corresponding to the component to be updated is generated through template rendering and then directly encapsulated as a target response, thereby reducing backend processing time.
[0122] As an optional implementation manner, based on any of the above embodiments, the method further includes:
[0123] If it is determined that the page request type corresponding to the page request is data acquisition, then obtaining identification information of the data to be acquired;
[0124] Determining whether the edge node includes data corresponding to the identification information of the data to be obtained;
[0125] If it is determined that the edge node includes the data corresponding to the identification information of the data to be obtained, the data corresponding to the identification information of the data to be obtained is obtained from the edge node and returned to the client;
[0126] If it is determined that the edge node does not include the data corresponding to the identification information of the data to be obtained, the data corresponding to the identification information of the data to be obtained is obtained from the central node and returned to the client.
[0127] Among them, the central node refers to the central computer room, which is the location where core data is processed and stored.
[0128] The identification information of the data to be obtained is used to uniquely identify the data to be obtained.
[0129] Data acquisition includes static resources and data interfaces. Static resources refer to data that is pre-generated on the server side, has fixed content, and does not change dynamically with user requests or environmental changes.
[0130] Specifically, in this embodiment, if the routing controller device in the server determines that the page request type of the page request is data acquisition, it sends an instruction to the cache manager device in the server, wherein the instruction includes a page request. The cache manager device in the server receives the instruction and obtains the identification information of the data to be obtained, searches for data corresponding to the identification information of the data to be obtained from the edge node. If the edge node includes data corresponding to the identification information of the data to be obtained, the data corresponding to the identification information of the data to be obtained is obtained from the edge node and returned to the client. If the edge node does not include data corresponding to the identification information of the data to be obtained, the cache manager device in the server sends the page request to the rendering and splicing device in the server. The rendering and splicing device in the server obtains the data corresponding to the identification information of the data to be obtained from the central node and returns it to the client.
[0131] Specifically, edge nodes are typically deployed geographically closer to users. Retrieving data from edge nodes can significantly reduce network latency and speed up data retrieval. Furthermore, edge node caching reduces direct database queries, reducing database pressure on central nodes. Since central nodes only need to process requests that are missed by edge nodes, the load is significantly reduced.
[0132] As an optional implementation manner, based on any of the above embodiments, the user information includes user identification information, user type and user device information;
[0133] After determining the page request type corresponding to the page request from the preset routing information, the method further includes:
[0134] Determining whether the user has enabled the intelligent prefetching function based on the user identification information;
[0135] If it is determined that the user has enabled the intelligent prefetching function, the user's historical operation information is obtained based on the user identification information;
[0136] Determine the user's target prediction page based on user type, user device information, and historical operation information;
[0137] The page data corresponding to the target prediction page is stored in the edge node.
[0138] Smart prefetching indicates whether to predict in advance the pages that users will open in the future. The target prediction page includes multiple predicted pages. The target prediction page is the page that users are predicted to open in the future.
[0139] Specifically, in this embodiment, the routing controller device in the server determines the type of page request and also determines whether the user has enabled the intelligent prefetching function based on the user identification information. If it is determined that the user has enabled the intelligent prefetching function, the routing controller device in the server generates and issues a preset instruction. The intelligent prefetcher device in the server receives the preset instruction and is triggered. The intelligent prefetcher device in the server obtains the user's historical operation information based on the user identification information, and uses a preset prediction strategy to determine the user's target prediction page. The target prediction page is then encapsulated into a preset task queue and sent to the preset engine device. The preset engine device obtains the page data corresponding to the target prediction page based on the target prediction page and caches the page data corresponding to the target prediction page in the edge node.
[0140] It is understandable that the user can independently choose whether to enable the smart prefetching function in the user interface of the client.
[0141] Optionally, the preset instructions can be independently set according to needs, which is not limited in this embodiment.
[0142] Optionally, the preset prediction strategy may be to use a preset prediction model for prediction, etc., which is not limited in this embodiment.
[0143] It is understandable that the determination of the intelligent prefetching function and the execution of subsequent steps and the determination of the page request type are performed in parallel.
[0144] Specifically, by predicting the pages that users may visit, the page data corresponding to the target predicted page is loaded to the edge node in advance. When the user requests it, it can be directly obtained from the edge node, thereby reducing loading time and improving user experience.
[0145] As an optional implementation manner, based on any of the above embodiments, determining the user's target prediction page based on the user type, user device information, and historical operation information includes:
[0146] Inputting the user type, user device information, and historical operation information into a second preset model for prediction to obtain a preset number of prediction pages;
[0147] A preset number of prediction pages are determined as target prediction pages.
[0148] The historical operation information includes the operation data such as the pages that the user has clicked in the past.
[0149] The second preset model is a model for predicting pages that the user may open in the future.
[0150] Optionally, the preset number may be a positive integer such as 5 or 10, and may be set independently according to needs, and is not limited in this embodiment.
[0151] Optionally, the second preset model may be a graph neural network, a lightweight recursive neural network, etc., which is not limited in this embodiment.
[0152] Exemplarily, if the second preset model is a lightweight gated recurrent unit (GRU) network, the training process of the second preset model is to obtain desensitized user historical operation information, which includes the access path of the user's historical visits, user role, device type, access period, page dwell time, etc. The historical access path is used as input, and the access path of the next hop is used as a label. A supervised learning task is constructed in the input lightweight GRU network with the historical path segment as input and the subsequent access path as the label. The cross-entropy loss function is used for optimization. The model parameters are compressed through quantized perception training to meet the edge computing resource constraints, and finally the trained second preset model is generated.
[0153] The lightweight gated recurrent unit network is a variant of a streamlined recurrent neural network. Quantization-aware training refers to simulating low-precision calculations during training.
[0154] Specifically, in this embodiment, the intelligent prefetcher device in the server obtains the user type, user device information and historical operation information, and inputs the user type, user device information and historical operation information into a second preset model. The second preset model analyzes the user type, user device information and historical operation information, and outputs a preset number of predicted pages, which are arranged from high to low according to the possibility of each predicted page being accessed, and the preset number of predicted pages are determined as target predicted pages.
[0155] Specifically, the user target prediction page is predicted using user type, user device information, and historical operation information to achieve multi-dimensional data fusion. The second preset model can more comprehensively understand user needs and generate a more accurate prediction page.
[0156] As an optional implementation, based on any of the above embodiments, storing the page data corresponding to the target prediction page in the edge node includes:
[0157] Obtaining the page address of each prediction page in the target prediction page in parallel;
[0158] Obtaining page data of each predicted page based on the page address of each predicted page;
[0159] The page data of each predicted page is stored in the edge node.
[0160] Specifically, in this embodiment, the preset engine device in the server obtains the page data corresponding to the target prediction page based on the target prediction page, and starts the working thread pool, concurrently requests the page data of each prediction page according to the page address of each prediction page, and calls the write interface of the cache manager device to cache the page data of each prediction page, and caches the page data corresponding to the target prediction page in the edge node.
[0161] Among them, for static resources, they are downloaded by the client and pushed to the CDN cache node.
[0162] Specifically, by placing the target predicted pages that users may visit in the cache in advance, the hit rate and response speed of subsequent visits are improved.
[0163] As an optional implementation manner, based on any of the above embodiments, the method further includes:
[0164] Determining a response time for generating component data of the component to be updated based on component identification information of the component to be updated and user information;
[0165] Comparing the response time with a preset time threshold;
[0166] If the response time is greater than the preset time threshold, the preset page data is obtained according to the page request, the preset page data is encapsulated as a target response, and the target response is sent to the client.
[0167] Optionally, the preset time threshold can be set independently according to needs and is not limited in this embodiment.
[0168] The response time is the execution time of generating component data of the component to be updated based on the component identification information of the component to be updated and user information.
[0169] Specifically, in this embodiment, the server records the execution time of generating the component data of the component to be updated based on the component identification information and user information of the component to be updated, and uses the execution time of generating the component data of the component to be updated based on the component identification information and user information of the component to be updated as the response time, and compares the response time with the preset time threshold. If it is greater than the preset time threshold, the preset page data is directly obtained according to the page request, and the preset page data is encapsulated into a response format that meets the client requirements to form a target response, and the target response is sent to the client through the preset communication protocol.
[0170] The preset page data may be simple page data corresponding to the page address included in the page request.
[0171] Optionally, the preset page data may be simple page data or the last cached data corresponding to the page, etc., which is not limited in this embodiment.
[0172] Optionally, the server may also record the response time of each step in the execution, and compare the response time with the corresponding time threshold. If a timeout occurs, the corresponding preset timeout policy is executed.
[0173] The preset timeout strategy is a corresponding execution strategy that is preset when the corresponding step exceeds the time threshold.
[0174] Optionally, the preset timeout policy can be independently set according to needs and is not limited in this embodiment.
[0175] Optionally, in this embodiment, a corresponding timeout period may be set for each device in the server, and if a timeout occurs, a corresponding timeout response strategy is executed.
[0176] Specifically, by determining the response time of generating component data of the component to be updated based on the component identification information and user information of the component to be updated, the response time is compared with the preset time threshold. If it exceeds the preset time threshold, the preset page data is directly obtained and returned, which can avoid the generation of the component data to be updated taking too long, causing the user to wait for a long time.
[0177] As an optional implementation manner, based on any of the above embodiments, the method further includes:
[0178] Get preset indicators;
[0179] Comparing the preset indicator with the corresponding preset indicator threshold;
[0180] If the preset indicator is less than the corresponding preset indicator threshold, a corresponding alarm message is generated.
[0181] Among them, the preset indicators include cache hit rate and / or prefetch hit rate; the cache hit rate is the proportion of component data of the component to be updated corresponding to the page request directly obtained from the first preset database, and the prefetch hit rate is the proportion of the target predicted page actually accessed by the user.
[0182] Optionally, the preset indicators may also include step execution time or artificial intelligence call delay, etc., which are not limited in this embodiment.
[0183] Optionally, the preset indicator threshold value can be independently set according to needs. Different preset indicators have corresponding different preset indicator threshold values, which are not limited in this embodiment.
[0184] It can be understood that the cache hit rate is the ratio of component data corresponding to the component to be updated that is directly obtained from the cache.
[0185] Specifically, in this embodiment, the server obtains preset indicators, such as cache hit rate or prefetch hit rate, from a preset database, and compares the preset indicators with the corresponding preset execution thresholds. If the preset indicators are less than the corresponding preset indicator thresholds, corresponding alarm information is generated and sent to the client of the relevant personnel.
[0186] It is understandable that the relevant personnel may be operation and maintenance personnel and other staff, which is not limited in this embodiment.
[0187] Specifically, by detecting the preset indicators and comparing them with the corresponding preset execution thresholds, the system performance can be monitored, and by generating alarm information, it helps maintenance personnel to perform optimization.
[0188] Figure 3 A flow chart of a page rendering method provided in another embodiment of the present application is shown as follows: Figure 3 The page rendering method provided in this embodiment is applied to a server. The page rendering method provided in this embodiment specifically includes the following steps:
[0189] The server includes a request access device, a routing controller device, a cache manager device, an intelligent prefetcher device, a prefetch engine device, an intelligent enhancer device, a rendering assembler device, and a process service device.
[0190] S301: The access device is requested to receive a page request sent by a user client.
[0191] S302: The access device is requested to parse the user information in the page request, and add the parsed user information to the page request through a target field, and send it to the routing controller device.
[0192] S303, the routing controller device determines the user's page request type and whether to enable the preset intelligent enhancement function and intelligent prefetching function according to the page request, and encapsulates the page request type and the results of whether to enable the preset intelligent enhancement function and intelligent prefetching function into a memory instruction and sends it to the cache manager device.
[0193] S304, if the routing controller device determines that the page request type corresponding to the page request is page rendering, the cache manager device determines whether the component data of the component to be updated is included in the first preset database based on the component identification information of the component to be updated. If it is determined that the component data of the component to be updated is included in the first preset database, the component data of the component to be updated is sent to the client.
[0194] S305. If the cache manager device determines that the component data of the component to be updated is not included in the first preset database, the cache manager device determines whether the target page data is included in the second preset database based on the page address corresponding to the component to be updated. If the target page data is included in the second preset database, the target page data is sent to the client.
[0195] S306: If the cache manager device determines that the target page data is not included in the second preset database, the cache manager device sends the page request to the rendering assembler device.
[0196] S307, the rendering assembler device obtains the corresponding execution process from the process service device, parses the flowchart into a task list, and executes the tasks.
[0197] S308, if the rendering assembler device determines that the user has turned on the intelligent enhancement function, it obtains the original component data of the component to be updated, adopts the first preset model and generates target enhancement data based on the component identification information and user information of the component to be updated, determines the original component data and target enhancement data of the component to be updated as the component data of the component to be updated, obtains the page template of the page corresponding to the component to be updated, fills the component data of the component to be updated into the page template of the page corresponding to the component to be updated, uses the target response object to encapsulate the page data corresponding to the component to be updated to obtain the target response, and returns the target response to the client.
[0198] S309, if the rendering assembler device determines that the user has not turned on the intelligent enhancement function, it obtains the original component data of the component to be updated, and determines the original component data of the component to be updated as the component data of the component to be updated, and obtains the page template of the page corresponding to the component to be updated, fills the component data of the component to be updated into the page template of the page corresponding to the component to be updated, uses the target response object to encapsulate the page data corresponding to the component to be updated to obtain the target response, and returns the target response to the client.
[0199] Wherein, each time the rendering assembler device generates component data of a component to be updated, the component data of the component to be updated is written to the cache manager device for caching.
[0200] S310, if it is determined that the page request type corresponding to the page request is data acquisition, the cache manager device determines whether the edge node includes data corresponding to the identification information of the data to be acquired. If included, the data corresponding to the identification information of the data to be acquired is acquired from the edge node and returned to the client; if not included, the data corresponding to the identification information of the data to be acquired is acquired from the central node and returned to the client.
[0201] S311, if the routing controller device determines that the user turns on the intelligent prefetching function, the routing controller device generates and issues a preset instruction, and the intelligent prefetcher device receives the preset instruction and is triggered. The intelligent prefetcher device inputs the user type, user device information and historical operation information into the second preset model for prediction, thereby obtaining the target prediction page.
[0202] S312, the intelligent prefetcher device sends the target prediction page to the preset engine device, the preset engine device concurrently requests the page data of each prediction page according to the page address of each prediction page, and calls the write interface of the cache manager device to cache the page data of each prediction page, and caches the page data corresponding to the target prediction page in the edge node.
[0203] Figure 4 This is a schematic diagram of the structure of a page rendering device provided in one embodiment of the present application. Figure 4 As shown, the execution subject of the above-mentioned page rendering method is a page rendering device, which can be implemented by a computer program; it can also be implemented by a medium storing a relevant computer program, such as a USB flash drive and / or an optical disk, or it can also be implemented by a physical device integrated or installed with a relevant computer program, such as an electronic device. The electronic device can be a computer or a server. The page rendering device provided in this embodiment is located in an electronic device, and the page rendering device 40 provided in this embodiment includes: a receiving module 41, an acquisition module 42, a determination module 43, a sending module 44, a generation module 45, and an encapsulation module 46.
[0204] Specifically, a receiving module 41 is configured to receive a page request sent by a user through a client; the page includes multiple components; and the page request includes user information. An obtaining module 42 is configured to obtain component identification information of the component to be updated from the page request if it is determined that the page request corresponds to page rendering. A determining module 43 is configured to determine, based on the component identification information, whether the component data of the component to be updated is included in a first preset database; the first preset database includes multiple cached component data. A sending module 44 is configured to send the component data of the component to be updated to the client if it is determined that the component data of the component to be updated is included in the first preset database. A generating module 45 is configured to generate the component data of the component to be updated based on the component identification information and user information of the component to be updated if it is determined that the component data of the component to be updated is not included in the first preset database. An encapsulating module 46 is configured to encapsulate the component data of the component to be updated into a target response. The sending module 44 is also configured to send the target response to the client.
[0205] Optionally, the page rendering device 40 further includes: a parsing module and an adding module.
[0206] Correspondingly, the acquisition module 42 is used to receive the page request sent by the user through the client and obtain the user information from the page request; the parsing module is used to parse the user information to obtain the parsed user information; the adding module is used to create a target field and add the parsed user information to the target field; and the target field is added to the page request.
[0207] Optionally, the acquisition module 42 is configured to acquire preset routing information based on the page request; and the determination module 43 is configured to determine a page request type corresponding to the page request from the preset routing information.
[0208] Optionally, the page request also includes a page address corresponding to the component to be updated.
[0209] Accordingly, determination module 43 is configured to, if it is determined that the component data of the component to be updated is not included in the first preset database, determine whether the target page data is included in the second preset database; the target page data is page data corresponding to the page address of the component to be updated; the second preset database includes multiple cached page data; if the target page data is included in the second preset database, then send the target page data to the client. Generation module 45, when generating the component data of the component to be updated based on the component identification information and user information of the component to be updated, is configured to, if the target page data is not included in the second preset database, generate the component data of the component to be updated based on the component identification information and user information of the component to be updated.
[0210] Optionally, the generation module 45, when generating component data of the component to be updated based on the component identification information and user information of the component to be updated, is specifically used to: determine whether the user turns on the preset intelligent enhancement function based on the user information; if it is determined that the user turns on the preset intelligent enhancement function, obtain the original component data of the component to be updated, adopt the first preset model and generate target enhancement data based on the component identification information and user information of the component to be updated; determine the original component data and target enhancement data of the component to be updated as the component data of the component to be updated; if it is determined that the user does not turn on the preset intelligent enhancement function, obtain the original component data of the component to be updated, and determine the original component data of the component to be updated as the component data of the component to be updated.
[0211] Optionally, the encapsulation module 46, when encapsulating the component data of the component to be updated into a target response, is specifically used to: obtain the page template of the page corresponding to the component to be updated; create a target response object; fill the component data of the component to be updated into the page template of the page corresponding to the component to be updated to obtain the page data corresponding to the component to be updated; and use the target response object to encapsulate the page data corresponding to the component to be updated to obtain the target response.
[0212] Optionally, the acquisition module 42 is used to obtain the identification information of the data to be obtained if it is determined that the page request type corresponding to the page request is data acquisition; the determination module 43 is used to determine whether the edge node includes data corresponding to the identification information of the data to be obtained; the acquisition module 42 is used to obtain the data corresponding to the identification information of the data to be obtained from the edge node if it is determined that the edge node includes the data corresponding to the identification information of the data to be obtained, and return it to the client; if it is determined that the edge node does not include the data corresponding to the identification information of the data to be obtained, obtain the data corresponding to the identification information of the data to be obtained from the central node, and return it to the client.
[0213] Optionally, the user information includes user identification information, user type and user device information.
[0214] The page rendering device 40 further includes a storage module.
[0215] Accordingly, the determination module 43 is used to determine whether the user has turned on the intelligent prefetching function based on the user identification information after determining the page request type corresponding to the page request from the preset routing information; the intelligent prefetching is used to indicate whether to predict in advance the pages that the user will open in the future; the acquisition module 42 is used to obtain the user's historical operation information based on the user identification information if it is determined that the user has turned on the intelligent prefetching function; the determination module 43 is used to determine the user's target prediction page based on the user type, user device information and historical operation information; the target prediction page includes multiple prediction pages; the storage module is used to store the page data corresponding to the target prediction page in the edge node.
[0216] Optionally, when determining the target prediction page of a user based on the user type, user device information and historical operation information, the determination module 43 is specifically used to: input the user type, user device information and historical operation information into a second preset model for prediction to obtain a preset number of prediction pages; and determine the preset number of prediction pages as the target prediction pages.
[0217] Optionally, the storage module stores the page data corresponding to the target prediction page in the edge node, and is used to obtain the page address of each prediction page in the target prediction page in parallel; obtain the page data of each prediction page based on the page address of each prediction page; and store the page data of each prediction page in the edge node.
[0218] Optionally, the page rendering device 40 further includes: a comparison module.
[0219] Accordingly, the determination module 43 is used to determine the response time of generating component data of the component to be updated based on the component identification information and user information of the component to be updated; the comparison module is used to compare the response time with the preset time threshold; the acquisition module 42 is used to obtain the preset page data according to the page request if the response time is greater than the preset time threshold, encapsulate the preset page data into a target response, and send the target response to the client.
[0220] Optionally, the page rendering device 40 further includes: a generation module.
[0221] Accordingly, the acquisition module 42 is used to obtain preset indicators; the preset indicators include cache hit rate and / or prefetch hit rate; the cache hit rate is the proportion of component data of the corresponding component to be updated in the page request directly obtained from the first preset database; the prefetch hit rate is the proportion of the target predicted page actually accessed by the user; the comparison module is used to compare the preset indicator with the corresponding preset indicator threshold; the generation module is used to generate corresponding alarm information if the preset indicator is less than the corresponding preset indicator threshold.
[0222] For the description of the features in the embodiment corresponding to the page rendering device, please refer to the relevant description of the embodiment corresponding to the page rendering method, and will not be repeated here.
[0223] Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. Figure 5 As shown, the electronic device 50 provided in an embodiment of the present application includes: a memory 52 and a processor 51.
[0224] The memory 52 stores a computer program, and the processor 51 is configured to run the computer program to execute the steps in any of the above-mentioned embodiments of the page rendering method.
[0225] The specific implementation process of the processor 51 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0226] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0227] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0228] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0229] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned page rendering method embodiments when running.
[0230] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0231] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned page rendering method embodiments are implemented.
[0232] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned page rendering method embodiments are implemented.
[0233] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0234] The above is a detailed introduction to a data transmission method provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be noted that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications may be made to the present application, and such improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A page rendering method, characterized in that: The method comprises: Receive a page request sent by a user through a client; the page includes multiple components; the page request includes user information; If it is determined that the page request type corresponding to the page request is page rendering, obtaining component identification information of the component to be updated from the page request, and determining whether component data of the component to be updated is included in a first preset database based on the component identification information; the first preset database includes a plurality of cached component data; If it is determined that the component data of the component to be updated is included in the first preset database, sending the component data of the component to be updated to the client; If it is determined that the component data of the component to be updated is not included in the first preset database, determine whether the user turns on the preset intelligent enhancement function based on the user information; if it is determined that the user turns on the preset intelligent enhancement function, obtain the original component data of the component to be updated, adopt the first preset model and generate target enhancement data based on the component identification information of the component to be updated and the user information; determine the original component data of the component to be updated and the target enhancement data as the component data of the component to be updated; if it is determined that the user does not turn on the preset intelligent enhancement function, obtain the original component data of the component to be updated, and determine the original component data of the component to be updated as the component data of the component to be updated; encapsulate the component data of the component to be updated as a target response, and send the target response to the client.
2. The page rendering method according to claim 1, characterized in that: After receiving the page request sent by the user through the client, the method further includes: Obtaining the user information from the page request; Parsing the user information to obtain parsed user information; Creating a target field, and adding the parsed user information to the target field; The target field is added to the page request.
3. The page rendering method according to claim 2, characterized in that: The method further comprises: Obtaining preset routing information based on the page request; A page request type corresponding to the page request is determined from the preset routing information.
4. The page rendering method according to claim 2, characterized in that: The page request also includes the page address corresponding to the component to be updated; If it is determined that the component data of the component to be updated is not included in the first preset database, the method further includes: Determining whether the second preset database includes target page data; the target page data is page data corresponding to the page address of the component to be updated; the second preset database includes a plurality of cached page data; If the target page data is included in the second preset database, sending the target page data to the client; The generating the component data of the component to be updated based on the component identification information of the component to be updated and the user information includes: If the target page data is not included in the second preset database, the component data of the component to be updated is generated based on the component identification information of the component to be updated and the user information.
5. The page rendering method according to claim 1, wherein: Encapsulating the component data of the component to be updated into a target response includes: Obtain the page template of the page corresponding to the component to be updated; Create the target response object; Filling the component data of the component to be updated into the page template of the page corresponding to the component to be updated to obtain the page data corresponding to the component to be updated; The target response object is used to encapsulate the page data corresponding to the component to be updated to obtain the target response.
6. The page rendering method according to claim 1, characterized in that: The method further comprises: If it is determined that the page request type corresponding to the page request is data acquisition, obtaining identification information of the data to be acquired; Determining whether the edge node includes data corresponding to the identification information of the data to be obtained; If it is determined that the edge node includes the data corresponding to the identification information of the data to be obtained, obtaining the data corresponding to the identification information of the data to be obtained from the edge node and returning it to the client; If it is determined that the edge node does not include the data corresponding to the identification information of the data to be obtained, the data corresponding to the identification information of the data to be obtained is obtained from the central node and returned to the client.
7. The page rendering method according to claim 3, characterized in that: The user information includes user identification information, user type and user device information; After determining the page request type corresponding to the page request from the preset routing information, the method further includes: Determining whether the user has enabled a smart prefetching function based on the user identification information; the smart prefetching function is used to indicate whether to predict in advance the pages that the user will open in the future; If it is determined that the user has enabled the intelligent prefetching function, acquiring historical operation information of the user based on the user identification information; Determine a target prediction page for the user based on the user type, the user device information, and the historical operation information; the target prediction page includes multiple prediction pages; The page data corresponding to the target prediction page is stored in the edge node.
8. The page rendering method according to claim 7, characterized in that: The determining of the target prediction page of the user based on the user type, the user device information, and the historical operation information includes: Inputting the user type, the user device information, and the historical operation information into a second preset model for prediction to obtain a preset number of predicted pages; A preset number of the predicted pages are determined as the target predicted pages.
9. The page rendering method according to claim 7, characterized in that: The storing the page data corresponding to the target prediction page in the edge node includes: Acquire the page address of each prediction page in the target prediction page in parallel; Acquiring page data of each predicted page based on the page address of each predicted page; The page data of each predicted page is stored in an edge node.
10. The page rendering method according to claim 9, characterized in that: The method further comprises: Determining a response time for generating component data of the component to be updated based on the component identification information of the component to be updated and the user information; comparing the response time with a preset time threshold; If the response time is greater than the preset time threshold, preset page data is obtained according to the page request, the preset page data is encapsulated as the target response, and the target response is sent to the client.
11. The page rendering method according to any one of claims 1 to 10, characterized in that: The method further comprises: Obtaining preset indicators; the preset indicators include a cache hit rate and / or a prefetch hit rate; the cache hit rate is the proportion of component data of the component to be updated corresponding to the page request directly obtained from the first preset database; the prefetch hit rate is the proportion of the target predicted page actually accessed by the user; Comparing the preset indicator with the corresponding preset indicator threshold; If the preset indicator is less than the corresponding preset indicator threshold, a corresponding alarm message is generated.
12. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the page rendering method according to any one of claims 1 to 11 when executing the computer program.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the page rendering method according to any one of claims 1 to 11 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the page rendering method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Page generation method, device and equipment
CN112905175A
Component processing method and equipment
CN113536168A