Service updating method and device, computer equipment and storage medium
By configuring plug-in managers and business flow plug-ins in CDN edge nodes, and using static compilation languages and coroutine managers to optimize resource usage, the complexity and interruption risks of CDN service updates are solved, unaware and efficient updates are achieved, and service processing performance is improved.
Patent Information
- Application Number
- CN202510742949.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-06-05
AI Technical Summary
The existing CDN service update mechanism has problems such as high complexity, high risk of service interruption, and serious resource waste and performance impact.
By configuring the plug-in manager and business flow plug-in at the edge node, the plug-in manager uses a static compilation language to detect and update the business flow plug-in, only the business flow plug-in is updated without affecting other functional modules, and the coroutine manager and event scheduler are used to optimize resource usage.
It realizes unconscious service updates, reduces resource usage, improves update speed and processing performance, and ensures that the user experience is not affected.
Smart Images

Figure CN120281649A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular, to a service update method, apparatus, computer device, and storage medium. Background Art
[0002] With the development of Internet technology, users' demand for quickly and stably accessing website content continues to grow, and website operators' urgent need to reduce server load, save bandwidth costs, and improve user experience has led to the wide application of CDN (Content Delivery Network).
[0003] As a bridge between users and websites, CDN undertakes more and more requirements, such as user access authentication, IP blocking, response content modification, etc.
[0004] When customers propose new functional requirements, it is necessary to upgrade or update the CDN service, resulting in a significant increase in the operation and maintenance complexity and service interruption risk of CDN. However, there are certain limitations in the current CDN service update mechanism. Therefore, how to achieve efficient and reliable CDN service update has become an urgent problem to be solved. Summary of the Invention
[0005] Based on this, it is necessary to provide an efficient and reliable service update method, apparatus, computer device, and storage medium for the above technical problems.
[0006] This application provides a service update method, which is applied to an edge node in a content delivery network. The edge node is at least configured with a plugin manager and at least one service flow plugin; the method includes:
[0007] Detect the service flow plugin through the plugin manager and obtain a detection result; the service flow plugin is used to provide content delivery network services.
[0008] In the case where the detection result indicates that there is an update, load the updated service flow plugin through the plugin manager; the updated service flow plugin is used to provide updated content delivery network services.
[0009] In one embodiment, the edge node is further configured with a coroutine manager, and the coroutine manager is used to create coroutines in the user space of the edge node; wherein, the detecting the service flow plugin through the plugin manager and obtaining a detection result includes:
[0010] When the coroutine calls the plugin manager, detect the service flow plugin through the plugin manager and obtain a detection result; and / or,
[0011] The plugin manager detects the business flow plugin according to a preset period and obtains the detection result.
[0012] In one embodiment, the edge node stores a plugin library for storing the business flow plugin; wherein, the detecting the business flow plugin and obtaining the detection result includes:
[0013] Obtaining the latest version information of the business flow plugin from the plugin library;
[0014] In the case where the latest version information is different from the version information stored in the plugin manager, determining that the detection result is that there is an update;
[0015] In the case where the latest version information is the same as the version information stored in the plugin manager, determining that the detection result is that there is no update.
[0016] In one embodiment, the edge node is further configured with an event scheduler; wherein, before the coroutine calls the plugin manager, the method further includes:
[0017] Receiving a network request sent by the client through the event scheduler;
[0018] Calling the coroutine of the client through the coroutine manager;
[0019] Creating a task entity according to the network request through the coroutine of the client to call the plugin manager within the task entity.
[0020] In one embodiment, the edge node is further configured with an event scheduler for receiving a network request sent by the client; after loading the updated business flow plugin through the plugin manager, the method further includes:
[0021] Creating a business flow according to the network request through the updated business flow plugin, performing business processing within the business flow and generating a response result;
[0022] Sending the response result to the client through the event scheduler.
[0023] In one embodiment, the method further includes:
[0024] In the case of creating the business flow through the updated business flow plugin, incrementing the business flow count value of the updated business flow plugin by one;
[0025] In the case where the business flow processing is completed and the client disconnects from the edge node, decrementing the business flow count value of the updated business flow plugin by one; wherein,
[0026] When the number of service flow count values of the service flow plug-in is 0, recycle the service flow plug-in.
[0027] In one embodiment, the edge node is further configured with a network communication agent, and the performing service processing in the service flow and generating a response result includes:
[0028] When there is an interaction with the content delivery network in the service flow, send the network request to the event scheduler through the network communication agent;
[0029] Send the network request to the content delivery network through the event scheduler, and receive the response result sent by the content delivery network.
[0030] The present application provides a service update device, which is applied to an edge node in a content delivery network. The edge node is at least configured with a plug-in manager and at least one service flow plug-in; the device includes:
[0031] A detection module, configured to detect the service flow plug-in through the plug-in manager and obtain a detection result; the service flow plug-in is used to provide content delivery network services;
[0032] A loading module, configured to load the updated service flow plug-in through the plug-in manager when the detection result indicates that there is an update; the updated service flow plug-in is used to provide updated content delivery network services.
[0033] The present application provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the above method are implemented.
[0034] The present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0035] The above service update method, device, computer device, and storage medium are applied to edge nodes in a content delivery network. By configuring at least a plugin manager and at least one service flow plugin for the edge nodes, based on this, the edge node detects the service flow plugin through the plugin manager and obtains the detection result. In the case where the detection result indicates an update exists, the updated service flow plugin is loaded through the plugin manager. This method encapsulates the service-related business functions separately in the service flow plugin and other functions outside the service flow plugin. Based on this, in the scenario where the content delivery network service has an update or upgrade, by constructing and deploying the updated service flow plugin and loading the updated service flow plugin through the plugin manager, the update of the content delivery network is realized. Since other functions such as data reception and transmission and coroutine scheduling are relatively fixed and do not require frequent upgrades, updating the service flow plugin realizes the service update, greatly narrowing the update scope, reducing resource occupancy, and not requiring additional backup resources to be introduced, improving the service update speed and not affecting the service processing performance. In addition, this method detects the service flow plugin through the plugin manager, realizes the update detection of the service flow plugin, and in the case where an update of the service flow plugin is detected, loads the updated service flow plugin through the plugin manager. In this way, when the service is updated, newly established connections will use the updated service flow plugin, and existing long connection requests will still use the previous service flow plugin, so that the existing connections will not be affected by the service update, and the client will not perceive the service update, realizing seamless update and improving the usage experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 FIG. is an application environment diagram for service update using backup resources;
[0037] Figure 2 FIG. is another application environment diagram for service update using backup resources;
[0038] Figure 3 FIG. is yet another application environment diagram for service update using backup resources;
[0039] Figure 4 FIG. is an application environment diagram for service update using master-slave processes;
[0040] Figure 5 FIG. is an application environment diagram for the service update method in an embodiment;
[0041] Figure 6 FIG. is a schematic flowchart of the service update method in an embodiment;
[0042] Figure 7 FIG. is an application environment diagram for the service update method in another embodiment;
[0043] Figure 8 It is a schematic flowchart of a service update method in another embodiment;
[0044] Figure 9 It is a schematic flowchart of a service update method in yet another embodiment;
[0045] Figure 10 It is a structural block diagram of a service update device in an embodiment;
[0046] Figure 11 It is an internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0047] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] With the increasing demand of Internet users for fast and stable access to website content, as well as the pursuit of website operators to reduce server pressure, save bandwidth costs and improve user experience, more and more websites have started to use CDN acceleration. As a bridge between users and websites, CDN undertakes more and more requirements, such as user access authentication, IP blocking, response content modification, etc. When a customer submits a new requirement, new functions need to be added to the CDN, which will lead to frequent upgrades of the CDN service. In order to avoid the impact of frequent service updates on user access, the related technologies mainly update the content distribution network service through the following three methods.
[0049] Method 1: Introduce backup resources, such as Figures 1 to 3 As shown, when performing a CDN service update, the original request is transferred through the CDN service proxy to the CDN standby service node or other service nodes in the cluster. After the service update is completed, the CDN service proxy then switches the user request back from the CDN standby service node. This method has the following disadvantages: If a dedicated standby machine is used to take over the service during online machine upgrades, there will be resource waste, and it will be idle most of the time. If a cluster is not built with standby machines to handle requests, when one machine in the cluster is upgraded, other machines will share the requests, which will cause the service pressure of other machines to rise, and other machines may not have local caches of request resources, and the pressure on the origin server will also rise. If there is a long connection between the user and the CDN service, the long connection will be interrupted during the upgrade; for example, if the user is watching a live broadcast, it will affect the viewing experience and service experience.
[0050] Method 2: The CDN service process adopts the master-slave method, such as Figure 4As shown in the figure. The main process creates multiple slave processes to receive user requests. When the service is upgraded, the main process loads the latest service content and creates new slave processes that inherit from the main process. The new slave processes receive new requests, while the old slave processes no longer receive new requests. When all the requests processed by the old slave processes are completed, the system resources occupied by the old slave processes are recycled. Since this method updates the single-machine process without introducing additional backup machines, it avoids the above-mentioned resource waste situation. At the same time, there is no problem of increased pressure on the origin server due to the invalidation of local caches during service updates. However, it also has the following disadvantages: When the new and old slave processes exist simultaneously, the memory occupancy doubles, and the CPU usage rate also increases. In extreme cases, it may cause spikes in the CPU (Central Processing Unit) and insufficient system memory, resulting in OOM (out of memory). The operating system may mistakenly kill other processes that occupy the most memory, affecting other process services. If there is a long connection between the user and the CDN service, the old slave processes cannot exit for a long time and will long-term occupy system resources. If the slave processes are forced to exit, it will cause the user connection to be interrupted, affecting the ongoing service.
[0051] Method 3: The CDN service process adopts a programming method of a static compilation language + a scripting language, and implements the business logic in the scripting language. Since the scripting language is an interpreted language that can be used out of the box, when the service is updated, a new script file can be directly loaded. Although this method avoids the upgrade problems existing in the above Method 1 and Method 2, it also has the following disadvantages: Since the scripting language is an interpreted language, its execution efficiency is much lower than that of the static compilation language. The upper limit of the requests that can be processed is limited. For example, both nginx and openresty are network proxy programs used in CDN. Nginx is implemented in pure C programming language. Openresty is implemented in C and lua scripting language, and the business is implemented in the lua script. The processing performance of openresty is several times slower than that of nginx. As a result, to process the same number of requests, more host resources need to be deployed for the implementation using the scripting language than for the static language.
[0052] In view of the limitations existing in the above service upgrade, the present application proposes a service update method, device, computer device, and storage medium, which can achieve rapid CDN service update with small resource occupancy, high efficiency, reliability, business lossless, and resource saving without affecting the business and user perception.
[0053] The service update method provided by the embodiments of the present application can be applied to, for example Figure 5In the application environment shown. Among them, the client can communicate with the content delivery network through the network. The content delivery network is a distributed network service architecture composed of multiple edge nodes, which are distributed in data centers around the world. The main purpose of the CDN is to accelerate the transmission speed of static and dynamic content to global users, improve the user experience, and at the same time reduce the load and bandwidth consumption of the source server. When a user requests a resource located on the CDN, the CDN will route the request to the nearest edge node according to the user's geographical location, and this node will cache and provide the required content. If the edge node does not cache the required content, it will request it from the source server, then cache and provide the content to the user, and update its cache for subsequent requests. In the embodiment of the present application, the content delivery network service can be provided for users through the edge node. In addition, the client can be but is not limited to a terminal device, and the terminal device can be various personal computers, laptops, smartphones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.
[0054] In some embodiments, a service update method is provided. This method is exemplified by being applied to an edge node of a content delivery network as shown in Figure 5 the figure. Among them, the edge node is at least configured with a plugin manager and at least one service flow plugin. Exemplarily, the plugin manager and the service flow plugin are implemented using static compilation languages, where the static compilation languages include but are not limited to C and C++. Thus, compared with using interpreted languages, it can reduce host resources and improve processing performance.
[0055] The following combines Figure 5 and Figure 6 , and introduces this service update method. This method includes the following steps.
[0056] S602: Detect the service flow plugin through the plugin manager and obtain the detection result.
[0057] S604: When the detection result indicates that there is an update, load the updated service flow plugin through the plugin manager.
[0058] The service flow plugin is used to provide the content delivery network service. The updated service flow plugin is used to provide the updated content delivery network service.
[0059] The service flow plugin can be understood as the main carrier for the CDN to provide services externally. In this application, the frequently changing business part in the function can be abstracted as a service flow plugin, and the service process can be implemented in the service flow plugin. When the service is updated, only the service flow plugin needs to be updated. That is, new service flow plugins can be created and deployed on edge nodes according to service upgrade requirements, and the plugin manager does not need to be updated.
[0060] In the application, corresponding service flow plugins can be created according to the content delivery network service type and deployed in each edge node respectively. Exemplarily, different service flow plugins are used to provide different types of content delivery network services. Among them, the content delivery network services include, but are not limited to, access authentication, frequency verification, and any other type of service, which will not be overly limited here.
[0061] The plugin manager is used to manage the service flow plugins. The plugin manager can forward tasks to the service flow plugins for service processing. The plugin manager is the bridge for the interaction between tasks and service flow plugins; among them, the tasks can be determined according to the network requests sent by the client. In the application, the plugin manager can call the corresponding service flow plugin according to the task and provide content delivery network services through the service flow plugin.
[0062] The detection result is used to indicate whether there is an update for the service flow plugin. The detection result includes there being an update and there being no update. If the detection result is that there is an update, it indicates that the service flow plugin has an update or upgrade. That is, there is a newly deployed updated service flow plugin on the edge node. In this case, the updated service flow plugin can be loaded through the plugin manager to enable the plugin manager to call the updated service flow plugin. If the detection result is that there is no update, it indicates that the service flow plugin has no update or upgrade.
[0063] In an application, a plugin manager and a business flow plugin can be separately deployed on edge nodes according to service proxy requirements, and the business flow plugin can be loaded by the plugin manager. When a network request sent by a client is received by an edge node, a corresponding task is created, and the plugin manager calls the corresponding business flow plugin according to the task to provide the corresponding content delivery network service for the client. In the case of a service upgrade requirement, an updated business flow plugin can be built according to the requirement and deployed in the edge node. In this regard, the plugin manager can detect the business flow plugin in the edge node to check whether there is an update. If the detection result is that there is an update, the updated business flow plugin is loaded by the plugin manager. Based on this, when a new network request sent by a client is received by the edge node, the updated business flow plugin can be called by the plugin manager to provide the updated content delivery network service for the client, thus meeting the service upgrade requirement; moreover, the edge node still continues to execute the corresponding business logic for the created tasks (or established long connections) through the business flow plugin, ensuring that the long connection of the client will not be disconnected due to service updates. In this way, the client will not perceive the service update, realizing seamless update and improving the usage experience. If the detection result is that there is no update, when a new network request sent by a client is received by the edge node, the business flow plugin is called by the plugin manager to provide the content delivery network for the client.
[0064] The service update method provided by the above embodiments is applied to edge nodes in a content delivery network. By configuring at least a plugin manager and at least one service flow plugin for the edge nodes, based on this, the edge nodes detect the service flow plugins through the plugin manager and obtain the detection results. In the case that the detection result indicates an update exists, the updated service flow plugin is loaded through the plugin manager. This method encapsulates the service-related business functions separately in the service flow plugins, and other functions are encapsulated outside the service flow plugins. Based on this, in the scenario where the content delivery network service has an update or upgrade, by constructing and deploying the updated service flow plugin and loading the updated service flow plugin through the plugin manager, the update of the content delivery network is achieved. Since other functions such as data reception and transmission and coroutine scheduling are relatively fixed and do not need to be frequently upgraded, updating the service flow plugin realizes the service update, greatly narrowing the update scope, reducing resource occupancy, and not requiring additional backup resources to be introduced, improving the service update speed and not affecting the service processing performance. In addition, this method detects the service flow plugins through the plugin manager, realizes the update detection of the service flow plugins, and in the case that an update of the service flow plugin is detected, loads the updated service flow plugin through the plugin manager. Thus, when the service is updated, newly established connections will use the updated service flow plugin, and existing long connection requests will still use the previous service flow plugin (i.e., the old service flow plugin), so that the existing connections will not be affected due to the service update, making the client not perceive the service update, achieving seamless update and improving the usage experience. This method neither affects the online services in use, nor affects the user perception, and does not cause performance impact on the host where the service is located, being efficient, reliable, business-lossless and resource-friendly.
[0065] In some embodiments, as Figure 7 shown, the edge nodes are also configured with a coroutine manager. Exemplarily, the coroutine manager is built based on a static compilation language, where the static compilation language includes but is not limited to C, C++. Thus, compared with using an interpreted language, it can reduce host resources and improve processing performance.
[0066] The coroutine manager is used to create coroutines in the user space of the edge nodes. Different coroutines are independent of each other, and one coroutine corresponds to a client that establishes a long connection with the content delivery network. For the same client, multiple network requests sent during the same long connection process can share one coroutine. In the case that the client disconnects from the content delivery network, the coroutine corresponding to the client can be cancelled through the coroutine manager.
[0067] A coroutine is also known as a micro-thread or fiber. Compared with a process or a thread, the context switching overhead of a coroutine is smaller because it is scheduled within the user space (or user mode) without the intervention of the operating system kernel. Among them, a process is an execution unit running on a computer, which includes all the resources and status information required to run a program, such as memory, file descriptors, open network connections, etc. Each process has a unique Process Identifier (PID) and exists as an independent execution environment in the operating system. In an application, when the coroutine manager receives a connection request sent by a client at an edge node, it can create a coroutine in the user space of the edge node.
[0068] It should be noted that in this application, coroutines are created by the coroutine scheduler instead of threads. The main reason is that threads are created and destroyed by the operating system kernel. If a thread is created for each request, a large number of requests will exhaust the host resources. However, coroutines are different. Coroutines are created and destroyed within the user space and do not require the participation of the operating system kernel, avoiding frequent context switching between the kernel mode and the user mode, and generally occupying very little resources.
[0069] In an application, a coroutine can encapsulate a connection request into a task entity and call the plugin manager to execute the task to establish a connection (such as a long connection) between the client and the content delivery network. After the connection is established, the client can send a network request to the edge node, and the edge node can call this coroutine to call the plugin manager, and through the plugin manager, call the corresponding business flow plugin to provide content delivery network services for the client.
[0070] Among them, in S602, the business flow plugin is detected by the plugin manager and the detection result is obtained, including the following steps: when the coroutine calls the plugin manager, the business flow plugin is detected by the plugin manager and the detection result is obtained; and / or, the business flow plugin is detected by the plugin manager at a preset period and the detection result is obtained.
[0071] Based on the above, when the coroutine calls the plugin manager, it indicates that the edge node has received a network request (including a connection request) sent by the client. That is, the plugin manager needs to call the business flow plugin to provide content delivery network services for the client. Therefore, before calling the business flow plugin, the plugin manager can detect the business flow plugin to determine whether there is an update for the business flow plugin.
[0072] In addition, periodic tasks can be pre-registered, and the plugin manager periodically detects the update status of the business flow plugin. Among them, the preset period is preset and can be set according to the actual scenario and business requirements, and will not be limited too much here.
[0073] It should be noted that in actual applications, the plugin manager can detect the update status of business flow plugins when called by a coroutine, or the plugin manager can also detect the update status of business flow plugins at fixed intervals. At least one of these two methods can be selected according to the specific scenario to trigger the plugin manager to detect business flow plugins.
[0074] For the service update method provided in the above embodiments, the plugin manager can dynamically judge and instantaneously load the updated business flow plugin inside the already created coroutine, enabling the edge node to promptly complete the update of the business flow plugin and provide the updated content distribution network service to users through the updated business flow plugin. In addition, the plugin manager can periodically detect business flow plugins, realizing that the plugin manager actively probes whether there is an update for business flow plugins and promptly loads the updated business flow plugin when an update is detected, so as to provide the updated content distribution network service to users through the updated business flow plugin, improving the user experience.
[0075] In some embodiments, the edge node stores a plugin library (such as a lib library), and the plugin library is used to store business flow plugins. The plugin library can be built based on a static compilation language. In the application, business functions can be encapsulated in business flow plugins according to the service proxy requirements or service update requirements provided by the content distribution network and stored in the plugin library. The plugin manager can open the plugin library by calling a function (such as dlopen) to load the business flow plugin. In the application, when the service is updated, a new plugin library can be deployed on the edge node, and the new plugin library can be used to store the updated business flow plugins; or the updated business flow plugins can be directly deployed into the existing plugin library. Using the plugin library can greatly improve the development efficiency, reduce the development time and workload, and help maintain the consistency and reliability of the code, and has a fast read and write speed and a small occupied resource space.
[0076] Based on the above, S202, detecting the business flow plugin and obtaining the detection result may include the following steps: obtaining the latest version information of the business flow plugin from the plugin library; determining that the detection result is that there is an update when the latest version information is different from the version information stored by the plugin manager; and determining that the detection result is that there is no update when the latest version information is the same as the version information stored by the plugin manager.
[0077] Version information can be used to identify the development iteration status, feature set, compatibility, and issues fixed, etc., of a business flow plugin. Exemplarily, the version information can include a version number identifier for uniquely identifying the version of the business flow plugin. In an application, when building or updating a business flow plugin, the plugin library can correspondingly update or record the version information of the business flow plugin in the plugin library of the edge node. Correspondingly, the plugin manager can store the version information of the loaded business flow plugins. Based on this, the plugin manager can obtain the latest version information of the business flow plugin from the plugin library and compare the latest version information with the version information stored internally. If the latest version information is different from the version information stored by the plugin manager, it indicates that there are changes to the business flow plugin in the plugin library. In this case, it is determined that the detection result is that there is an update. If the latest version information is the same as the version information stored by the plugin manager, it indicates that there are no changes to the business flow plugin in the plugin library. In this case, it is determined that the detection result is that there is no update. In this way, by detecting the version information of the business flow plugin, the detection of the update situation of the business flow plugin is realized.
[0078] Please continue to refer to Figure 7 , in some embodiments, the edge node is also configured with an event scheduler. Exemplarily, the coroutine manager is built using a static compilation language, where the static compilation language includes but is not limited to C, C++. Thus, compared with using an interpreted language, it can reduce host resources and improve processing performance. The event scheduler is a data flow processing center responsible for collecting network events, scheduling and processing network events, and also responsible for data transceiver transmission between the client and the server.
[0079] Among them, network events can be obtained according to network requests sent by the client. A network event refers to a notification of a certain state change or operation completion that occurs on a network connection under an asynchronous programming model. These events can include but are not limited to the following: connection establishment, network data readable, writable data to the network, connection closed, etc.
[0080] Based on the above, before the coroutine calls the plugin manager, the service update method further includes the following steps: receiving a network request sent by the client through the event scheduler; calling the coroutine of the client through the coroutine manager; creating a task entity according to the network request through the coroutine of the client to call the plugin manager within the task entity. Based on this, service updates can be processed within the existing coroutine without creating new processes or threads, which will not cause a sharp increase in native resource occupancy, saving resources and improving service processing performance.
[0081] In an application, an edge node can receive a network request sent by a client, convert the network request into a network event, collect the network event corresponding to the network request through an event scheduler, and schedule and process the network event. When the edge node receives a connection request sent by the client, the event scheduler creates a coroutine by calling a coroutine scheduler. The coroutine encapsulates the connection request into a task entity and calls a plugin manager to execute the task to establish a connection between the client and the content delivery network. After the client and the content delivery network establish a connection, when the edge node receives a network request sent by the client, the event scheduler calls the coroutine of the client and calls the plugin manager within the coroutine to provide the content delivery network service for the client.
[0082] Please continue to refer to Figure 7 , in some embodiments, the edge node is further configured with an event scheduler, which is used to receive network requests sent by clients. For the introduction of the event scheduler, please refer to the relevant content above and will not be elaborated here. Based on this, after loading the updated service flow plugin through the plugin manager, the service update method further includes the following steps: creating a service flow according to the network request through the updated service flow plugin, performing service processing within the service flow and generating a response result; sending the response result to the client through the event scheduler.
[0083] The service flow plugin can be used to create a service flow according to the received network request, complete the entire service logic within the service flow, such as access authentication, frequency verification, etc., and generate a response result corresponding to the network request, so as to forward the response result to the client through the event scheduler, thereby providing the corresponding content delivery network service for the client. Among them, one network request can correspond to one service flow. In this way, the event scheduler interacts with the client, the event scheduler calls the coroutine, the coroutine calls the plugin manager, and the plugin manager calls the corresponding service flow plugin, so that the service flow plugin creates a service flow according to the network request and performs service processing, and then provides the content delivery network service.
[0084] In some embodiments, the service update method further includes the following steps: when creating a service flow, incrementing the service flow count value of the updated service flow plugin by one; when the service flow processing is completed and the client disconnects from the edge node, decrementing the service flow count value of the updated service flow plugin by one; where, when the service flow count value of the service flow plugin is 0, recycle the service flow plugin.
[0085] In the application, when each service flow plugin creates a service flow, it can increment its own service flow count value by one. And when the service flow is processed and the corresponding client disconnects from the edge node or the content delivery network, it decrements its service flow count value by one. In this way, it is possible to dynamically record the number of service flows currently being processed by each service flow plugin through the service flow count value, and achieve real-time monitoring of the services processed by each service flow plugin.
[0086] Among them, when the number of service flow count values of the service flow plugin is 0, compared with the updated service flow plugin, this service flow plugin is an old service flow plugin. In this case, it indicates that there are no long connections using the old service flow plugin. In this regard, this service flow plugin can be recycled or cleaned up, so that in subsequent applications, the updated content delivery network service can be directly provided to the client through the updated service flow plugin. In this way, not only is the user experience not affected during the service update process, but also the resource utilization rate is improved, which helps to improve the processing performance.
[0087] Please continue to refer to Figure 7 , in some embodiments, the edge node is also configured with a network communication proxy. Exemplarily, the coroutine manager is built using a static compilation language, where the static compilation language includes but is not limited to C and C++; in this way, compared with using an interpreted language, it can reduce host resources and improve processing performance. The network communication proxy is responsible for the interaction between the service flow and the content delivery network inside, proxying the service flow network requests, and forwarding them to the event scheduler, which interacts with the client to send and receive data.
[0088] Based on the above, the above steps of performing service processing and generating a response result within the service flow include the following steps: when there is an interaction with the content delivery network in the service flow, sending a network request to the event scheduler through the network communication proxy; sending a network request to the content delivery network through the event scheduler and receiving the response result sent by the content delivery network.
[0089] In an application, complete business logic processing is implemented within a business process, and a response result is generated. The event scheduler forwards the response result to the client. When network interaction is involved within the business process, the network request can be forwarded to the event scheduler through a network communication proxy. When the data interaction between the event scheduler and the network pauses (data cannot be read or network blocking prevents data writing), the current coroutine processing will be paused. The context information of the execution at that time is saved inside the coroutine, and at the same time, the business process inside the coroutine will also pause. When the network interaction data resumes (the network is readable or writable), the event scheduler resumes the coroutine processing, and the interrupted context information is restored inside the coroutine, and the business process continues to be processed until completion. In this way, the business process plugin interacts with the content delivery network through the network communication proxy, providing technical support for the content delivery network service provided to the client, which helps to improve the service processing performance.
[0090] In some embodiments, such as Figure 8 and Figure 9 shown, a service update method is provided. Taking the application environment shown in Figure 7 as an example, this service update method will be introduced.
[0091] As Figure 7 shown, the edge node is configured with an event scheduler, a coroutine manager, a plugin manager, a business process plugin, and a network communication proxy. Among them, the event scheduler, the coroutine manager, the plugin manager, the business process plugin, and the network communication proxy are respectively built based on static compilation languages.
[0092] The event scheduler is the data flow processing center, responsible for collecting network events and scheduling and processing network events. When a client connection request is received, a coroutine is created, and the connection request is encapsulated as a task entity by the coroutine, and the plugin manager is called to execute the task. The event scheduler is also responsible for data transmission and reception between the event scheduler and the client.
[0093] The coroutine manager is used to manage the business process plugin and create the coroutine corresponding to the client when a connection request sent by the client is received.
[0094] The plugin manager is used to forward tasks to the business process plugin for processing. It is the bridge for interaction between tasks and business process plugins. It is also used to automatically detect whether there is an update for the business process plugin internally, automatically load the new version, and recycle the resources of the old version of the business process plugin that are no longer in use.
[0095] The service flow plug-in is the main carrier for the CDN to provide services externally. The CDN service update mainly involves the update of the service flow plug-in. When the service flow plug-in receives an injection request, it creates independent service flows and implements complete service logics within the service flows, such as access authentication and frequency verification. The service flow plug-in can exist in the form of an operating system dynamic library file. Edge nodes can configure a plug-in library, which includes at least one service flow plug-in; when the service is updated, a new version of the plug-in library can be configured for the edge nodes, and the new version of the plug-in library includes at least one new version of the service flow plug-in.
[0096] The network communication proxy is responsible for the interaction between the service flow and the network inside, proxying the service flow network requests and forwarding them to the event scheduler, which interacts with the client to send and receive data.
[0097] Based on the above, in the embodiments of the present application, through appropriate function partitioning, the most frequently changed business part in the functions is abstracted into a service flow plug-in, and the service process is implemented in the service flow plug-in. When the service is updated, only the service flow plug-in needs to be updated. Other modules irrelevant to the service focus on the data transfer and scheduling level and do not need to be updated. In this way, the scope of service update is minimized at the architecture level.
[0098] Combined with Figures 7 to 9 , the service update method includes the following steps.
[0099] S902: Initialize and load the service flow plug-in.
[0100] When the CDN service process is initialized, the plug-in manager executes the initialization of the service flow plug-in.
[0101] S904: Initialize the plug-in library version information.
[0102] The plug-in manager records the plug-in version number identifiers of each service flow plug-in in the plug-in library. A periodic detection task is registered during the initialization process. After the CDN service process is initialized, it provides services externally.
[0103] S906: Send a request.
[0104] The client requests the CDN service. At the underlying operating system level, each request corresponds to a network event. Then the event scheduler collects these network events. If it is a newly established connection, the event scheduler newly creates a coroutine dedicated to processing subsequent requests for the newly established connection. The connection is encapsulated as a request task entity inside the coroutine. Subsequent requests initiated on this connection all correspond to the same request task entity. The request task entity internally calls the plug-in manager.
[0105] S908: Find the service flow plug-in corresponding to the request.
[0106] S910: Inject the request.
[0107] The plug-in manager determines the corresponding business flow plug-in according to the network request sent by the client and the pre-stored plug-in version number identifier, and injects the request into the business flow plug-in.
[0108] S912: Process the request.
[0109] The business flow plug-in creates a business flow according to the injected request, executes the business logic within the business flow, and obtains the corresponding response result. At the same time, record that the number of business flows created by the business flow plug-in of this version is incremented by 1.
[0110] S914: Send the response result.
[0111] The event scheduler forwards the response result sent by the business flow plug-in to the client to provide content delivery network services for the client.
[0112] S916: Trigger periodically.
[0113] The timer in the edge node triggers the plug-in manager at a preset period, and the plug-in manager scans the update situation of the business flow plug-in every once in a while under the trigger of the timer.
[0114] S918: Detect whether there is a new version of the plug-in library. If not, wait for the next trigger. Otherwise, execute S920.
[0115] S920: Load the new version of the plug-in library.
[0116] If there is a change in the business flow plug-in version number, it means that the CDN service has been updated. At this time, it is necessary to load the new version of the business flow plug-in. Since the business flow plug-in generally exists in the form of a lib library, it can be opened very quickly through the dlopen method and occupies very little resource space. After loading, update the plug-in version number identifier to point to the new business flow plug-in.
[0117] S922: Update the plug-in library version information.
[0118] After the plug-in manager loads the new version of the plug-in library, it correspondingly updates the version information of the business flow plug-in.
[0119] S924: Find the new version of the business flow plug-in corresponding to the request.
[0120] S926: Inject the request.
[0121] S928: Process the request.
[0122] S930: Send the response result.
[0123] After the plug-in manager updates the version information of the business flow plug-in, if it receives a request sent by the client, i.e., S906, and matches the corresponding new version of the business flow plug-in according to the request, it injects the request into the new version of the business flow plug-in. The new version of the business flow plug-in processes the request, and the event scheduler sends the corresponding response result to the client to provide the updated content distribution network service for the client.
[0124] It should be noted that to implement complete business logic processing within the business flow, when network interaction is involved within the business flow, the network request is forwarded to the event scheduler through the network communication proxy. When the event scheduler pauses the network interaction data (unable to read data or network blockage preventing data writing), it will pause the current coroutine processing, and the context information of the execution at that time is saved inside the coroutine. At the same time, the business flow inside the coroutine will also pause. When the network interaction data resumes (the network is readable or writable), the event scheduler resumes the coroutine processing, and the interrupted context information inside the coroutine is restored to continue the business process processing.
[0125] After the business process is processed, if the client closes the connection, the number of business flows created by the business flow plug-in of the corresponding version is decreased by 1. If this version is not equal to the plug-in version number identifier, it means it is a historical version. When the historical version no longer processes requests (the corresponding number of business flows is 0), the resources occupied by the historical version plug-in are recycled.
[0126] Based on the above, during service upgrade, no additional system resources are allocated, and no additional processes or threads are created. Instead, it dynamically judges and instantaneously loads the new version of the business flow plug-in inside the already created coroutine, and the resources consumed in the middle can be almost ignored. For the long connection of the client, the connection will not be disconnected during the upgrade, and the long connection still uses the previous old version plug-in. In this way, for the client, the service upgrade is completely imperceptible and will not affect the usage experience.
[0127] The service update method provided by the embodiments of the present application divides the edge node into an event scheduler, a coroutine manager, a plugin manager, a service flow plugin, and a network communication agent. After such division, the responsibilities of each module are clear. Among them, except for the service flow plugin, the other modules, including the event scheduler, the coroutine manager, the plugin manager, and the network communication agent, focus on network data reception and transmission and coroutine scheduling. This part of the function is relatively fixed and does not require frequent upgrades. In view of the frequent updates of the CDN service online, the service-related business functions are separately encapsulated in the service flow plugin. To upgrade the service, only the service flow plugin needs to be upgraded. In this way, the scope of the upgrade can be greatly reduced. When upgrading, the resource occupation is very small, and no additional backup resources need to be introduced. In addition, the service update is processed inside the existing coroutines, and no new processes or threads are created, which will not cause the soaring of the local resource occupation. Moreover, this method encapsulates each client request in a coroutine for processing, and the coroutines are independent of each other. When the service is updated, the newly established connections will use the new version of the service flow plugin, and the existing long connection requests will still use the previous old version of the service flow plugin. In this way, the existing connections will not be affected by the upgrade, and the client is completely unaware. And it is executed on a single machine, and no additional processes will be created during the service upgrade, saving resources and avoiding the problem of soaring CPU and memory occupation.
[0128] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps in other steps.
[0129] Based on the same inventive concept, the embodiments of the present application also provide a service update device for implementing the above-mentioned service update method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the service update device provided below can refer to the limitations on the service update method in the above text, and will not be repeated here.
[0130] In some embodiments, such as Figure 10As shown, a service update device 1000 is provided, which is applied to an edge node in a content delivery network. The edge node is at least configured with a plugin manager and at least one service flow plugin; the service update device 1000 includes a detection module 1001 and a loading module 1002. Among them, the detection module 1001 is used to detect the service flow plugin through the plugin manager and obtain the detection result; the service flow plugin is used to provide content delivery network services. The loading module 1002 is used to load the updated service flow plugin through the plugin manager when the detection result indicates that there is an update; the updated service flow plugin is used to provide updated content delivery network services.
[0131] In some embodiments, the edge node is further configured with a coroutine manager, which is used to create coroutines in the user space of the edge node. Among them, the detection module is further used to detect the service flow plugin through the plugin manager and obtain the detection result when the coroutine calls the plugin manager; and / or, detect the service flow plugin through the plugin manager at a preset period and obtain the detection result.
[0132] In some embodiments, the edge node stores a plugin library, which is used to store service flow plugins; among them, the detection module is further used to obtain the latest version information of the service flow plugin from the plugin library; when the latest version information is different from the version information stored in the plugin manager, it is determined that the detection result indicates that there is an update; when the latest version information is the same as the version information stored in the plugin manager, it is determined that the detection result indicates that there is no update.
[0133] In some embodiments, the edge node is further configured with an event scheduler. Among them, the service update device further includes a receiving module, a calling module, and a creating module. The receiving module is used to receive a network request sent by a client through the event scheduler. The calling module is used to call the coroutine of the client through the coroutine manager. The creating module is used to create a task entity according to the network request through the coroutine of the client to call the plugin manager within the task entity.
[0134] In some embodiments, the edge node is further configured with an event scheduler, which is used to receive a network request sent by a client. The service update device further includes a creating module and a sending module. Among them, the creating module is used to create a service flow according to the network request through the updated service flow plugin, perform service processing within the service flow and generate a response result; the sending module is used to send the response result to the client through the event scheduler.
[0135] In some embodiments, the service update device further includes a counting module and a recycling module. The counting module is configured to increment the service flow count value of the updated service flow plugin by one when creating a service flow through the updated service flow plugin; and decrement the service flow count value of the updated service flow plugin by one when the service flow processing is completed and the client disconnects from the edge node. The recycling module is configured to recycle the service flow plugin when the service flow count value of the service flow plugin is 0.
[0136] In some embodiments, the edge node is further configured with a network communication proxy. The service update device further includes a sending module. The sending module is configured to send a network request to the event scheduler through the network communication proxy when there is an interaction with the content delivery network in the service flow; send a network request to the content delivery network through the event scheduler, and receive the response result sent by the content delivery network.
[0137] Each module in the above service update device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0138] In some embodiments, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 11 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a service update method.
[0139] Those skilled in the art can understand that Figure 11 the structure shown in
[0140] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0141] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the foregoing method are implemented.
[0142] In some embodiments, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of the foregoing method are implemented.
[0143] 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 for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties.
[0144] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memories can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0145] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0146] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A service update method, characterized in that, Applied to an edge node in a content delivery network, the edge node is at least configured with a plugin manager and at least one service flow plugin; the method includes: Detect the service flow plugin through the plugin manager and obtain a detection result; the service flow plugin is used to provide content delivery network services; In the case where the detection result indicates an update exists, load the updated service flow plugin through the plugin manager; the updated service flow plugin is used to provide updated content delivery network services.
2. The method according to claim 1, wherein The edge node is further configured with a coroutine manager, and the coroutine manager is used to create coroutines in the user space of the edge node; wherein, the detecting the service flow plugin through the plugin manager and obtaining a detection result includes: In the case where the coroutine calls the plugin manager, detect the service flow plugin through the plugin manager and obtain a detection result; and / or, Detect the service flow plugin through the plugin manager at a preset period and obtain a detection result.
3. The method according to claim 2, characterized in that, The edge node stores a plugin library, and the plugin library is used to store the service flow plugin; wherein, the detecting the service flow plugin and obtaining a detection result includes: Obtain the latest version information of the service flow plugin from the plugin library; In the case where the latest version information is different from the version information stored by the plugin manager, determine that the detection result indicates an update exists; In the case where the latest version information is the same as the version information stored by the plugin manager, determine that the detection result indicates no update exists.
4. The method according to claim 2, wherein The edge node is further configured with an event scheduler; wherein, before the coroutine calls the plugin manager, the method further includes: Receive a network request sent by a client through the event scheduler; Call the coroutine of the client through the coroutine manager; Create a task entity according to the network request through the coroutine of the client to call the plugin manager within the task entity.
5. The method according to any one of claims 1-4, characterized in that The edge node is further configured with an event scheduler, and the event scheduler is used to receive a network request sent by a client; After loading the updated service flow plugin through the plugin manager, the method further includes: Create a service flow according to the network request through the updated service flow plugin, perform service processing within the service flow and generate a response result; Send the response result to the client through the event scheduler.
6. The method according to claim 5, characterized in that The method further includes: In the case where the updated service flow plugin creates the service flow, increment the service flow count value of the updated service flow plugin by one; In the case where the service flow processing is completed and the client disconnects from the edge node, decrement the service flow count value of the updated service flow plugin by one; wherein, In the case where the service flow count value of the service flow plugin is 0, recycle the service flow plugin.
7. The method according to claim 5, characterized in that, The edge node is further configured with a network communication proxy, and the performing service processing within the service flow and generating a response result includes: When there is an interaction with the content delivery network in the service flow, send the network request to the event scheduler through the network communication agent; Send the network request to the content delivery network through the event scheduler and receive the response result sent by the content delivery network.
8. A service update device, characterized in that, Applied to an edge node in the content delivery network, the edge node is at least configured with a plugin manager and at least one service flow plugin; the device includes: A detection module, configured to detect the service flow plugin through the plugin manager and obtain a detection result; the service flow plugin is used to provide content delivery network services; A loading module, configured to load the updated service flow plugin through the plugin manager when the detection result indicates that there is an update; the updated service flow plugin is used to provide updated content delivery network services.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device of achieving plug-in upgrade based on instant messaging software
CN103179019A
Method and device for updating plug-in in plug-in platform
CN105373396A
Service data updating method and equipment
CN111865687A
Content distribution network edge node system
CN112511607A
Uninterrupted service upgrading method and system
CN112596771A