CN-115794840-B - Method and device for supporting memory data table monitoring
Abstract
The invention provides a method and a device for supporting memory data table monitoring, wherein the method comprises the steps of defining 256 tables of a memory database Fcdb, using a kv database to store data, detecting whether a client monitors the table or not when the data is changed, not checking if the table is not monitored by the client, judging whether a key prefix value is null if the table is monitored by the client, if the key prefix value is null, indicating that the client monitors the whole table, sending keys and value to corresponding clients, judging whether the keys of the table are monitored by a prefix matching mode if the key prefix value is not null, informing the corresponding monitoring client of the keys and value if the keys of the table are matched with the monitoring, and ignoring updating if the keys are not matched with the monitoring client. In this way, memory database Fcdb stores data using a kv database, which has high concurrency processing capability, and memory database Fcdb checks for changes to each key and notifies it.
Inventors
- LI CAIMING
Assignees
- 中盈优创资讯科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20220927
Claims (14)
- 1. A method for supporting in-memory data table snooping, the method comprising: S01, defining 256 tables of a memory database Fcdb, and storing data by using a kv database; S02, detecting whether a client monitors a table to which data belongs or not by Fcdb when the data is changed; S03, if the table to which the data belongs is not monitored by the client, not checking; s04, if the table to which the data belongs is monitored by the client, judging whether the value of the key prefix is null, if the value of the key prefix is null, indicating that the client monitors the whole table, and sending the key and the value to the corresponding client; s05, judging whether the key of the table to which the data belongs is monitored or not in a prefix matching mode if the value of the key prefix is not null; S06, if the key of the table to which the data belongs is matched with the monitoring, notifying the corresponding monitoring client of the key and the value, and if the key is not matched with the monitoring client, ignoring the updating.
- 2. The method of claim 1, wherein the memory in S01 has 256 arrays, each array has a number, and the number has a value of 0-255.
- 3. The method of claim 2, wherein the number value corresponds to an id value of the table.
- 4. The method for supporting in-memory data table snooping as set forth in claim 1, wherein the client in S02 stores a client structure in the database, the client structure having a function of snooping a plurality of tables.
- 5. The method of claim 4, wherein the database has a snoop list, the snoop list includes table ids and table directives listens, and if listens is not null, it indicates that the client is listening to the table.
- 6. A method for supporting in-memory data table snooping as claimed in claim 1, wherein the prefix in S04 is defined by a user.
- 7. The method for supporting memory data table snooping as set forth in claim 1, wherein Fcdb further has a snooping function, comprising the specific steps of: s011, providing the number of a table to be monitored; S012, selecting whether to provide key prefix; S013, if a key prefix is provided, fcdb judges data change according to the value of the key prefix; and S014, if the key prefix is not provided, fcdb monitors all keys.
- 8. An apparatus for supporting in-memory data table snooping, the apparatus comprising: the definition module is used for defining 256 tables of the memory database Fcdb and storing data by using the kv database; The client monitoring judging module is used for detecting whether a client monitors a table to which the data belongs when the data changes, and if the table to which the data belongs is not monitored by the client, the client monitoring judging module does not check; The monitoring judging module is used for judging whether the value of the key prefix is null or not if the table to which the data belongs is monitored by the client, if the value of the key prefix is null, the client monitors the whole table, and sends the key and the value to the corresponding client; And the monitoring matching module is used for notifying the corresponding monitoring client of the key and the value if the key of the table to which the data belongs is matched with the monitoring, and ignoring the update if the key is not matched with the monitoring client.
- 9. The apparatus for supporting memory data table snoop of claim 8, wherein there are 256 arrays in said memory in the definition module, each array having a number, said number having a value of 0-255.
- 10. The apparatus for supporting in-memory data table snoop of claim 9, wherein said number value corresponds to the id value of the table.
- 11. The apparatus for supporting in-memory data table snoop of claim 8, wherein said client in said client snoop decision module stores a client structure in the database, the client structure having the function of snooping multiple tables.
- 12. The apparatus for supporting in-memory data table snoop of claim 11, wherein said database has a snoop list, said snoop list comprising table ids and table directives listens, if listens is not null, indicating that a client is listening to the table.
- 13. The apparatus for supporting in-memory data table snoop of claim 8, wherein the prefix in the snoop decision module is defined by the user.
- 14. The apparatus for supporting in-memory data table snooping as set forth in claim 8, wherein the Fcdb further comprises: The selection module is used for providing the number of the table to be monitored; The judging module is used for selecting whether the key prefix is provided, if the key prefix is provided, fcdb judges the data change according to the value of the key prefix, and if the key prefix is not provided, fcdb monitors all keys.
Description
Method and device for supporting memory data table monitoring Technical Field Embodiments of the present invention relate generally to the field of memory database technologies, and in particular, to a method and apparatus for supporting memory data table monitoring. Background With the continued development of information technology, a wide variety of databases have emerged, and in order to manipulate data tables, data objects, etc. in the databases, database providers have provided database-based manipulation actions, such as data manipulation language (Data Manipulation Language, DML) operations, which may include insert operations, delete operations, update operations, etc. when developing the databases. When the database exists for the operation, the database records the operation log information generated by the operation. However, under the access pressure of instantaneously high concurrent high traffic, the traditional relational database is overwhelmed, so that the service of the system is slowed down, and the concurrency capability of the system is greatly affected. And the snoop event of the Redis database is that only keys can be returned and no value is returned. The method comprises the steps of initializing buffer data, loading data in the Zookeeper into a memory of each node after each node of a distributed system is started, deploying subscription monitoring, defining a subscription monitoring method, subscribing a Zookeeper catalog and data for each node, deploying monitoring, and synchronizing the data, wherein after the change of the data in the Zookeeper is monitored, the memory data of each node is updated through the deployed monitoring method, and the data synchronization among the nodes is kept. According to the invention, the Zookeeper component is used as a cache data synchronization manager in the distributed architecture system, the cache data of the distributed multi-node is synchronized in real time by utilizing a release and subscription mechanism of the Zookeeper, and meanwhile, the data access speed is greatly improved by the Zookeeper database based on the memory, so that the performance and the data consistency are well improved in the distributed architecture system, but the problems that the service of the system is slow and the value is not returned under the access pressure of instantaneous high concurrent high flow are not solved. Disclosure of Invention In order to solve the problems, the memory database Fcdb stores data by using a kv database, which has high concurrency processing capability, the memory database Fcdb checks the interception of the corresponding table for each key, if yes, the notification is carried out, the key+value is returned, and in addition, prefix matching can be carried out on the intercepted keys. According to the embodiment of the invention, a method and a device for supporting memory data table monitoring are provided. In a first aspect of the present invention, a method for supporting in-memory data table snooping is provided. The method comprises the following steps: S01, defining 256 tables of a memory database Fcdb, and storing data by using a kv database; S02, when the data is changed, fcdb detects whether a client monitors the table; s03, if the table is not monitored by the client, not checking; s04, if the table is monitored by the client, judging whether the value of the key prefix is null, if the value of the key prefix is null, indicating that the client monitors the whole table, and sending the key and the value to the corresponding client; s05, if the value of the key prefix is not null, judging whether the key of the table is monitored or not in a prefix matching mode; S06, if the key of the table is matched with the monitoring, the key and the value are notified to the corresponding monitoring client, and if the key is not matched with the monitoring client, the updating is ignored. Further, the memory in S01 has 256 arrays, each array has a number, and the number is 0 to 255. Further, the number value corresponds to the id value of the table. Further, the client described in S02 stores a client structure in the database, where the client structure has a function of listening to a plurality of tables. Further, the database has a listening list, where the listening list includes the id of the table and listens pointed to by the table, and if listens is not null, it indicates that the client listens to the table. Further, the prefix described in S02 is defined by the user. Further, fcdb has a function of monitoring, which specifically includes the following steps: s011, providing the number of a table to be monitored; S012, selecting whether to provide key prefix; s013, if a key prefix is provided, fcdb judges data change according to the key prefix; and S014, if the key prefix is not provided, fcdb monitors all keys. In a second aspect of the present invention, an apparatus for supporting in-memory data table snooping is pr