CN111597185B - Real-time state number rapid statistical method based on tree structure resource distribution - Google Patents

Real-time state number rapid statistical method based on tree structure resource distribution Download PDF

Info

Publication number
CN111597185B
CN111597185B CN202010252100.9A CN202010252100A CN111597185B CN 111597185 B CN111597185 B CN 111597185B CN 202010252100 A CN202010252100 A CN 202010252100A CN 111597185 B CN111597185 B CN 111597185B
Authority
CN
China
Prior art keywords
tree
node
resource
nodes
statistics
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010252100.9A
Other languages
Chinese (zh)
Other versions
CN111597185A (en
Inventor
马兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Infineon Information Co ltd
Original Assignee
Shenzhen Infineon Information Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Infineon Information Co ltd filed Critical Shenzhen Infineon Information Co ltd
Priority to CN202010252100.9A priority Critical patent/CN111597185B/en
Publication of CN111597185A publication Critical patent/CN111597185A/en
Application granted granted Critical
Publication of CN111597185B publication Critical patent/CN111597185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of business systems, and particularly discloses a real-time state number rapid statistical method based on tree-like structure resource distribution, which comprises the steps of constructing an organization tree or a regional tree with an n-ary tree structure in a business system or a video monitoring system for storing and displaying resource data; hanging various resource data on each node of the n-ary tree to be used as a leaf node of the tree; when initializing the tree, counting the states of all leaf node resources under each non-leaf node of each layer from bottom to top from the deepest layer of non-leaf nodes of the tree, and storing a statistic set under the node; when the resource state of a certain node changes, searching the shortest path upwards to the root node, carrying out re-statistics on the nodes under the path, and updating the statistics set under the nodes. Therefore, the quick and real-time statistics of the states of the tree-like distributed resources is realized.

Description

Real-time state number rapid statistical method based on tree structure resource distribution
Technical Field
The invention relates to the technical field of service systems, in particular to a real-time state number rapid statistical method based on tree-like structure resource distribution.
Background
The traditional service system, especially the security service application system, is generally distributed and rendered and displayed in a tree structure for various service resources. When various states of various resources are required to be counted in real time, the distribution and all states of all the resources are often stored in a relational database, such as mysql, oracle, sqlserver and the like, and then resource state counting results of each organization or region are obtained in a sql statement searching and counting mode; the conventional method is to directly carry out traversal statistics based on the resources rendered and displayed by the tree, and the method is to carry out real-time traversal and statistics on all nodes of the tree according to the period or the requirement, and each traversal and statistics can carry out multiple accesses on the sub nodes. The two conventional statistical methods have very low statistical performance and poor real-time performance when tree distribution is deep and the number of resources is large, such as tree depth is more than 5 layers and 6 layers, and the number of resources is more than tens of thousands to hundreds of thousands.
Disclosure of Invention
The invention aims to solve the defects in the prior art, and provides a real-time state number rapid statistical method based on tree-like structure resource distribution.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
a real-time state number rapid statistical method based on tree structure resource distribution comprises the following steps:
s1, constructing an organization tree or a regional tree of an n-ary tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
s2, counting the states of all leaf node resources under each non-leaf node in the tree according to layers from bottom to top;
and S3, searching the shortest path from the root node, and triggering one-time resource state statistics for the non-leaf nodes under the path.
Preferably, the n-ary tree includes nodes representing tissues or regions as non-leaf nodes of the tree.
Preferably, the n-ary tree includes nodes representing service resources as leaf nodes of the tree.
Preferably, in the n-ary tree, each non-leaf node stores key attributes of the organization or region, and all leaf node resource status statistics sets of the node.
Preferably, in the n-ary tree, each tree node can accurately access a parent node, and can also accurately access all child nodes.
Preferably, the step S2 includes the steps of:
s21, when initializing service resource data and constructing an n-ary tree, carrying out first statistics on resource states according to organization or regional nodes, and taking the first statistics as an initial value of a resource state statistical data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree nodes;
step S23, calculating a resource state statistical data set of each node of each layer, wherein the calculation is dependent on the resource state statistical data sets of all sub-nodes of the node and a leaf node resource state set under the node;
in step S24, the resource status of each leaf node is traversed and counted only once.
Preferably, in the step S3, the situation of searching the shortest path to the root node and performing the state statistics of the node resources occurs when the state of a certain leaf node resource changes, and the parent node of the node is used as a starting point to find the shortest path up to the root node, and the recalculation of the resource state statistics set is triggered once for all nodes under the shortest path.
Preferably, the node statistics in the shortest path is performed by a bottom-up method, so that the resource state statistical data set of the parent node needs to be calculated by relying on the resource state statistical data set of the child node.
Preferably, the resource status statistical data set is classified according to resource types, classified according to resource statuses, and a data set obtained by summing the same statuses of the same types is obtained.
The beneficial effects of the invention are as follows:
the scheme provided by the invention adopts a method for carrying out statistics according to layers and shortest paths: counting the initial state in a layer mode, and accessing each node at most once; the method adopts the shortest path mode to change the state of the resource, and triggers statistics and update to the associated nodes, thereby achieving the purpose of accurate and rapid statistics and effectively solving the problems of low state statistics performance and low real-time performance of tree-like distributed resources in a service system.
Drawings
Fig. 1 is a logic schematic diagram of a method for rapidly counting real-time state numbers based on tree-like structure resource distribution according to the present invention.
Detailed Description
In order that the invention may be readily understood, a more complete description of the invention will be rendered by reference to the appended drawings. The drawings illustrate preferred embodiments of the invention. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "fixed to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like are used herein for illustrative purposes only and are not meant to be the only embodiment.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items.
Examples
Referring to fig. 1, the present embodiment provides a method for fast statistics of real-time state numbers based on tree-like structure resource distribution, which includes the following steps:
s1, constructing an organization tree or a regional tree of an n-ary tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
s2, counting the states of all leaf node resources under each non-leaf node in the tree according to layers from bottom to top;
and S3, searching the shortest path from the root node, and triggering one-time resource state statistics for the non-leaf nodes under the path.
Further, the n-ary tree includes nodes representing tissues or regions as non-leaf nodes of the tree.
Further, the n-ary tree includes nodes representing service resources as leaf nodes of the tree.
Further, in the n-ary tree, each non-leaf node stores key attributes of the organization or region, and all leaf node resource status statistics sets of the node.
Furthermore, in the n-ary tree, each tree node can accurately access the parent node, and can also accurately access all child nodes.
Further, the step S2 includes the following steps:
s21, when initializing service resource data and constructing an n-ary tree, carrying out first statistics on resource states according to organization or regional nodes, and taking the first statistics as an initial value of a resource state statistical data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree nodes;
step S23, calculating a resource state statistical data set of each node of each layer, wherein the calculation is dependent on the resource state statistical data sets of all sub-nodes of the node and a leaf node resource state set under the node;
in step S24, the resource status of each leaf node is traversed and counted only once.
Further, in step S3, the situation of searching the shortest path to the root node and performing the state statistics of the node resources occurs when the state of a certain leaf node resource changes, and the parent node of the node is used as a starting point to find the shortest path up to the root node, so as to trigger the recalculation of the resource state statistics set once for all nodes under the shortest path.
Further, the node statistics in the shortest path is performed by the child node from bottom to top, so that the resource state statistical data set of the parent node needs to be calculated by relying on the resource state statistical data set of the child node.
Further, the resource state statistical data set is classified according to the resource type, classified according to the resource state, and a data set obtained by summing the same states of the same type is obtained.
Specifically, in this embodiment, an organization tree with an n-ary tree structure is constructed in a doubly linked list manner, and organization nodes are divided into an xxx province, an xxx public security office, an xxx district (county) branch office, an xxx dispatching office, and an xxx street from top to bottom in a hierarchical manner, where the xxx province is used as a root node of the tree; hanging equipment resources such as cameras, decoders, NVRs and the like under provinces, cities, districts (counties), dispatching houses and streets on corresponding nodes to serve as leaf nodes of an organization tree; the equipment resource is used as a leaf node of the tree, and the current on-line, off-line, video recording, alarming, abnormal, normal and other state information of the equipment is stored; and counting the state numbers of equipment resources in all leaf nodes (including descendent leaf nodes) under each organization node from bottom to top according to the layers of the organization nodes, starting from the organization node of the deepest layer.
Preferably, the counting the number of resource states of each organization node by layer includes:
(1) And calculating the state numbers of all leaf node equipment resources under the organization node.
(2) And obtaining a resource state statistical data set of all sub-organization nodes under the organization node.
(3) Classifying according to the equipment type and the state type, classifying and summing the resource state number of the leaf nodes of the organization nodes and the resource state statistical data set of the sub-organization nodes to obtain the resource state statistical data set of each organization node of each layer.
(4) And storing the resource state statistical data set on each organization node in a two-dimensional array structure mode to serve as a resource state statistical result of the organization node.
Further, when the state of a certain leaf node equipment resource changes, only the father node of the leaf node is needed to be found, a shortest path is found for the root node xxx province by taking the father node as a starting point, streets, dispatching places, areas (counties), cities and provinces to which the equipment resource belongs are found, and then statistics of the equipment resource states of the organization nodes under the path are triggered once.
Preferably, the counting the device resource status of the organization node under the shortest path includes:
(1) From bottom to top, the number of device resource states under the sub-organization nodes must be counted first, and the resource state statistics data set is updated.
(2) And counting the number of the leaf node equipment resource states by the father organization node.
(3) And the father organization node acquires the resource state statistical data set of the child organization.
(4) Classifying according to the device type and the state type, classifying and summing the resource state number of the leaf node of the father organization node and the resource state statistical data set of the child organization node to obtain the resource state statistical data set of the father organization node, and updating.
The method utilizes the structural characteristics of the n-ary tree, respectively adopts a mode of layering and shortest path to carry out real-time statistics on the tree-like distributed resources and states thereof, and effectively solves the statistics problems of low performance and poor real-time performance based on SQL sentences and relational databases or by repeatedly traversing node trees.
Assuming that the organization structure of the tree has more than 5 layers, the number of equipment such as camera, decoder, NVR and the like is more than 30 ten thousand (tables), the method can greatly improve and improve the performance and real-time performance of resource state statistics.
The foregoing is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical scheme of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.

Claims (7)

1. A real-time state number rapid statistical method based on tree structure resource distribution is characterized by comprising the following steps:
s1, constructing an organization tree or a regional tree of an n-ary tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
s2, counting the states of all leaf node resources under each non-leaf node in the tree according to layers from bottom to top;
step S3, searching the shortest path to the root node, triggering one-time resource state statistics to the non-leaf node under the path
Wherein, the step S2 includes the following steps:
s21, when initializing service resource data and constructing an n-ary tree, carrying out first statistics on resource states according to organization or regional nodes, and taking the first statistics as an initial value of a resource state statistical data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree nodes;
step S23, calculating a resource state statistical data set of each node of each layer, wherein the calculation is dependent on the resource state statistical data sets of all sub-nodes of the node and a leaf node resource state set under the node;
step S24, the resource state of each leaf node is traversed and counted only once;
in the step S3, the situation of searching the shortest path to the root node and performing the state statistics of the node resources occurs when the state of a certain leaf node resource changes, and the parent node of the node is used as a starting point to find the shortest path upwards to the root node, so as to trigger the recalculation of the resource state statistics set once for all nodes under the shortest path.
2. The method of claim 1, wherein the n-ary tree includes nodes representing organization or region as non-leaf nodes of the tree.
3. The method for rapid statistics of real-time state numbers based on tree-structured resource distribution according to claim 1, wherein the n-ary tree comprises nodes representing service resources as leaf nodes of the tree.
4. The method according to claim 1, wherein each non-leaf node in the n-ary tree stores key attributes of the organization or region and all leaf node resource status statistics of the node.
5. The method for rapidly counting real-time state numbers based on tree-structured resource distribution according to claim 1, wherein each tree node in the n-ary tree can accurately access a parent node or can accurately access all child nodes.
6. The method for rapidly counting the number of real-time states based on the distribution of tree-like resources according to claim 5, wherein the nodes in the shortest path are counted in a bottom-up manner, and the child nodes count first, so that the resource state statistical data set of the parent node needs to be calculated depending on the resource state statistical data set of the child nodes.
7. The method for rapid statistics of real-time status numbers based on tree-structured resource distribution according to claim 6, wherein said resource status statistics data set is classified by resource type, classified by resource status, and a data set obtained by summing the same status of the same type.
CN202010252100.9A 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution Active CN111597185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010252100.9A CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010252100.9A CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Publications (2)

Publication Number Publication Date
CN111597185A CN111597185A (en) 2020-08-28
CN111597185B true CN111597185B (en) 2023-04-28

Family

ID=72187298

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010252100.9A Active CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Country Status (1)

Country Link
CN (1) CN111597185B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116527982B (en) * 2023-06-01 2023-09-15 杭州威灿科技有限公司 Method and system for recording question synchronous audio and video
CN116501781B (en) * 2023-06-28 2023-09-12 中博信息技术研究院有限公司 Data rapid statistical method for enhanced prefix tree

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036795A (en) * 2011-05-23 2013-04-10 北京广联智能科技有限公司 Method and system for tree topology channel sharing network routing
CN103678138A (en) * 2014-01-03 2014-03-26 北京经纬恒润科技有限公司 Method and device for generating state conversion test samples
CN103699593A (en) * 2013-12-11 2014-04-02 中国科学院深圳先进技术研究院 Method and system for rapidly traversing generalized suffix tree
CN104283707A (en) * 2013-07-08 2015-01-14 株式会社日立制作所 Device and method for monitoring multistage tree structure system in real time
CN107590160A (en) * 2016-07-08 2018-01-16 阿里巴巴集团控股有限公司 A kind of method and device for monitoring radix tree internal structure
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8046373B2 (en) * 2009-01-25 2011-10-25 Hewlett-Packard Development Company, L.P. Structured parallel data intensive computing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036795A (en) * 2011-05-23 2013-04-10 北京广联智能科技有限公司 Method and system for tree topology channel sharing network routing
CN104283707A (en) * 2013-07-08 2015-01-14 株式会社日立制作所 Device and method for monitoring multistage tree structure system in real time
CN103699593A (en) * 2013-12-11 2014-04-02 中国科学院深圳先进技术研究院 Method and system for rapidly traversing generalized suffix tree
CN103678138A (en) * 2014-01-03 2014-03-26 北京经纬恒润科技有限公司 Method and device for generating state conversion test samples
CN107590160A (en) * 2016-07-08 2018-01-16 阿里巴巴集团控股有限公司 A kind of method and device for monitoring radix tree internal structure
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡维 ; 蒋艳凰 ; 刘光明 ; 董文睿 ; 崔新武 ; .E级超级计算机故障预测的数据采集方法.国防科技大学学报.2016,(01),全文. *

Also Published As

Publication number Publication date
CN111597185A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
CN106294888B (en) A kind of method for subscribing of the object data based on space-time database
CN106294887B (en) The description method to object existing for objective world and event based on space-time
CN103412897B (en) A kind of parallel data processing method based on distributed frame
CN111597185B (en) Real-time state number rapid statistical method based on tree structure resource distribution
CN109657074B (en) News knowledge graph construction method based on address tree
CN106815333A (en) A kind of wisdom gridding Regional Management System
CN108874988B (en) Retrieval method for data object
CN106933833A (en) A kind of positional information method for quickly querying based on Spatial Data Index Technology
CN109189863A (en) A method of description things time attribute is simultaneously searched based on the description
CN107194533B (en) Power distribution network full information model construction method and system
CN103678712A (en) Disaster information spatial-temporal database
Kan et al. Topology modeling and analysis of a power grid network using a graph database
Ding et al. Massive heterogeneous sensor data management in the Internet of Things
CN108776678A (en) Index creation method and device based on mobile terminal NoSQL databases
Aydin et al. Batch to real-time: Incremental data collection & analytics platform
CN105956012B (en) Database schema abstract method based on figure partition strategy
Challal et al. Document-oriented versus column-oriented data storage for social graph data warehouse
CN110825744A (en) Air quality monitoring big data partition storage method based on cluster environment
CN115309747A (en) Fire fighting management method and platform based on spatial grid data and electronic equipment
Marple et al. Collapsing corporate confusion: Leveraging network structures for effective entity resolution in relational corporate data
CN107609136A (en) Based on the autonomous controlled data storehouse auditing method and system for accessing feature indication
Zulkarnain et al. Big Data Governance for Building A Smart Cities
CN109977547A (en) Big data bulletin generation method based on dynamic modeling
CN111400278A (en) Method and system for constructing multi-level target crowd based on label dragging
CN112883238B (en) Multi-tree data storage system and method for traffic information application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20230106

Address after: 518000 Yingfei Haocheng Science Park, Guansheng 5th Road, Luhu Community, Guanhu Street, Longhua District, Shenzhen, Guangdong 1515

Applicant after: Shenzhen Infineon Information Co.,Ltd.

Address before: 518110 Room 301, Infineon Technology Co., Ltd., No. 12, Guanbao Road, Luhu community, Guanhu street, Longhua District, Shenzhen City, Guangdong Province

Applicant before: SHENZHEN INFINOVA INTELLIGENT TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant