A private domain e-commerce platform consumption discount right and interest automatic control CDN cache method
By adopting the automated CDN caching solution of Node service on the private domain e-commerce platform, the problem of service crash under high concurrency and large traffic was solved, the automated management of activity pages was realized, and the user experience and system stability were improved.
Patent Information
- Application Number
- CN202310830952.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-07-07
AI Technical Summary
In the H5 activity pages of private B2C e-commerce platforms, high concurrency and large traffic lead to service crashes and poor user experience. Existing technologies rely on manually modifying Nginx configuration files to manage CDN caches, resulting in frequent and error-prone configurations, which affects the rapid switching of activity pages.
Node service is used to provide an automated control CDN cache solution. Operations personnel configure activity information and time, combined with regional traffic data analysis, and use Worker tasks to automatically render HTML and set cache time to achieve automatic caching and clearing of activity pages.
The event page is automatically cached before it starts and the CDN cache is automatically cleared after it ends, reducing manual maintenance time, ensuring that users see the latest information, improving user experience and reducing server pressure.
Smart Images

Figure CN116881589B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of e-commerce, and in particular to a method for automatically controlling CDN caching of consumer discount benefits on a private domain e-commerce platform. Background Art
[0002] The "Decoration Operation Platform," part of the private B2C e-commerce operation platform, provides the ability to build and operate H5 event pages. These pages include a "Consumer Discount Benefits" page, a City A Consumer Discount Benefits page, and a City B Consumer Discount Benefits page for regionally restricted events. Operators create these pages, configure them with different event information and coupons, and then publish them within the mini-program for regular users to purchase.
[0003] Because we offer flash sales, we face high concurrency and heavy traffic. During promotional periods, excessive traffic can cause service crashes or lags, resulting in business losses and a poor user experience. A common industry practice is to place promotional pages on a CDN and configure an expiration time on the server's Nginx to manage the page's validity period.
[0004] Currently, we modify the Nginx configuration file to support the CDN cache time for each "Consumer Discount Benefits Grab Event Page." Because each event page has different promotional strengths and audiences, configuring each page would require numerous configuration items, and the configuration would become fixed. Once an event ends, we need to manually modify the configuration file to reduce the CDN cache time or shut down the CDN and restart the server so that the next event information can take effect quickly after the current event page ends.
[0005] As the number of activity pages increases and the activity cycles vary across regions, we have to modify machine configurations more frequently, which in turn increases the chances of restarts and human errors. Furthermore, the next activity on that page can't take effect quickly after the current activity ends. Summary of the Invention
[0006] The present invention provides a method for automatically controlling CDN caching for consumer discount benefits on a private domain e-commerce platform. Based on the page technology provided by the Node service, a solution for automatically controlling CDN caching in rush-buy page scenarios is created.
[0007] The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0008] The present invention provides a method for automatically controlling CDN caching of consumer discount benefits on a private domain e-commerce platform, comprising:
[0009] S1. The operator creates a page for the rush purchase area through the "Decoration Operation Platform" system, configures the activity information corresponding to the area (including consumption coupons) on the page, and sets the start and end time of the activity;
[0010] S2. System managers analyze the warm-up and post-retention time of intervention activities through regional traffic data;
[0011] S3. When the operator puts the configured activity page into the terminal channel, when a user visits a certain activity (a fixed URL such as https: / / xx.xx.com / h5 / xfq-chengdu.html), the page will first return to the CDN node to search for the current activity page. If there is unexpired cached data, the page content will be immediately responded to the user;
[0012] S4. If the CDN does not cache the data, it returns it to the application service. After querying the page data and rendering the HTML, the application service parses the activity information and calculates the required cache time for the activity page using a formula. After setting the required cache time, it responds to the user.
[0013] S5. If there is no user access, to prevent a sudden influx of users from causing CDN back-to-origin and service unavailability, the Worker automatic task automatically scans the active data in the system every 5 minutes, actively renders HTML, sets the effective buffer time, and pushes it to the CDN server.
[0014] Preferably, the Koa framework is used to automate data processing of the cache device and build a Node universal rendering service, and the routing, HTTP universal package, function universal package, template rendering engine and other capabilities in the framework are used.
[0015] Preferably, the CDN automatically returns to the source when the user accesses the site:
[0016] 1A. Through the routing service router.get(' / h5 / :activity.html',async(ctx)=>{...dosomeing}) we query the CMS content configuration data through the :activity in the URL;
[0017] 1B. Render the HTML structure of the current page from floor to module through the koa-art-template template, and build in the consumption voucher activity (coupon Json data) to get a complete HTML page;
[0018] 1C. Parse the details of the activity on the current page, read the start and end times of the activity, and then call the manual intervention data of the configuration platform to find the activity preheating time and activity post-time of the current activity (:activity);
[0019] 1D. If the current time of the user's visit is before the activity start time minus the "warm-up time" or after the end time plus the post-time, set ctx.set('Cache-Control', `max-age=0`) through the Koa ExtendableContext context object to set the cache time to zero;
[0020] 1E. If the user's current access time is between the preheating time and the post-processing time, the cache time = ("preheating time" + "activity time" + "post-processing time") - ("current time" - "preheating time"). This formula is used to set the preheating time before responding to the complete HTML content to the CDN, and then responding to the browser.
[0021] Preferably, the process of Node Worker automatic task scanning is:
[0022] 2A. When the service starts, a scheduled task device is created to periodically scan the list of valid active pages in the CMS system.
[0023] 2B. Assemble a fixed URL of https: / / xx.xx.com / h5 / xfq-xxx.html using the activity information found.
[0024] 2C. Render a complete page using the activity details and the current page content using steps 1B. Then, set the Cache-Control duration in the Response using steps 1D and 1E.
[0025] 2D. Push the page content with the URL https: / / xx.xx.com / h5 / xfq-xxx.html to the CDN operator.
[0026] Preferably, the cache time setting method is:
[0027] 1) Before the activity warm-up time, preventive operations that do not cache pages temporarily adjust activity data to prevent data leakage;
[0028] 2) After the current time enters the warm-up time, the cache time that should be set at the current time point is automatically calculated; as time passes, the cache time set for the response will be shortened;
[0029] 3) When accessing the page at the current time, the activity on the page has ended and the CDN cache needs to be cleared to ensure that the next activity configuration can take effect immediately.
[0030] The beneficial effects of the present invention are: the rush purchase page can automatically hit the CDN cache before the event starts, and the CDN cache is automatically cleared after the event ends. At the same time, it solves the problem that the next activity configured after the end of the previous activity can quickly preview the effect of the activity (without cache) and confirm the accuracy of the activity. It ensures that the next activity will not cause users to not see the latest activity information due to the long CDN cache time of the previous activity or too late manual maintenance. The present invention reduces the time cost of manually maintaining the CDN when the system supports rush purchase pages in more regions. At the same time, the automatic push of Worker tasks can better improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a system data flow structure diagram of the present invention.
[0032] Figure 2 It is a data processing flow chart of the automatic cache device of the present invention.
[0033] Figure 3 It is a schematic diagram of the cache time setting algorithm of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0035] Figure 1 This is the system data flow structure diagram of this embodiment. The solution design of the present invention is to build a set of mechanisms for automatically processing CDN cache, design the system management capability of "grab the active page CDN manual intervention service", and at the same time, by adding "automatic cache time calculation setting processing device", it can automatically calculate the reliable cache time that can be set for the "active page" at the current time point according to the page activity content. And provide a "Node Worker timing task device" that can automatically calculate the cache time that should be set for the current time activity according to the manual intervention results of the "active page" or the changes in the page activity operation content, and actively push it to the CDN server. It can effectively ensure that the data obtained by users from the CDN is valid and real-time. It reduces the pressure on large concurrent application servers and reduces the cost of servers.
[0036] 1) The operator creates a rush purchase area page through the "Decoration Operation Platform" system, configures the corresponding activity information (including consumption coupons) for the area on the page, and sets the start and end time of the activity.
[0037] 2) System managers analyze the warm-up and post-retention time of intervention activities through regional traffic data.
[0038] 3) When the operator puts the configured activity page into the terminal channel, when the user visits a certain activity (a fixed URL such as: https: / / xx.xx.com / h5 / xfq-chengdu.html), the page will first return to the CDN node to search for the current activity page. If there is unexpired cached data, the page content will be immediately responded to the user.
[0039] 4) If the CDN does not cache the data, it returns to the application service. After the application service queries the page data and renders the HTML, it will parse the activity information and use a formula to calculate the required cache time for the activity page. After setting it, it responds to the user.
[0040] 5) If there are no users accessing the site, to prevent a sudden influx of users from causing CDN back-to-origin service unavailability, the Worker automatic task automatically scans the active data in the system every 5 minutes, actively renders HTML, sets an effective buffer time, and pushes it to the CDN server.
[0041] Figure 2 This is a data processing flow chart for the automated caching device of the present invention. The Koa framework is used to build the Node universal rendering service, utilizing the framework's routing, HTTP universal package, function universal package, template rendering engine, and other capabilities.
[0042] MB: indicates the preheating time before the event starts. System administrators follow up on the activity intensity and traffic estimates and intervene in advance to set the default setting to 30 minutes before the event starts.
[0043] MA: Indicates that the post-time related to the end of the event is set to a positive number n (CDN retains n minutes after the end of the event), and set to a negative number (CDN cache is not set n minutes before the end of the event).
[0044] S: Activity start time.
[0045] E: Event end time.
[0046] 1) The user visits the (xx consumption voucher page) and causes the CDN to actively return to the source.
[0047] a) Through the routing service router.get(' / h5 / :activity.html',async(ctx)=>{...dosomeing}) we query the CMS content configuration data through the :activity in the URL.
[0048] b) Render the HTML structure of the current page from floor to module through the koa-art-template template, and build in the consumption voucher activity (coupon Json data) to get a complete HTML page.
[0049] c) Analyze the activity details on the current page and read the activity's start and end times. Then, use the manual intervention data from the configuration platform to find the activity's pre-heat time and post-activity time.
[0050] d) If the current time of the user's visit is before the activity start time minus the "warm-up time" or after the end time plus the post-time, set ctx.set('Cache-Control', `max-age=0`) through Koa's ExtendableContext context object; set the cache age to zero.
[0051] e) If the user's current access time is between the preheating time and the post-processing time, the cache time = ("preheating time" + "activity time" + "post-processing time") - ("current time" - "preheating time"). After setting the preheating time, the complete HTML content is responded to the CDN, and then responded to the browser.
[0052] 2) Node Worker automatic task scanning process
[0053] a) When the service starts, a scheduled task device is created to periodically scan the list of valid active pages in the CMS system.
[0054] b) Assemble a fixed URL of https: / / xx.xx.com / h5 / xfq-xxx.html using the activity information found.
[0055] c) Render a complete page using the activity details and the current page content using step b) in 1), and then set the Cache-Control cache duration in the Response using steps d) and e) in 1).
[0056] d) Push the page content with the URL https: / / xx.xx.com / h5 / xfq-xxx.html to the CDN operator.
[0057] Figure 3 This is a schematic diagram of the cache time setting algorithm of the present invention. This algorithm reasonably sets the CDN time based on the promotion activity cycle to achieve the effect of automatically controlling the CDN page expiration cleanup and cache.
[0058] 1) Before the activity warm-up time, we do not cache pages to prevent operations from temporarily adjusting activity data to prevent data leakage.
[0059] 2) After the current time enters the warm-up period, the cache time that should be set at the current time point is automatically calculated. As time passes, the cache time set for the response will be shortened.
[0060] 3) When accessing the page at the current time, the activity on the page has ended and the CDN cache needs to be cleared to ensure that the next activity configuration can take effect immediately.
[0061] Glossary of technical terms
[0062] Decoration operation platform: provides content management based on data services; can build, decorate and operate activity pages and publish them to the outside world.
[0063] Nginx: A high-performance HTTP and reverse proxy web server that also provides IMAP / POP3 / SMTP services.
[0064] Node: is a server-side JavaScript interpreter that can be used to build highly scalable applications.
[0065] Koa: The next generation web development framework based on the Node.js platform
[0066] Art-Template: A framework for rendering HTML nodes written in JavaScript based on the browser rendering engine
[0067] SSR: A technology that supports the rapid display of page content and web crawler search by rendering an HTML node through a remote server
[0068] CDN: A distributed content distribution service built on a data network that enables visitors to directly obtain data through the nearest network node, reducing the need for data content to be distributed and processed by the original server, thereby increasing the speed at which users access content and reducing the pressure on the original server.
Claims
1. A method for automatically controlling CDN caching for consumer discount benefits on a private domain e-commerce platform, characterized in that: include: S1. The operator creates a page for the rush sale area through the "Decoration Operation Platform" system, configures the activity information corresponding to the area on the page, and sets the start and end time of the activity; S2. System managers analyze the warm-up time and post-retention time of intervention activities through regional traffic data; S3. When operators deploy the configured activity page to the terminal channel, when a user accesses an activity, the page will first go to the CDN node to search for the current activity page. If there is unexpired cached data, the page content will be immediately responded to the user. S4. If the CDN does not cache the data, it returns the data to the application service. After querying the page data and rendering the HTML, the application service will parse the activity information, calculate the cache time required for the activity page through a formula, and respond to the user after setting it. If the current time of the user's access is before the activity start time minus the "preheating time" or after the end time plus the post-time, set ctx.set('Cache-Control','max-age=0') through the Koa ExtendableContext context object to set the cache time to zero. If the current time of the user's access is between the preheating time and the post-time, the cache time = ("preheating time" + "activity time" + "post-time") - ("current time point" - "preheating time point"), and after setting the cache time through this formula, respond to the complete HTML content to the CDN, and then respond to the browser. S5. If there are no users accessing the site, to prevent a sudden influx of users from causing CDN back-to-origin service unavailability, the Worker automatic task automatically scans the active data in the system every 5 minutes, actively renders HTML, and sets an effective buffer time to push it to the CDN server.
2. The method for automatically controlling CDN caching for consumer discount benefits on a private domain e-commerce platform according to claim 1 is characterized by: The Koa framework is used to automate data processing of cache devices and build a Node universal rendering service, which utilizes the framework's routing, HTTP universal package, function universal package, template rendering engine and other capabilities.
3. The method for automatically controlling CDN caching of consumer discount benefits on private domain e-commerce platforms according to claim 1 or 2 is characterized in that: The process of CDN actively returning to the source due to user access: 1A. Use the routing service router.get(' / h5 / :activity.html',async(ctx)=>{...dosomeing}) to query the CMS content configuration data through the :activity in the URL; 1B. Render the HTML structure of the current page from floor to module through the koa-art-template template. And built-in consumption voucher activities to get a complete HTML page; 1C. Analyze the details of the activity on the current page and read out the start and end time of the activity. Then call the manual intervention data of the configuration platform to find the activity warm-up time and activity post-time of the current activity; 1D. If the current time of the user's visit is before the activity start time minus the "warm-up time" or after the end time plus the post-time, set ctx.set('Cache-Control','max-age=0') through the Koa ExtendableContext context object to set the cache time to zero; 1E. If the user's access time is between the preheating time and the post-processing time, the cache time = ("preheating time" + "activity time" + "post-processing time") - ("current time" - "preheating time"). After setting the cache time using this formula, the complete HTML content is sent to the CDN, and then the response is sent to the browser.
4. The method for automatically controlling CDN cache for consumer discount benefits on private domain e-commerce platforms according to claim 3 is characterized in that: The process of Node Worker automatic task scanning is: 2A. When the service starts, a scheduled task device is created to periodically scan the list of valid active pages in the CMS system; 2B. Assemble a fixed URL of https: / / xx.xx.com / h5 / xfq-xxx.html based on the activity information found; 2C. Render a complete page using the steps in 1B using the activity details and the current page content. Then, follow steps 1D and 1E to set the Cache-Control cache duration in the Response. 2D. Push the page content with the URL https: / / xx.xx.com / h5 / xfq-xxx.html to the CDN operator.
5. The method for automatically controlling CDN cache for consumer discount benefits on private domain e-commerce platforms according to claim 1 is characterized in that: The cache time setting method is: 1) Do not perform page caching before the activity warm-up period to prevent data leakage; 2) After the current time enters the warm-up time, the cache time that should be set at the current time point is automatically calculated; Over time, the cache time of the response settings will decrease; 3) When accessing the page at the current time, the activity on the page has ended and the CDN cache needs to be cleared to ensure that the next activity configuration can take effect immediately.
Citation Information
Patent Citations
Page pseudo-static processing method and apparatus
CN107305576A
Data caching method and device, storage medium and electronic equipment
CN112711730A