A method, apparatus, electronic device, and storage medium for front-end page traffic splitting.
By working in collaboration with the operation and management system, Nginx server, and CDN, and combining Lua scripts and cookie technology, we have achieved efficient and flexible front-end page traffic distribution, solving the problems of poor user experience and high maintenance costs in traditional A/B testing methods, and improving system performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHAOLIAN CONSUMER FINANCE CO LTD
- Filing Date
- 2026-05-13
- Publication Date
- 2026-06-30
AI Technical Summary
Traditional A/B testing methods increase page load time in high-concurrency scenarios, resulting in poor user experience, increased server load, lack of flexibility and scalability, and high development and maintenance costs.
The system configures multiple versions of the experimental parameter generation function through the operation and management system. It uses Lua scripts on the Nginx server to combine access request information for traffic splitting, and uses CDN to cache static resources to dynamically adjust the splitting ratio, avoid client redirection, and use cookies to store the splitting results.
It significantly reduces additional requests before page rendering, improves user experience and page loading performance, reduces development and maintenance costs, enhances system stability and scalability, and supports flexible traffic routing driven by real-time data.
Smart Images

Figure CN122309870A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet front-end technology, and in particular to a front-end page traffic splitting method, device, electronic device, and storage medium. Background Technology
[0002] With the rapid development of Internet technology, the iteration speed of front-end business functions is accelerating. A / B testing, as an important means of evaluating the effectiveness of new functions, is widely used in the product optimization process.
[0003] However, traditional A / B testing implementations have gradually revealed numerous shortcomings when dealing with the high concurrency and low latency requirements of the modern internet. Traditional methods typically request the functional A / B splitting interface before the business module is rendered to obtain the splitting results and decide whether to redirect to the new feature version module. This approach adds extra interface requests before page rendering, which not only prolongs page load time and impacts user experience but also increases the server load and reduces system performance in high-concurrency scenarios.
[0004] Meanwhile, the brief blank screen caused by client redirection further degrades the user experience. Furthermore, after A / B testing, manual modification of the front-end code is required to remove the traffic splitting logic, increasing development and maintenance costs and increasing the risk of human error. More importantly, traditional methods lack flexibility and scalability, failing to dynamically adjust the traffic splitting ratio based on real-time data, making it difficult to meet rapidly changing business needs.
[0005] Therefore, there is an urgent need for a front-end page offloading method that can reduce additional requests before page rendering, avoid client-side blank screens, simplify the A / B test shutdown process, and has high flexibility and scalability. Summary of the Invention
[0006] The embodiments of the present invention provide a front-end page traffic splitting method to solve the problems of increased page loading time, client redirection resulting in a blank screen, high development and maintenance costs, and lack of flexibility and scalability in existing technologies. The technical solution is as follows: According to one aspect of the present invention, a front-end page traffic splitting method is provided, the method comprising: acquiring experimental parameters, configuring the experimental parameters in an operation management system, obtaining a multi-version configuration file for a function, and synchronizing it to an Nginx server via a synchronization tool; the experimental parameters include an experimental effective time, a traffic splitting ratio, and a function module version identifier; when an access request arrives at the Nginx server, reading the multi-version configuration file for a function via a Lua script deployed on the Nginx server, obtaining a traffic splitting result according to a preset traffic splitting logic based on the information in the access request, and writing it to a client cookie; caching multiple versions of HTML files and corresponding CSS and JS resources via a CDN based on the traffic splitting result, and loading the corresponding version of static resources via the CDN based on the cookie when the access request arrives at the Nginx server again; during A / B testing, dynamically adjusting the traffic splitting ratio based on real-time data through the operation management system, and synchronizing the new configuration to the Nginx server in real time, and performing traffic splitting by reading the latest configuration file via a Lua script on the Nginx server.
[0007] In one embodiment, configuring the experimental parameters in the operation management system to obtain a multi-version configuration file is achieved through the following steps: configuring the experimental parameters in the operation management system, and generating a structured multi-version configuration file based on the experimental parameters; the multi-version configuration file includes redirection rules, experimental time range, and user traffic splitting conditions.
[0008] In one embodiment, synchronization to the Nginx server via a synchronization tool is achieved through the following steps: using an automated synchronization tool to push the multi-version configuration file of the function to a specified directory on the Nginx server, and dynamically loading the file at runtime via a Lua script on the Nginx server; the synchronization tool includes a CD script and a configuration center.
[0009] In one embodiment, the process of reading the multi-version configuration file of the function using a Lua script deployed on the Nginx server and obtaining the traffic splitting result according to the preset traffic splitting logic by combining the information in the access request is achieved through the following steps: When the access request arrives at the Nginx server, the user's last digit is extracted from the cookie of the access request by the Lua script deployed on the Nginx server, and the synchronized configuration file is read at the same time; the user traffic splitting condition field in the configuration is used to determine whether the user corresponding to the access request belongs to the experimental traffic splitting range. If they match, the target version module is further determined according to the traffic splitting identifier and the function module version identifier field, and the traffic splitting result is generated.
[0010] In one embodiment, writing to the client cookie is achieved through the following steps: on the server side, a Lua script deployed on the Nginx server writes the traffic splitting result to the client cookie, while modifying the response header of the Nginx server and accessing the corresponding version of the functional module URL by rewriting the URI.
[0011] In one embodiment, the CDN caches multiple versions of HTML files and their corresponding CSS and JS resources based on the traffic distribution results. When the access request arrives at the Nginx server again, the CDN loads the corresponding version of the static resources based on the cookie. This is achieved through the following steps: the CDN node distinguishes versions based on the cookie value in the access request, caches different versions of HTML files and their associated CSS and JS resources, and when the access request arrives at the Nginx server again, the CDN directly returns the corresponding version of the static resources.
[0012] In one embodiment, during A / B testing, the operation management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The traffic splitting is achieved by reading the latest configuration file through Lua scripts on the Nginx server. This is accomplished through the following steps: the operation management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The latest rules are automatically loaded by Lua scripts on the Nginx server on the next run.
[0013] According to one aspect of the present invention, a front-end page traffic splitting device includes: a configuration experiment parameter module for acquiring experiment parameters, configuring the experiment parameters in an operation management system, obtaining a multi-version configuration file, and synchronizing it to an Nginx server via a synchronization tool; the experiment parameters include an experiment effective time, a traffic splitting ratio, and a functional module version identifier; a Lua script traffic splitting processing module for reading the multi-version configuration file via a Lua script deployed on the Nginx server when an access request arrives at the Nginx server, obtaining a traffic splitting result according to a preset traffic splitting logic based on the information in the access request, and writing it to a client cookie; a CDN resource dynamic loading module for caching multiple versions of HTML files and corresponding CSS and JS resources via CDN based on the traffic splitting result, and loading the corresponding version of static resources via CDN based on cookies when an access request arrives at the Nginx server again; and a real-time traffic splitting strategy adjustment module for dynamically adjusting the traffic splitting ratio based on real-time data through the operation management system during A / B testing, synchronizing the new configuration to the Nginx server in real time, and performing traffic splitting by reading the latest configuration file via a Lua script on the Nginx server.
[0014] According to one aspect of the present invention, an electronic device includes at least one processor and at least one memory, wherein computer-readable instructions are stored on the memory; the computer-readable instructions are executed by one or more of the processors to cause the electronic device to implement the front-end page offloading method as described above.
[0015] According to one aspect of the present invention, a storage medium has computer-readable instructions stored thereon, which are executed by one or more processors to implement the front-end page offloading method as described above.
[0016] The beneficial effects of the technical solution provided by this invention are: In the above technical solution, this invention first obtains and configures experimental parameters through an operation management system, generates a multi-version configuration file, and pushes it to the Nginx server using a synchronization tool. When an access request arrives at Nginx, a Lua script deployed on the server reads the configuration file, combines it with the request information, and performs traffic splitting according to preset logic. The result is written to the client's cookie, and direct redirection is implemented. The CDN caches multiple versions of HTML and static resources based on the traffic splitting results, ensuring that subsequent requests can quickly load the corresponding version of the content. During A / B testing, the operation management system can dynamically adjust the traffic splitting ratio based on real-time data. New configurations are synchronized to Nginx in real time, and the Lua script automatically loads the latest rules the next time it runs, achieving flexible and efficient traffic splitting management. This method significantly reduces additional requests before page rendering, avoids the white screen phenomenon caused by client redirection, and improves user experience and page loading performance. At the same time, by managing the traffic splitting logic through the backend configuration file, A / B testing can be launched and taken offline without modifying the frontend code, reducing development and maintenance costs and enhancing the stability and scalability of the system. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a front-end page traffic splitting method according to an exemplary embodiment; Figure 2 This is a flowchart illustrating how a dynamic CDN resource loading model works in an application scenario. Figure 3 yes Figure 2 Flowcharts of front-end page traffic splitting execution in corresponding application scenarios; Figure 4 This is a block diagram illustrating a front-end page routing device according to an exemplary embodiment; Figure 5 This is a hardware structure diagram of an electronic device according to an exemplary embodiment; Figure 6 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0019] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0020] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this disclosure means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0021] This invention provides a front-end page traffic splitting method. Through collaboration between an operation management system and an Nginx server, combined with CDN caching technology, it achieves efficient front-end page traffic splitting and dynamic control. This solves the problems of high performance overhead, poor user experience, high maintenance costs, and insufficient flexibility associated with traditional methods. This front-end page traffic splitting method is applicable to front-end page traffic splitting devices, which can be electronic devices. The front-end page traffic splitting method in this invention can be applied to various scenarios, such as front-end page traffic splitting, etc.
[0022] Please see Figure 1 This invention provides a front-end page traffic splitting method, which is applicable to electronic devices.
[0023] In the following method embodiments, for ease of description, the execution subject of each step of the method is an electronic device, but this does not constitute a specific limitation.
[0024] like Figure 1 As shown, the method may include the following steps: Step 110: Obtain experimental parameters, configure experimental parameters in the operation management system, obtain the multi-version configuration file, and synchronize it to the Nginx server using a synchronization tool.
[0025] One possible implementation involves configuring experimental parameters within the operations management system, generating a structured multi-version configuration file based on these parameters, and then using an automated synchronization tool to push the multi-version configuration file to a specified directory on the Nginx server. The file is then dynamically loaded at runtime via a Lua script on the Nginx server.
[0026] The experimental parameters include the experimental effective time, the traffic splitting ratio, the functional module version identifier, etc. The multi-version configuration file contains redirection rules, experimental time range and user traffic splitting conditions, etc. The synchronization tools include CD scripts, configuration centers, etc., none of which are specified here.
[0027] Specifically, within the operations management system, operations personnel set experimental parameters based on business needs, including but not limited to the experiment's effective time, traffic splitting ratio, and functional module version identifiers. These parameters form the basis for subsequent traffic splitting logic, ensuring the controllability and accuracy of the splitting process. Based on the set experimental parameters, the operations management system automatically generates a structured multi-version configuration file. This file details key information such as redirection rules, experiment time ranges, and user traffic splitting conditions, providing clear guidance for subsequent traffic splitting operations. Using automated synchronization tools (such as CD scripts and configuration centers), the multi-version configuration file is pushed to a designated directory on the Nginx server in real time. Lua scripts on the Nginx server dynamically load this file at runtime, ensuring the real-time performance and accuracy of the traffic splitting logic.
[0028] In the above process, this embodiment of the invention ensures the flexibility and configurability of the traffic splitting logic through refined experimental parameter settings and structured configuration file generation. Simultaneously, the use of automated synchronization tools enables real-time push and dynamic loading of configuration files, improving the response speed and accuracy of the traffic splitting process. This step lays a solid foundation for subsequent traffic splitting operations.
[0029] Step 120: When an access request arrives at the Nginx server, the Lua script deployed on the Nginx server reads the multi-version configuration file, combines it with the information in the access request, obtains the routing result according to the preset routing logic, and writes it to the client cookie.
[0030] In one possible implementation, when an access request arrives at the Nginx server, a Lua script deployed on the Nginx server extracts the user's last digit from the access request's cookie and reads the synchronized configuration file. Based on the user traffic splitting condition field in the configuration, it is determined whether the user corresponding to the access request belongs to the experimental traffic splitting range. If they match, the target version module is further determined based on the traffic splitting identifier and functional module version identifier fields, and the traffic splitting result is generated.
[0031] In one possible implementation, the routing results are written to the client's cookie via a Lua script deployed on the Nginx server on the server side. At the same time, the response header of the Nginx server is modified to access the corresponding version of the functional module URL by rewriting the URI.
[0032] Specifically, when a user initiates an access request, the request first reaches the Nginx server. As the entry point for frontend traffic, the Nginx server bears the heavy responsibility of request processing and traffic distribution. Upon receiving the access request, the Lua script deployed on the Nginx server immediately reads the previously synchronized multi-version configuration file. Simultaneously, it extracts key information such as the user's last four digits from the access request's cookie.
[0033] Furthermore, based on the user traffic splitting condition field in the configuration file, the Lua script determines whether the user corresponding to the current access request belongs to the experimental traffic splitting range. If a match is found, the target version module is further determined based on the traffic splitting identifier and functional module version identifier fields, and a traffic splitting result is generated. The Lua script writes the traffic splitting result to the client's cookie and modifies the Nginx server's response header, accessing the corresponding version's functional module URL by rewriting the URI. This process is transparent to the user, achieving seamless page redirection. This design not only improves traffic splitting efficiency but also avoids page loading interruptions caused by additional interface requests and redirects, significantly improving page loading performance and user experience. Simultaneously, using cookies to store the traffic splitting result enables persistence of the traffic splitting state and sharing across requests.
[0034] In the above process, this embodiment of the invention integrates request processing and traffic splitting logic through Lua scripts on the Nginx server. This design not only improves traffic splitting efficiency but also avoids additional interface requests and client redirects, significantly enhancing page loading performance and user experience. Simultaneously, by utilizing cookies to store the traffic splitting results, the persistence of the traffic splitting state and its sharing across requests are achieved.
[0035] Step 130: Based on the traffic splitting results, CDN caches multiple versions of HTML files and corresponding CSS and JS resources. When the access request arrives at the Nginx server again, CDN loads the corresponding version of static resources based on cookies.
[0036] One possible implementation is to use CDN nodes to differentiate versions based on the cookie value in the access request, cache different versions of HTML files and their associated CSS and JS resources, and when the access request reaches the Nginx server again, the corresponding version of the static resources can be directly returned via CDN.
[0037] Specifically, based on the traffic splitting results, CDN nodes cache different versions of HTML files and their associated CSS and JS resources. Each version corresponds to an independent cache backup, ensuring resource isolation and independence. When the access request arrives at the Nginx server again, the CDN node distinguishes the version based on the cookie value in the request and directly returns the corresponding version of the static resource. This process eliminates the need to query the traffic splitting logic again, improving the speed and efficiency of resource loading.
[0038] In the above process, this embodiment of the invention achieves rapid resource location and efficient loading through multi-version resource caching of CDN nodes and a cookie-based static resource loading mechanism. This design not only reduces the number of times configuration files are repeatedly loaded, but also improves the CDN cache hit rate, further enhancing page loading performance and user experience. Simultaneously, the isolation and independence of resources ensure that different versions do not interfere with each other and operate stably.
[0039] Step 140: During the A / B test, the operation management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The latest configuration file is then read and the traffic is split through Lua scripts on the Nginx server.
[0040] In one possible implementation, the traffic splitting ratio is dynamically adjusted based on real-time data through the operations management system, and the new configuration is synchronized to the Nginx server in real time. The latest rules are then automatically loaded on the next run via Lua scripts on the Nginx server.
[0041] Specifically, during A / B testing, the operations management system continuously monitors and analyzes real-time data, including user traffic, traffic splitting ratios, and functional module usage. This data provides strong support for the dynamic adjustment of traffic splitting ratios. Based on the real-time data analysis results, the operations management system dynamically adjusts the traffic splitting ratios and synchronizes the new configurations to the Nginx server in real time. The Lua scripts on the Nginx server automatically load the latest rules on the next run, ensuring the real-time performance and accuracy of the traffic splitting logic.
[0042] In the above process, this embodiment of the invention achieves dynamic adjustment of the traffic splitting ratio through a real-time data monitoring and analysis mechanism. This design not only improves the flexibility and adaptability of the traffic splitting process but also ensures continuous optimization and improvement of the traffic splitting effect. Simultaneously, the real-time synchronization of the new configuration and the automatic loading mechanism of Lua scripts also ensure the real-time updating and accurate execution of the traffic splitting logic.
[0043] Specifically, the business operations management system is used to update the AB configuration of channel function deployment and synchronize it to the channel operations system; the channel operations system is used to generate multi-version configuration files for functions based on the configuration and store them on the mounting disk; the CD is used to synchronize the multi-version configuration files for functions to the channel assembly application; and the Lua script is used to read the multi-version configuration files for functions in real time for AB distribution.
[0044] Through the above process, this embodiment of the invention achieves efficient, flexible, and user-unobtrusive front-end page traffic splitting via four core steps: experimental parameter configuration and synchronization, access request processing and traffic splitting, CDN resource caching and loading, and dynamic traffic splitting ratio adjustment. This method not only significantly improves page loading performance and user experience but also reduces development and maintenance costs, and enhances system stability and scalability. Simultaneously, the dynamic traffic splitting ratio adjustment mechanism ensures continuous optimization and improvement of the traffic splitting effect, providing strong support for the iteration of front-end business functions and A / B testing.
[0045] In one application scenario, the front-end page splitting method of the present invention is used to split the front-end page traffic.
[0046] like Figure 2 As shown, the following steps may be included: Step S1: Query the traffic splitting route configuration.
[0047] Specifically, when testing a new feature (such as a new product recommendation algorithm display page) on the front-end module of an e-commerce platform, the system first enters the stage of querying traffic routing configuration after startup. The platform's operations and maintenance personnel have pre-set relevant experimental parameters in the operations management system, and the system begins to query this traffic routing configuration information.
[0048] Furthermore, this configuration information includes the experiment's effective time, traffic splitting ratio, and functional module version identifiers, providing a basis for subsequent traffic splitting operations. This embodiment of the invention clarifies the source and basis of the traffic splitting rules by querying the traffic splitting route configuration, preparing for accurate traffic splitting.
[0049] Step S2: Determine if the current front-end module has a routing configuration.
[0050] Specifically, after querying the routing configuration, the system checks if the corresponding routing configuration exists in the current front-end module. If it does not exist, it directly accesses the original module's resources; if it exists, it proceeds to the next step.
[0051] Furthermore, this step is to determine whether special traffic routing is needed for the current front-end module's access requests. This embodiment of the invention avoids unnecessary traffic routing operations and improves system efficiency by determining whether the current front-end module has routing configuration.
[0052] Step S3: Determine whether AB splitting is configured.
[0053] Specifically, once it is determined that the current front-end module has routing configuration, the system further determines whether A / B routing is configured. If not, the system directly accesses the resources of the original module; if so, it proceeds to the next step.
[0054] Furthermore, A / B traffic splitting is a crucial setting for testing new features. This determination determines whether traffic allocation needs to be performed according to A / B testing rules. This embodiment of the invention precisely controls whether the A / B testing process is initiated by determining whether A / B traffic splitting is configured.
[0055] Step S4: Determine whether the whitelist of experimental groups AB is matched.
[0056] Specifically, if A / B splitting is configured, the system then determines whether the current user matches the A / B experimental group whitelist. If not, A / B splitting is performed based on the last digit of the user's ID; if the user matches, the processing is carried out according to the rules set in the whitelist.
[0057] Furthermore, the A / B testing group whitelist is used for targeted testing of specific users, ensuring the relevance and accuracy of the testing. This embodiment of the invention achieves precise testing of specific users by determining whether the test matches the A / B testing group whitelist, thus improving testing effectiveness.
[0058] Step S5: Perform A / B splitting based on the last digit of the user number.
[0059] Specifically, when a user is not on the AB test group whitelist, the system performs AB routing based on the last digit of the user's ID according to a preset routing ratio. For example, if the routing ratio is set to 50%, users with odd-numbered last digits will be assigned to the new feature version module, and users with even-numbered last digits will be assigned to the original feature version module.
[0060] Furthermore, this traffic splitting method is simple and fair, and can reasonably allocate traffic. This embodiment of the invention achieves reasonable traffic allocation by performing A / B splitting based on the last digit of the user's ID, providing effective data support for new feature testing.
[0061] Step S6: Determine whether the AB result is the original module.
[0062] Specifically, after the traffic split is completed, the system determines whether the result of the AB split is the original module. If it is, the original module's resources are accessed directly; otherwise, the system proceeds to the next step.
[0063] Furthermore, this step is to determine whether the user ultimately accesses the original module or the new functional module. This embodiment of the invention clarifies the user's access path by determining whether the A / B test result is for the original module, ensuring that the user can correctly access the corresponding module.
[0064] Step S7: Determine if the target resource path exists.
[0065] Specifically, when the AB splitting result is not the original module, the system checks if the target resource path exists. If it exists, the target module resource is accessed; if it does not exist, an error message is returned or other processing is performed.
[0066] Furthermore, this step ensures that users can access valid resources and avoids errors indicating that resources do not exist. By determining whether the target resource path exists, this embodiment of the invention guarantees the accuracy and stability of user access, thereby improving the user experience.
[0067] Through the above process, this embodiment of the invention uses the testing of new features in the front-end module of an e-commerce platform as an application scenario to elaborate on the implementation process of the front-end page traffic splitting method. Starting with querying the traffic splitting route configuration, the process sequentially proceeds through steps such as determining whether the current front-end module has a route configuration, whether AB traffic splitting is configured, and whether it hits the AB experimental group whitelist, performing corresponding processing based on different situations. After determining that AB traffic splitting is necessary, traffic is split based on the last digit of the user's ID, and the splitting result and target resource path are further judged to ultimately determine the module resource accessed by the user. Through this series of steps, precise traffic allocation for new feature testing is achieved, ensuring the accuracy and effectiveness of the testing, while also guaranteeing the stability and good experience of user access, reducing development and maintenance costs, and improving the overall performance and scalability of the system.
[0068] In another application scenario, such as Figure 3 As shown, in online lending platforms within the fintech sector, there is a need to display different loan product pages (such as / loan for ordinary users, / loan-a for high-quality users, and / loan-b for users in specific industries) to different user groups in order to achieve precise marketing and functional testing.
[0069] The business operations management system pre-synchronizes the feature configuration information for channel deployment to the channel operations system, generating multi-version feature configurations. The design table of the traffic distribution configuration file is shown in Table 1 below. This configuration is stored on the mounted disk, and the CD component reads this configuration file. After reading the AB configuration data, the multi-version feature routing module in Nginx determines the directory based on the configuration. When a user initiates an access request, Nginx directs the request to the corresponding traffic distribution target resource according to the configuration, such as directing ordinary user requests to / loan and premium user requests to / loan-a, etc. At the same time, the multi-version feature configuration is synchronized to the Nginx server to ensure that the traffic distribution logic is updated in real time.
[0070] Table 1. Split Configuration File Design Table
[0071] Through the above process, this embodiment of the invention uses a fintech loan business platform as a scenario to illustrate the application of a front-end page traffic distribution method. Through the collaborative work of the business operation management system, channel operation system, CD component, and Nginx, the generation, reading, and synchronization of multi-version configurations for various functions are achieved. Nginx accurately distributes user access requests based on the configuration, directing them to different loan product pages. This method meets the personalized display needs of different user groups, achieves precise marketing and functional testing, improves user experience, and simultaneously ensures the system's flexibility and scalability, while reducing development and maintenance costs.
[0072] The following are embodiments of the apparatus of the present invention, which can be used to execute the front-end page traffic splitting method involved in the present invention. For details not disclosed in the embodiments of the apparatus of the present invention, please refer to the method embodiments of the front-end page traffic splitting method involved in the present invention.
[0073] Please see Figure 4 This invention provides a front-end page traffic splitting device 800.
[0074] The front-end page traffic splitting device 800 includes, but is not limited to: a configuration experimental parameter module 810, a Lua script traffic splitting processing module 830, a CDN resource dynamic loading module 850, and a real-time adjustment traffic splitting strategy module 870.
[0075] Among them, the configuration experiment parameter module 810 is used to obtain experiment parameters, configure experiment parameters in the operation management system, obtain multi-version configuration files for functions, and synchronize them to the Nginx server through a synchronization tool; the experiment parameters include the experiment effective time, traffic splitting ratio, and function module version identifier.
[0076] The Lua script routing module 830 is used to read the multi-version configuration file of the function by Lua scripts deployed on the Nginx server when the access request arrives. It combines the information in the access request with the preset routing logic to obtain the routing result and write it to the client cookie.
[0077] The CDN resource dynamic loading module 850 is used to cache multiple versions of HTML files and corresponding CSS and JS resources based on the traffic distribution results through CDN. When the access request arrives at the Nginx server again, the corresponding version of static resources is loaded through CDN based on cookies.
[0078] The real-time traffic splitting strategy module 870 is used to dynamically adjust the traffic splitting ratio based on real-time data through the operation and management system during A / B testing, and synchronize the new configuration to the Nginx server in real time. The latest configuration file is read and traffic is split through Lua scripts on the Nginx server.
[0079] It should be noted that the front-end page splitting provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the front-end page splitting device will be divided into different functional modules to complete all or part of the functions described above.
[0080] Furthermore, the front-end page splitting device and the front-end page splitting method provided in the above embodiments belong to the same concept. The specific way in which each module performs its operation has been described in detail in the method embodiments, and will not be repeated here.
[0081] Figure 5 A schematic diagram of the structure of an electronic device according to an exemplary embodiment is shown.
[0082] It should be noted that this electronic device is merely an example adapted to the present invention and should not be construed as providing any limitation on the scope of use of the present invention. Furthermore, this electronic device should not be interpreted as requiring or depending on having... Figure 5 One or more components of the exemplary electronic device 2000 shown.
[0083] The hardware structure of electronic devices 2000 can vary significantly due to differences in configuration or performance, such as... Figure 5 As shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0084] Specifically, power supply 210 is used to provide operating voltage for various hardware devices on electronic device 2000.
[0085] Interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted to this invention, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 5 As shown, this does not constitute a specific limitation.
[0086] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0087] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the electronic device 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0088] Application 253 is a computer-readable instruction based on operating system 251 that performs at least one specific task, and may include at least one module ( Figure 5 (Not shown), each module may contain computer-readable instructions for the electronic device 2000. For example, the front-end page routing device can be considered as application 253 deployed on the electronic device 2000.
[0089] Data 255 may be signal information, etc., and is stored in memory 250.
[0090] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby performing operations and processing on massive amounts of data 255 stored in the memory 250. For example, the front-end page routing method can be implemented by the central processing unit 270 reading a series of computer-readable instructions stored in the memory 250.
[0091] Furthermore, the present invention can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of the present invention is not limited to any specific hardware circuit, software, or combination thereof.
[0092] Please see Figure 6This invention provides an electronic device 2000, which may include: a desktop computer, a laptop computer, a server, etc., with sensor recognition capabilities.
[0093] exist Figure 6 In this context, the electronic device 2000 includes at least one processor 4001 and at least one memory 250.
[0094] The data interaction between the processor 4001 and the memory 250 can be achieved through at least one communication bus 4002. This communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 250. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0095] Optionally, the electronic device 2000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 2000 does not constitute a limitation on the embodiments of the present invention.
[0096] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. Processor 4001 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0097] The memory 250 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program instructions or code in the form of instructions or data structures and accessible by the electronic device 2000, but not limited thereto.
[0098] The memory 250 stores computer-readable instructions, and the processor 4001 can read the computer-readable instructions stored in the memory 250 through the communication bus 4002.
[0099] The computer-readable instructions are executed by one or more processors 4001 to implement the front-end page offloading method in the above embodiments.
[0100] Furthermore, this embodiment of the invention provides a storage medium storing computer-readable instructions, which are executed by one or more processors to implement the front-end page traffic splitting method described above.
[0101] This invention provides a computer program product, which includes computer-readable instructions stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, thereby enabling the electronic device to implement the front-end page routing method as described above.
[0102] Compared with related technologies, the beneficial effects of the present invention are: 1. This invention can accurately achieve front-end page traffic distribution; by configuring experimental parameters through the operation management system to generate multi-version configuration files, the Lua script on the Nginx server, based on the configuration file and access request information, accurately directs user requests to different functional module versions according to the preset traffic distribution logic, thus meeting diverse business testing and display needs.
[0103] 2. This invention features high-efficiency resource loading performance; by using CDN to cache multiple versions of HTML files and corresponding CSS and JS resources based on the traffic distribution results, when a user visits again, CDN can directly load the corresponding version of static resources based on cookies, reducing the number of times configuration files are repeatedly loaded, improving cache hit rate, and speeding up page loading.
[0104] 3. This invention enables dynamic and flexible traffic splitting adjustments; the operation management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The Lua script automatically loads the latest rules during runtime, allowing for rapid response to business changes without code modification and adapting to testing needs at different stages.
[0105] 4. This invention can reduce development and maintenance costs; by managing the traffic distribution logic through backend configuration files, it avoids hardcoding traffic distribution rules in the frontend code, reducing code complexity and maintenance workload, while simplifying the AB testing deployment and decommissioning process, making development and maintenance more convenient and efficient.
[0106] 5. This invention can improve user experience; by reducing additional requests before page rendering, avoiding page blanking caused by client redirection, and accurately displaying corresponding functional module pages according to user characteristics, users can access the content they need more smoothly and quickly, thus enhancing the user experience on the platform.
[0107] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0108] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A front-end page traffic splitting method, characterized in that, The method includes: Obtain the experimental parameters, configure the experimental parameters in the operation management system, obtain the multi-version configuration file, and synchronize it to the Nginx server through a synchronization tool; the experimental parameters include the experimental effective time, traffic splitting ratio, and functional module version identifier. When an access request arrives at the Nginx server, the Lua script deployed on the Nginx server reads the multi-version configuration file of the function, combines it with the information in the access request, obtains the routing result according to the preset routing logic, and writes it to the client cookie. The CDN caches multiple versions of HTML files and corresponding CSS and JS resources based on the traffic distribution results. When the access request arrives at the Nginx server again, the CDN loads the corresponding version of static resources based on cookies. During the A / B testing process, the operation and management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The latest configuration file is then read and the traffic is split through Lua scripts on the Nginx server.
2. The front-end page traffic splitting method as described in claim 1, characterized in that, The experimental parameters are configured in the operation management system to obtain a multi-version configuration file, including: Configure the experimental parameters within the operation and management system, and generate a structured multi-version configuration file based on the experimental parameters; the multi-version configuration file includes redirection rules, experimental time range, and user traffic splitting conditions.
3. The front-end page traffic splitting method as described in claim 1, characterized in that, The synchronization to the Nginx server via a synchronization tool includes: An automated synchronization tool is used to push the multi-version configuration file of the aforementioned function to a specified directory on the Nginx server, and the file is dynamically loaded at runtime by a Lua script on the Nginx server; the synchronization tool includes a CD script and a configuration center.
4. The front-end page traffic splitting method as described in claim 1, characterized in that, The process of reading the multi-version configuration file of the function through a Lua script deployed on the Nginx server, and obtaining the traffic splitting result according to the preset traffic splitting logic based on the information in the access request, includes: When an access request arrives at the Nginx server, the user's last four digits are extracted from the access request's cookie using a Lua script deployed on the Nginx server, and the synchronized configuration file is read simultaneously. Based on the user traffic splitting condition field in the configuration, determine whether the user corresponding to the access request belongs to the experimental traffic splitting range. If they match, further determine the target version module based on the traffic splitting identifier and functional module version identifier fields, and generate the traffic splitting result.
5. The front-end page traffic splitting method as described in claim 1, characterized in that, The writing of the client cookie includes: On the server side, a Lua script deployed on the Nginx server writes the traffic splitting result to the client's cookie, while modifying the Nginx server's response header and accessing the corresponding version's functional module URL by rewriting the URI.
6. The front-end page traffic splitting method as described in claim 1, characterized in that, The method of caching multiple versions of HTML files and corresponding CSS and JS resources via CDN based on the traffic distribution results, and loading the corresponding version of static resources via CDN based on cookies when the access request arrives at the Nginx server again, includes: The CDN nodes differentiate versions based on the cookie value in the access request, cache different versions of HTML files and their associated CSS and JS resources, and when the access request reaches the Nginx server again, the corresponding version of static resources is directly returned through the CDN.
7. The front-end page traffic splitting method as described in claim 1, characterized in that, During the A / B testing process, the operation management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The system then uses Lua scripts on the Nginx server to read the latest configuration file and perform traffic splitting, including: The operation and management system dynamically adjusts the traffic splitting ratio based on real-time data and synchronizes the new configuration to the Nginx server in real time. The latest rules are automatically loaded on the next run via Lua scripts on the Nginx server.
8. A front-end page traffic distribution device, characterized in that, The device includes: The experiment parameter configuration module is used to obtain experiment parameters, configure the experiment parameters in the operation management system, obtain a multi-version configuration file, and synchronize it to the Nginx server through a synchronization tool; the experiment parameters include the experiment effective time, traffic splitting ratio, and function module version identifier. The Lua script routing module is used to read the multi-version configuration file of the function by Lua scripts deployed on the Nginx server when the access request arrives. It combines the information in the access request with the preset routing logic to obtain the routing result and write it to the client cookie. The CDN resource dynamic loading module is used to cache multiple versions of HTML files and corresponding CSS and JS resources through CDN according to the traffic distribution result. When the access request arrives at the Nginx server again, the corresponding version of static resources is loaded through CDN according to the cookie. The real-time traffic splitting strategy module is used to dynamically adjust the traffic splitting ratio based on real-time data through the operation and management system during A / B testing, and synchronize the new configuration to the Nginx server in real time. The latest configuration file is read and traffic is split through Lua scripts on the Nginx server.
9. An electronic device, characterized in that, include: At least one processor and at least one memory, wherein, The memory stores computer-readable instructions; The computer-readable instructions are executed by one or more of the processors, causing the electronic device to implement the front-end page offloading method as described in any one of claims 1 to 7.
10. A storage medium having computer-readable instructions stored thereon, characterized in that, The computer-readable instructions are executed by one or more processors to implement the front-end page offloading method as described in any one of claims 1 to 7.