An edge data management method, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211167143.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-09-23
AI Technical Summary
用户分散于各地,对于距离数据中心较远的用户而言,其对数据中心的访问会出现时延长、响应速度慢的问题,并且当大量用户频繁地访问数据中心,进行数据读写时,还会出现负载过高、写入冲突等问题,用户体验差
[0009]本申请实施例提供的边缘数据管理方法,不论是写入数据还是读取数据,均是以携带执行对应接口的域名的请求发起,从而用户发送请求后,请求通过CDN节点被导向最近的边缘数据库,继而调用对应的接口在边缘数据库中进行数据的写入或读取,其中,边缘数据库中新写入的数据还会被同步到其他边缘数据库,使得各边缘数据库中的数据能够保持数据一致,有利于提高数据安全。一方面,读写均由边缘数据库实现,处理压力被分散,使得同时读写的数量减少,减少或避免了写入冲突,同时降低了负载,有利于提高读写数据的效率;另一方面,在CDN节点的基础上,实现用户与边缘数据库之间的通信,使得用户发起的请求基于CDN网络得到加速,为用户提供距离更快的读写服务,减小了时延,提高了响应速度。也就是说,实现了在保证数据安全性的同时,实现以低时延、低负载、无冲突的方式完成数据读写。
Smart Images

Figure CN115604287B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to an edge data management method, electronic device, and storage medium. Background Technology
[0002] With the advent of the big data era, people have generated more and more data that needs to be stored. Taking edge computing as an example, it provides computing services to users. Whether it is the data used for computing, the result of computing, or the intermediate process data of computing, all may have storage needs, thus generating a large amount of data.
[0003] However, current data storage typically employs a centralized design, meaning all data is written to and read from a data center. Users are geographically dispersed, and for those far from the data center, accessing it can result in prolonged latency and slow response times. Furthermore, when a large number of users frequently access the data center for read and write operations, issues such as excessive load and write conflicts can occur, leading to a poor user experience. Summary of the Invention
[0004] The purpose of this application is to provide an edge data management method, electronic device, and storage medium that enables data reading and writing in a low-latency, low-load, and conflict-free manner, thereby improving the user experience.
[0005] To achieve the above objectives, embodiments of this application provide an edge data management method applied to an edge database. The method includes: receiving a first request forwarded by a CDN node, wherein the first request is initiated by a user and carries a domain name pointing to a write operation interface and first data to be written; calling the write operation interface to write the first data to be written; and synchronizing the first data to be written to other edge databases.
[0006] To achieve the above objectives, embodiments of this application also provide an edge data management method applied to an edge database. The method includes: receiving a second request forwarded by a CDN node, wherein the second request is initiated by a user and carries a domain name pointing to a read operation interface and information indicating data to be read; calling the read operation interface to read the data to be read according to the information indicating the data to be read; and returning the data to be read to the user through the CDN node.
[0007] To achieve the above objectives, embodiments of this application also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the edge data management method as described in any of the preceding claims.
[0008] To achieve the above objectives, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the edge data management method as described in any of the preceding claims.
[0009] The edge data management method provided in this application, whether writing or reading data, initiates a request carrying the domain name of the corresponding interface. After the user sends a request, it is directed to the nearest edge database via CDN nodes, and then the corresponding interface is called to write or read data in the edge database. Newly written data in the edge database is also synchronized to other edge databases, ensuring data consistency across them and improving data security. On one hand, since both reading and writing are handled by the edge database, the processing pressure is distributed, reducing the number of simultaneous reads and writes, minimizing or avoiding write conflicts, and lowering the load, thus improving data reading and writing efficiency. On the other hand, communication between the user and the edge database is achieved based on CDN nodes, accelerating user requests via the CDN network, providing faster read and write services, reducing latency, and improving response speed. In other words, it achieves low-latency, low-load, and conflict-free data reading and writing while ensuring data security. Attached Figure Description
[0010] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0011] Figure 1 This is a flowchart of a data management method provided in one embodiment of this application;
[0012] Figure 2 This is a flowchart of a data management method including a data update step provided in another embodiment of this application;
[0013] Figure 3 This is a flowchart of a data management method including the step of receiving notification messages, provided in another embodiment of this application;
[0014] Figure 4 This is a flowchart of a data management method including the step of triggering a request to update target data, provided in another embodiment of this application;
[0015] Figure 5 This is a flowchart of a data management method including the step of detecting whether an edge database is available, provided in another embodiment of this application;
[0016] Figure 6 This is a flowchart of a data management method including a data cleaning step, provided in another embodiment of this application;
[0017] Figure 7 This is a flowchart of a data management method including a step of returning data to be read, provided in another embodiment of this application;
[0018] Figure 8 This is a flowchart of a data management method provided in another embodiment of this application, which includes a step of forwarding a second request when the data to be read is not stored in the detection node cache;
[0019] Figure 9 This is a flowchart of a data management method, including the step of detecting whether an edge database stores data to be read, provided in another embodiment of this application;
[0020] Figure 10 This is a schematic diagram illustrating an application scenario of the data management method provided in another embodiment of this application;
[0021] Figure 11 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been presented in the various embodiments of this application to enable readers to better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments.
[0023] The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.
[0024] This application provides an edge data management method for edge databases. These edge databases can be deployed on Content Delivery Network (CDN) nodes. This not only leverages the distributed nature of CDN nodes to further shorten the distance between the edge database and users, reducing transmission distance and latency, but also reduces the distance between the CDN nodes and the edge database, further reducing latency. Alternatively, the edge database can be deployed on edge servers independent of CDN nodes, thus avoiding the use of CDN node resources and minimizing impact on existing CDN node services. In some cases, the edge database can be deployed as a container on CDN nodes. When old data in the edge database expires, the container can flexibly and automatically scale down, releasing some storage space and reducing resource consumption while meeting storage needs. Alternatively, when the data volume in the edge database suddenly increases, the container can flexibly and automatically scale up, increasing the number of service instances to provide sufficient storage space, thus improving resource utilization. The edge data management method flow is as follows: Figure 1 As shown, it includes at least the following steps:
[0025] Step 101: Receive the first request forwarded by the CDN node. The first request is initiated by the user and carries the domain name pointing to the write operation interface and the first data to be written.
[0026] In this embodiment, the write operation interface is invoked via a domain name. This allows the first request, carrying the domain name pointing to the write operation interface, to be directed to a CDN node through domain name resolution. The request is then forwarded to the nearest edge database where the write operation interface is deployed, and the write operation interface is invoked in the edge database to write the first data to be written. The domain name carrying the first request pointing to the write operation interface is actually the domain name of the device where the edge database with the write operation interface is located.
[0027] In some cases, the first data to be written is added as a parameter to the first request.
[0028] In other examples, the first data to be written is added as data to the data section of the first request.
[0029] It's important to note that when a user needs to write data, their initial request will resolve to the nearest CDN node via local domain name resolution. Based on this IP address, the request is then sent to the nearest CDN node, leveraging the CDN's acceleration capabilities to reduce latency and improve processing efficiency. The CDN node then forwards this initial request to the nearest edge database to write the data. Specifically, if an edge database is deployed on the CDN node, the request will be forwarded to that database; otherwise, it will be forwarded to the nearest edge database server. Therefore, for users in different regions, the source address of the initial request will belong to a different region, resulting in different nearest CDN nodes and potentially different edge databases being forwarded by the CDN node. In other words, the IP address resolved in the request may differ for users in different regions. Furthermore, compared to traditional centralized central data cluster writing, it can realize data writing based on CDN nodes in edge data clusters closer to the client. There are multiple objects to be written, so the first request is distributed to each edge database for processing, reducing the processing pressure and load of each edge database, and improving the efficiency and reliability of writing data.
[0030] It should also be noted that this embodiment does not limit the first data to be written. It can be any data that the user wants to write to the database. It can contain any data content, such as video, audio, image or data string. It can also be represented by various data types, such as key-value pair type or object type, which will not be elaborated here.
[0031] Step 102: Call the write operation interface to write the first piece of data to be written.
[0032] In this embodiment, the write operation interface can be encapsulated in the form of an Application Programming Interface (API) to provide write operation services to the outside world.
[0033] In some cases, the first data to be written is entirely new. In this case, calling the write operation interface to write the first data to be written is implemented as follows: the write operation interface is called to write the first data to be written as entirely new data. Since the first data to be written is entirely new, the write operation interface will operate on the edge database in a new manner to write the first data to be written into the edge database.
[0034] In other examples, the first data to be written is a data association already stored in the edge database. In this case, calling the write operation interface to write the first data to be written to the edge database is implemented as follows: the write operation interface is called, and the first data to be written is written as the update result of the current data in the edge database. Since the first data to be written is not entirely new, the write operation will modify the edge database to write the first data to be written. For example, if the edge database contains weather information A, and after a period of time, the weather information changes to A', then A' is used as the first data to be written, and the write operation interface will modify the original A to A'.
[0035] Of course, the above are just specific examples. In other cases, the write interface can also implement the operation of the first data to be written in other ways, which will not be elaborated here.
[0036] Step 103: Synchronize the first data to be written to other edge databases.
[0037] It's understandable that different edge databases may all store the same data. Once the latest data for that data is written to one edge database, data inconsistency will occur. For example, location A might belong to the area covered by CDN node 1, while location B belongs to the area covered by CDN node 2. When a user in location B uploads a TV program up to episode j+1 to CDN node 2, the edge database deployed on CDN node 2 will include episode j+1. However, if a user in location B only uploads up to episode j, the edge database deployed on CDN node 1 will not include episode j+1. For different but interconnected edge databases, data inconsistency can affect service quality and data security. Therefore, data synchronization between edge databases is necessary.
[0038] It should be noted that data changes are only meaningful to the objects that care about that data. That is, data synchronization with other edge databases is only meaningful if the data subscribed to by other edge databases is related to the first data to be written. In other words, the first data to be written is not synchronized to all other edge databases, but only between this edge database and edge databases that have subscribed to data related to the first data to be written. Specifically, if the data subscribed to by other edge databases is unrelated to the first data to be written, data synchronization will not be performed; that is, step 103 can be flexibly determined based on the actual situation.
[0039] It should also be noted that, because the data subscribed to by other edge databases may not be related to all the data in the first data to be written, the data synchronized to other edge databases may not be the complete first data to be written. This avoids synchronizing data that is not of interest to other edge databases and wasting storage space.
[0040] In some cases, the database system housing the edge database includes a central database. Since the edge databases and the central database can communicate directly, data synchronization between edge databases can be achieved through the central database. That is, synchronizing the first piece of data to be written to other edge databases can be done as follows: the first piece of data to be written is synchronized to the central database, which then synchronizes it to the other edge databases. Here, "edge database" and "central database" are relative terms; the edge database is closer to the user, while the central database communicates and connects with all the edge databases, acting as the database center. In this way, the data synchronization operation from the edge databases to the central database ensures that the central database stores all the data, while the edge databases only store a portion. When data in the edge databases is compromised, it can be recovered from the data in the central database, ensuring data recoverability and thus data security.
[0041] It should be noted that the central database can be deployed on physical machines, cloud hosts, virtual machines, etc., thereby providing a resource with a database operating environment for the central database, without limiting whether the resources required by the database are provided by physical physical servers or virtual servers.
[0042] It should also be noted that this embodiment does not limit the synchronization method, which can be implemented in various forms.
[0043] In some examples, synchronizing the first piece of data to be written to the central database can be achieved by incrementally synchronizing the first piece of data to be written to the central database. This means that only the changed data is sent to the central database, rather than sending all data from the edge database to the central database, thus reducing bandwidth and improving efficiency. Of course, in other examples, synchronization to the central database can also be achieved through a full synchronization, which will not be elaborated upon here.
[0044] In some cases, synchronizing the first piece of data to be written to the central database can be achieved by periodically synchronizing the first piece of data to be written to the central database. That is, the edge database synchronizes the data written to the edge database within that time interval to the central database at regular intervals. The synchronization method can be either incremental synchronization or full synchronization.
[0045] In other examples, synchronizing the first data to be written to the central database can also be achieved by quantitatively synchronizing the first data to be written to the central database. That is, whenever a certain amount of data is written to the edge database, this data is synchronized to the central database. The synchronization method can be either incremental synchronization or full synchronization.
[0046] To facilitate understanding of data synchronization between edge databases by those skilled in the art, the following description uses the process of synchronizing data from other edge databases to this edge database as an example. In some embodiments, such as Figure 2 As shown, the data management method also includes the following steps:
[0047] Step 104: If the data subscribed to by the edge database is updated by writing the second data to be written to another edge database, receive the updated data.
[0048] In this embodiment, the updated data is the data used to update the edge database subscription data. It can be the second data to be written, a part of the second data to be written that is related to the edge database subscription data, or data that has changed in the edge database subscription data, etc.
[0049] It should be noted that when other edge databases write second data to be written based on user-initiated write requests, and this second data involves data subscribed to by this edge database, this edge database has a need for data synchronization. Therefore, data synchronization will occur between the edge databases writing the second data and this edge database. This data synchronization can be achieved through a central database, as described previously. That is, other edge databases synchronize the second data to be written to the central database, and then the central database synchronizes the data related to the data subscribed to by this edge database to this edge database. Of course, there may be multiple edge databases whose subscribed data is updated by the second data to be written, not just this edge database. In this case, the central database will synchronize the corresponding data to multiple edge databases. Alternatively, in other embodiments, the central database can broadcast data synchronized from certain edge databases to the edge databases, and each edge database can independently check and determine whether to update the data.
[0050] In some examples, the updated data carries a set, where each element corresponds one-to-one with a data key in the central database. The value of each element indicates whether the data content corresponding to that key has changed. The set can be binary encoded, where each bit in the binary encoded data corresponds to a data key. For example, 101010 indicates that data items 0, 2, and 4 have been updated, while data items 1, 3, and 5 have not changed. Compared to carrying a complete representation of each data key in the updated data, indicating whether data has changed using sets requires fewer bits. This is especially beneficial when dealing with large datasets and long data keys, significantly reducing the information needed to indicate the changed keys and thus reducing bandwidth consumption, which is beneficial for minimizing bandwidth overhead during data transmission.
[0051] Step 105: Update the corresponding data in the edge database based on the updated data to synchronize with the corresponding data in other edge databases.
[0052] In some cases, updating the corresponding data in the edge database based on the updated data can be achieved by updating the corresponding data in the edge database to the updated data.
[0053] In other words, this embodiment ensures local data consistency through data synchronization between edge databases. Local consistency is achieved because the data stored in each edge database may not be identical. It should be noted that, from the perspective of all data stored in each database, there is also global consistency across all data.
[0054] Considering that data update and synchronization takes time, therefore, in some embodiments, such as Figure 3 As shown, the data management method also includes the following steps:
[0055] Step 106: Receive notification message.
[0056] This embodiment does not limit the form of the notification message; it can be any kind of communication message between databases, which will not be described in detail here.
[0057] In some cases, where the database system containing this edge database has a central database, the notification message can be sent by the central database. The timing of the notification message can be after receiving the second data to be written, or after updating the data based on the second data to be written. In particular, the receipt of the second data to be written can trigger the step of sending a notification message to this edge database, thereby enabling data invalidation as soon as possible and preventing users from obtaining data that is delayed in updating.
[0058] Step 107: According to the notification message, the target data is invalidated because the target data belongs to the data subscribed to by the edge database and is not synchronized to the corresponding data in the second data to be written.
[0059] In this embodiment, invalidation can be achieved by adding an invalid tag to the data or adding a lock, etc.
[0060] It's important to note that invalidated data means it won't be read by users, but this doesn't mean users can't read the results after updating invalid data. Therefore, to meet users' reading needs, the data should be updated. Specifically, updating invalid data triggered by user reads minimizes meaningless data updates and conserves resources. For example, for data that is updated multiple times, if a user only reads the data from a peripheral database after the third update, compared to updating it promptly every time, updating only after the third update when the user requests to read it reduces the number of updates by two, saving the resources consumed by those two updates.
[0061] Based on this, in some embodiments, such as Figure 4 As shown, data management methods also include:
[0062] Step 108: Based on the user's request to read the target data, trigger the action of requesting to update the target data.
[0063] In particular, in some cases, some data may revert to its original state after multiple modifications. Therefore, before triggering the action to request an update of the target data, a message can be sent outward (such as to the central database) to detect whether the target data has changed. The update will only be performed after the target data has been confirmed to have changed. Alternatively, after confirming the change, the updated data can be returned to the edge database as a response. Or, the result of confirming the change can be returned to the edge database as a response, and then the edge database can request the target data from the outside.
[0064] Accordingly, step 104 is: in the case that the data subscribed to by the edge database is written to the second data to be written in the other edge database, the response carrying the updated data is received based on the request to update the target data.
[0065] It is understandable that edge databases may become unavailable for various reasons, such as data overflow. In the event of edge database unavailability, the initial data to be written may be difficult to write successfully. Therefore, to avoid write failures, in some embodiments, such as... Figure 5 As shown, the data management method also includes the following steps:
[0066] Step 109: Check if the edge database is available. If yes, proceed to step 102; otherwise, proceed to step 1010.
[0067] In this embodiment, the availability of the edge database can be obtained by the edge database actively reporting its working status, or by actively checking its availability before writing the first piece of data to be written.
[0068] Step 1010: Call the write operation interface, parse the other recently available edge databases, and redirect the first request to the parsed other edge databases.
[0069] In other words, if the current edge database is unavailable, the write operation interface will perform a domain name resolution step to find the nearest and available edge database to write the data. This automatic switching of edge databases, achieved through domain name resolution, ensures timely access and efficiently writes the first data to be written to the database without manual intervention.
[0070] It should be noted that after redirection to other edge databases, the edge database will start executing the edge data management method shown in this embodiment from step 101 above, which will not be described in detail here.
[0071] Furthermore, considering that some data written to the edge database may be rarely used, or used very infrequently, meaning that some data occupies low storage space utilization, and that storing too much data may lead to slow response times for edge database operations, some measures are proposed in certain embodiments to avoid excessive storage resource consumption, thereby improving database resource utilization. For example... Figure 6 As shown, data management methods also include:
[0072] Step 1011: Clean up the stored data based on a preset automatic cleanup mechanism, which includes cold / hot expiration or timed expiration.
[0073] In this embodiment, an automatic cleanup mechanism ensures that the data stored in the edge database is always the latest or the most frequently used by users, thereby providing services to users as much as possible based on the limited storage resources on the edge database.
[0074] Another aspect of this application embodiment provides an edge data management method applied to an edge database. This edge database can be deployed on CDN nodes, which not only leverages the distributed characteristics of CDN nodes to further shorten the distance between the edge database and users, reducing transmission distance and latency, but also reduces the distance between the CDN nodes and the edge database, further reducing latency. Alternatively, the edge database can be deployed on an edge server independent of the CDN nodes, thus avoiding the need to occupy CDN node resources and reducing the impact on the original services of the CDN nodes. In some cases, the edge database can be deployed on CDN nodes as a container. When old data in the edge database expires, the container can flexibly and automatically scale down, releasing some storage space, thereby reducing resource consumption while meeting storage needs. Alternatively, when the data volume in the edge database suddenly increases, the container can flexibly and automatically scale up, increasing the number of service instances to provide sufficient storage space for data storage, which is beneficial for improving resource utilization. The process of the edge data management method is as follows: Figure 7 As shown, it includes at least the following steps:
[0075] Step 701: Receive the second request forwarded by the CDN node. The second request is initiated by the user and carries the domain name pointing to the read operation interface and information indicating the data to be read.
[0076] In this embodiment, the read operation interface is invoked via a domain name. This allows the second request, carrying the domain name pointing to the read operation interface, to be redirected to a CDN node through domain name resolution. The request is then forwarded to the nearest edge database where the read operation interface is deployed, and the read operation interface is invoked in the edge database to read the first data to be read. The domain name carrying the second request actually points to the domain name of the device where the edge database with the read operation interface is located.
[0077] It's important to note that when a user needs to read data, their second request will be resolved through local domain name resolution to obtain the IP address of the nearest CDN node. Then, based on this IP address, the second request is sent to the nearest CDN node, leveraging the CDN node for acceleration, reducing latency, and improving processing efficiency. The CDN node will then forward the first request to the nearest edge database to read the data. That is, if an edge database is deployed on the CDN node, the second request will be forwarded to the internally deployed edge database; if no edge database is deployed on the CDN node, the second request will be forwarded to the server hosting the nearest edge database. Therefore, for second requests initiated by users in different regions, because the source address of the second request belongs to different regions, the nearest CDN node obtained will be different, and the corresponding edge database forwarded by the CDN node may also be different. In other words, the IP address resolved to by the request may be different for users in different regions. Furthermore, compared to traditional centralized central data cluster reading, it can achieve data reading based on CDN nodes in edge data clusters closer to the client. There are multiple objects to be read, which allows the second request to be distributed to each edge database for processing. This reduces the processing pressure and load on each edge database, thereby improving the efficiency and reliability of data reading.
[0078] Step 702: Based on the information indicating the data to be read, call the read operation interface to read the data to be read from the edge database.
[0079] In this embodiment, the read operation interface can be encapsulated in the form of an API to provide read operation services to the outside world.
[0080] Step 703: Return the data to be read to the user through the CDN node.
[0081] Currently, storing edge data using containers is a common method. Since these containers are stateless (meaning historical data and operational states within them don't need to be persisted, and there's no need to worry about historical inputs), this leads to the inability to use historical data, especially intermediate calculations, which become invalid and cannot be resumed, requiring a restart each time. In contrast, the method provided in this embodiment uses stateful containers instead of stateless ones. The written data is persistent and can be read and used correctly multiple times, improving processing efficiency. For example, in edge computing, the results of intermediate processes can be stored and reused the next time the result is retrieved, eliminating the need to start from scratch and resulting in higher efficiency.
[0082] To further improve data reading efficiency and fully utilize the advantages of CDN nodes, in some embodiments, data is also stored based on the node cache of the CDN node, so as to respond to the second request based on the data in the node cache. The node cache is the storage space used by the CDN node to provide accelerated services for the user's content requests. For example... Figure 8 As shown, step 701 is: receiving the second request forwarded by the CDN node when the data to be read is not cached.
[0083] Accordingly, step 703 is: return the data to be read to the CDN node, so that the CDN node can temporarily store the data to be read and return the data to be read to the user.
[0084] In other words, when a user's second request enters the CDN node, the CDN node first checks whether the data to be read is stored in its cache based on the information indicating the data to be read carried in the second request. If the data to be read is stored in the node cache, there is no need to forward the second request to the edge database. If the data to be read is not stored in the node cache, then the second request is forwarded to the edge database. The process of checking whether the data to be read is stored in the node cache based on the information indicating the data to be read can be implemented through the CDN node's cache hit detection, which will not be elaborated on here.
[0085] It should be noted that in step 703 above, when the node cache does not contain the data to be read, in order to facilitate faster retrieval of the data by subsequent users, the data to be read is also cached on the CDN node after being read from the edge database, so that the data to be read can be directly obtained from the node cache next time. However, in some cases, the step of storing the data to be read in the node cache may not be performed, such as when the frequency of reading the data record is very low, that is, the probability of a user requesting to read the data to be read next time is very low. Therefore, it is not necessary to store it in the node cache. Of course, edge data in the node cache can also be automatically cleaned up to avoid occupying too much storage space and affecting the original business, which will not be elaborated here.
[0086] In other words, when a user calls the read operation interface, the request first goes to the CDN cache. If there is no data, it is then read from the edge database. This combines the network acceleration and caching features of CDN, reducing the read access volume of the edge data cluster, further reducing the pressure on the database, while making the user's read efficiency higher, the latency lower, improving the response speed of requests, and improving the overall availability and performance of the database.
[0087] It is also understandable that the edge database may not contain the data to be read; therefore, in some embodiments, such as Figure 9 As shown, step 702 includes the following steps:
[0088] Step 712: Check if there is data to be read stored in the edge database. If yes, proceed to step 722; otherwise, proceed to step 732.
[0089] Step 722: Call the operation interface to read the data to be read from the edge database.
[0090] Step 732: Request the data to be read and store the returned data to be read, so as to call the read operation interface to read the data to be read.
[0091] In other words, when the edge database does not have the data to be read, it requests data from outside (such as from the central database) to provide it to the user, thereby ensuring that the user can read the data they want and improving the user experience.
[0092] In this embodiment, the data to be read is first searched in the node cache of the CDN node. If the data is found, it is returned to the user. If the data is not found, the read operation interface is called to search in the edge database deployed on the CDN node. If the data is found, it is returned to the user. Otherwise, the data is requested from the central database and returned to the user. In order to facilitate faster response to the requesting user in the next instance, the data to be read found in the edge database or the data to be read obtained from the central database can be temporarily stored in the node cache.
[0093] It should be noted that the data management methods provided in the aforementioned two embodiments can be implemented in combination. Taking the application to short link business as an example, when a user creates a short link, the long link can be converted into a short link through the API, and the response is sent to the creator. This key-value relationship (the relationship between the long link and the short link) is stored in the edge data cluster and synchronized to other subscribed edge data clusters. In this way, when other users obtain and access the short link, the domain name resolution will get the CDN edge, and based on the nodes of the CDN edge, the edge database will be found to restore the original long link and return the response to the user. When the user initiates access to the long link again, it will be accelerated by the CDN and then return to the origin.
[0094] To help those skilled in the art better understand the data management method described in the above embodiments, the following will provide a specific distance explanation using the scenario where an edge database is deployed on a CDN node.
[0095] like Figure 10As shown, user M determines the nearest CDN node to be A through local domain name resolution. Therefore, its first request, carrying information about the write operation API configured on the edge database of CDN node A, is sent to CDN node A. The write operation API then writes the video data D carried in the first request into the edge database deployed on CDN node A, and this data is periodically synchronized to the central database. If the edge storage device on CDN node A is unavailable, the write operation API performs domain name resolution to obtain the edge database on other CDN nodes, such as the edge database deployed on CDN node B. The first request is then sent to the other CDN node and successfully written to its edge database. Otherwise, domain name resolution is performed again until the data is successfully written to an edge database. At this point, if user N in another location wants to watch the video data D, the CDN finds the nearest CDN node B, sends a second request to CDN node B, and reads the video data D from the edge database deployed on CDN node B, responding to user N for video viewing. If CDN node B does not store video data D, it subscribes to video data D from the central database. After synchronizing video data D to the central database, it responds to the node cache of CDN node B and user N. Once the edge database on CDN node B subscribes to video data D, the central database will automatically push updated data to the edge database on CDN node B whenever video data D changes, ensuring that the edge database on CDN node B maintains the latest video data D. If the edge database deployed on CDN node B becomes unavailable for some reason, requests to access the database will be routed to the nearest CDN node C based on the domain name until video data D is retrieved. If another user K also wants to watch video data D, and the closest node to user K is CDN node B, then the video data D can be directly returned to the user based on the node cache of CDN node B, without needing to access the edge database deployed on CDN node B.
[0096] Of course, in other cases, edge databases can be deployed on edge servers independent of CDN nodes, or some edge databases can be deployed on CDN nodes and some on edge servers, etc., which will not be elaborated here.
[0097] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0098] Another aspect of this application embodiment also provides an electronic device, such as... Figure 11 As shown, it includes: at least one processor 1101; and a memory 1102 communicatively connected to at least one processor 1101; wherein the memory 1102 stores instructions executable by at least one processor 1101, the instructions being executed by at least one processor 1101 to enable at least one processor 1101 to perform the method described in any of the above method embodiments.
[0099] The memory 1102 and processor 1101 are connected via a bus. This bus can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors 1101 and memory 1102. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 1101 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 1101.
[0100] Processor 1101 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 1102 can be used to store data used by processor 1101 during operation.
[0101] Another aspect of this application provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the above-described method embodiments.
[0102] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0103] Those skilled in the art will understand that the above embodiments are specific embodiments for implementing this application, and in practical applications, various changes can be made to them in form and detail without departing from the spirit and scope of this application.
Claims
1. An edge data management method, characterized in that, Applied to edge databases, the method includes: The system receives a first request forwarded by a CDN node. The first request is initiated by the user and carries a domain name pointing to the write operation interface and the first data to be written. The first request is sent to the CDN node closest to the user through local domain name resolution and is forwarded by the CDN node closest to the user to the edge database closest to this node. Call the write operation interface to write the first data to be written; Synchronize the first data to be written to other edge databases.
2. The edge data management method according to claim 1, characterized in that, The method further includes: In the event that the data subscribed to in the edge database is updated by the second data to be written in the other edge database, the updated data is received; Based on the updated data, the corresponding data in the edge database is updated to synchronize with the corresponding data in other edge databases.
3. The edge data management method according to claim 2, characterized in that, Before receiving the updated data, the method further includes: Receive notification messages; According to the notification message, the target data is invalidated because the target data belongs to the data subscribed to by the edge database and is not synchronized with the corresponding data in the second data to be written.
4. The edge data management method according to claim 3, characterized in that, After invalidating the target data according to the notification message, the method further includes: Based on the user's request to read the target data, an action to request an update of the target data is triggered; The received update data includes: Receive a response carrying the updated data, returned based on the request to update the target data.
5. The edge data management method according to claim 3, characterized in that, The updated data carries a set, in which each element corresponds to a data key, and the value of each element is used to indicate whether the data content corresponding to the data key has changed.
6. The edge data management method according to any one of claims 1 to 5, characterized in that, The step of calling the write operation interface to write the first data to be written includes: Call the write operation interface to write the first data to be written as brand new data; or, The write operation interface is invoked to write the first data to be written as the update result of the current data in the edge database.
7. The edge data management method according to any one of claims 1 to 5, characterized in that, Before calling the write operation interface to write the first data to be written, the method further includes: Check if the edge database is available; The step of calling the write operation interface to write the first data to be written includes: If the edge database is available, the write operation interface is invoked to write the first data to be written.
8. The edge data management method according to claim 7, characterized in that, The method further includes: If the edge database is unavailable, the write operation interface is invoked to parse other recently available edge databases and redirect the first request to the parsed other edge databases.
9. The edge data management method according to any one of claims 1 to 5, characterized in that, The method further includes: The stored data is cleaned up based on a preset automatic cleanup mechanism, which includes cold / hot expiration or timed expiration.
10. The edge data management method according to any one of claims 1 to 5, characterized in that, The database system where the edge database resides includes a central database, and synchronizing the first data to be written to other edge databases includes: The first data to be written is synchronized to the central database, so that the central database can synchronize the first data to be written to the other edge databases.
11. The edge data management method according to any one of claims 1 to 5, characterized in that, The edge database is deployed on the CDN node, or the edge database is deployed on the edge server.
12. An edge data management method, characterized in that, Applied to edge databases, the method includes: The system receives a second request forwarded by a CDN node. The second request is initiated by the user and carries a domain name pointing to the read operation interface and information indicating the data to be read. The second request is sent to the CDN node closest to the user through local domain name resolution and is forwarded by the CDN node closest to the user to the edge database closest to this node. Based on the information indicating the data to be read, the read operation interface is invoked to read the data to be read; The CDN node returns the data to be read to the user.
13. The edge data management method according to claim 12, characterized in that, The second request forwarded by the CDN node includes: Receive the second request forwarded by the CDN node when the data to be read is not cached; The step of returning the data to be read to the user through the CDN node includes: The data to be read is returned to the CDN node, so that the CDN node can temporarily store the data to be read and then return the data to the user.
14. The edge data management method according to claim 12 or 13, characterized in that, The step of calling the read operation interface to read the data to be read based on the information indicating the data to be read includes: Detect whether the edge database stores the data to be read; If the data to be read is stored in the edge database, the read operation interface is called to read the data to be read; If the data to be read is not stored in the edge database, the system requests the data to be read and stores the returned data to be read, so as to call the read operation interface to read the data to be read.
15. The edge data management method according to claim 12 or 13, characterized in that, The edge database is deployed on the CDN node, or the edge database is deployed on the edge server.
16. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the edge data management method as described in any one of claims 1 to 11, or to perform the edge data management method as described in any one of claims 12 to 15.
17. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the edge data management method as described in any one of claims 1 to 11, or implements the edge data management method as described in any one of claims 12 to 15.
Citation Information
Patent Citations
Data storage method in CDN (Content Delivery Network) system, and CDN system
CN108268209A
CDN edge injection and distribution method and system
CN111131515A