CN106294546A - A kind of method of memory storage particular device port status data - Google Patents

A kind of method of memory storage particular device port status data Download PDF

Info

Publication number
CN106294546A
CN106294546A CN201610587164.8A CN201610587164A CN106294546A CN 106294546 A CN106294546 A CN 106294546A CN 201610587164 A CN201610587164 A CN 201610587164A CN 106294546 A CN106294546 A CN 106294546A
Authority
CN
China
Prior art keywords
port
data
equipment
information
caching
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.)
Granted
Application number
CN201610587164.8A
Other languages
Chinese (zh)
Other versions
CN106294546B (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.)
BEIJING ENOVELL TECHNOLOGY Co Ltd
Original Assignee
BEIJING ENOVELL TECHNOLOGY 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 BEIJING ENOVELL TECHNOLOGY Co Ltd filed Critical BEIJING ENOVELL TECHNOLOGY Co Ltd
Priority to CN201610587164.8A priority Critical patent/CN106294546B/en
Publication of CN106294546A publication Critical patent/CN106294546A/en
Application granted granted Critical
Publication of CN106294546B publication Critical patent/CN106294546B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/25Integrating or interfacing systems involving database management systems
    • 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/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A kind of method of memory storage particular device port status data, start an internal storage state data, services process to include: applying for two parts of cache set, each cache set includes: equipment Hash list caching, facility information caching, port information caching, status data caching;Previous cache set deposits previous memory cycle device status data, and later cache set deposits currently stored periodic device status data;Connect data base, generate equipment the acquisition granularity caching;Periodically read acquisition tasks table more new equipment the acquisition granularity caching;Each memory cycle Mo, switch the data in two cache set, after switching and empty the data in later cache set;From device status data table, read the device status data to current time of previous time started memory cycle, and be stored in caching;Start HTTP and monitor service, wait that reception processes teledata inquiry and data update request.The present invention can accomplish the self adaptation of committed memory size, it is to avoid internal memory is wasted.

Description

A kind of method of memory storage particular device port status data
Technical field
A kind of method that the present invention relates to memory storage particular device port status data.Particularly relate to a kind of support soon The method of the memory storage particular device port status data of status data is ask in quick checking.
Background technology
Current informationization has come into big data age, and network service is more and more abundanter, and network speed significantly promotes, network Business, office etc. are the most convenient, and the more and more activity of people relies on network.Network traffics are sharply increased, network equipment number According to process, storage just seem increasingly important.
For the data volume of TB rank easily, conventional relevant database also is able to accomplish well to store.Update not In the case of frequently, the inquiry velocity of conventional relevant database is the most fine.
But huge for data volume, every day, the renewal of more than one hundred million data stored, and required quickly inquiry, conventional simultaneously Relevant database then cannot guaranteed efficiency.
In consideration of it, how should well structure store, ensure stable quickly inquiry again, just seem the most urgent.
Although some NoSQL data bases can accomplish well to store and inquire about data, but data structured aspect is more single One, simple key=value character storage mode can only be supported.
Summary of the invention
The technical problem to be solved is to provide a kind of supports that the memory storage of quick search status data is specific The method of device port status data.
The technical solution adopted in the present invention is: a kind of method of memory storage particular device port status data, first Starting an internal storage state data, services process, process is forever run, status service process execution following steps:
1) two parts of cache set of application: the first cache set and the second cache set;Each cache set includes: equipment Hash list is delayed Deposit, facility information caching, port information cache and status data caching;First cache set deposits previous memory cycle equipment shape State data, the second cache set deposits currently stored periodic device status data;Application global access controls Read-Write Locks, enters next Step;
2) connect data base, inquire about acquisition tasks table, read equipment the acquisition granularity information, generate equipment the acquisition granularity and delay Deposit, enter next step;
3) starting device the acquisition granularity buffer update thread, periodically reads acquisition tasks table more new equipment the acquisition granularity Caching, enters next step;
4) start data exchange thread, each memory cycle Mo, switch the data in the first cache set and the second cache set, After switching and empty the data in the second cache set, enter next step;
5) start historical data initialization thread, connect data base, from device status data table, read previous storage Period Start Time is to the device status data of current time, and is stored in caching, enters next step;
6) start HTTP and monitor service, wait that reception processes teledata inquiry and data update request.
The method of a kind of memory storage particular device port status data of the present invention, has a characteristic that
1. gather the status data of partition of the level storage clearly, facility level data, port rank data, time number of levels According to;
2. use Hash table or storage of array different stage data, such that it is able to use hash code or natural index number Group subscript rapidly locating;
3. stored memory recycling, it is not necessary to repeat frequently to apply for releasing memory;
4. along with the change of data volume, the self adaptation of committed memory size can be accomplished, it is to avoid internal memory is wasted.
Accompanying drawing explanation
Fig. 1 is that datarams stores schematic diagram;
Fig. 2 is three rank data relationship schematic diagrams.
Detailed description of the invention
The method to a kind of memory storage particular device port status data of the present invention below in conjunction with embodiment and accompanying drawing It is described in detail.
The method of a kind of memory storage particular device port status data of the present invention, is to divide difference according to data statistics Several times, including facility level data, port rank data, time point rank data, each rank data use Hash table or number Prescription formula stores, and the other data of upper level directly quote next stage data, thus realize data structured storage, ensure that height simultaneously The inquiry service of effect.
Additionally, data buffer storage once applies for recycling, it is to avoid internal memory application release operation frequently.Clothes for a long time Business, along with the change of data volume, can automatically increase or decrease EMS memory occupation amount, reach internal memory self adaptation effect.
The method of a kind of memory storage particular device port status data of the present invention, first starts an internal storage state number According to service processes, process is forever run, status service process execution following steps:
1) two parts of sufficiently large cache set of application: the first cache set and the second cache set;Each cache set includes: equipment Hash list caching, facility information caching, port information caching and status data caching;First cache set deposits previous storage Periodic device status data, the second cache set deposits currently stored periodic device status data;Application global access controls read-write Lock, enters next step;
Described equipment Hash list caching is a Hash table, uniquely identifies according to equipment and carries out Hash operation and set Standby hash code, uses equipment hash code can directly position element in equipment Hash table, and in Hash table, each element is deposited Storing up a pointer, pointer points to a linked list head node, and chained list each node elements value is a facility information pointer, and sensing sets A certain position in standby information cache.
Described facility information caching is the array of a storing device information, when needing to apply for new facility information internal memory Time, then from facility information caches, distribute an array element be used for storing device information;Facility information includes: equipment is uniquely marked Knowledge, equipment state the acquisition granularity, equipment each port storage status data value maximum quantity, device port status data Hash row Table and device level thread lock;Wherein one pointer of device port status data Hash list each element storage, pointer points to one Individual port information linked list head node, in chained list, each node elements value is a port information pointer, points to port information caching In a certain position.
Described port information caching is the array of a storage port information, when needing to apply for new port information internal memory Time, then from port information caches, distribute an array element be used for storage port information;Port information includes: the hash of port Maximum subscript that code, the service marker of port, port status array of data, port status array of data have used and port level Thread lock;The hash code of its middle port is to perform Hash calculation according to port traffic labelling to obtain;Port status array of data Being one section of contiguous memory in status data caching, each element of array is one group of status information, and described status information includes All status datas to be stored.
2) connect data base, inquire about acquisition tasks table, read equipment the acquisition granularity information, generate equipment the acquisition granularity and delay Deposit, enter next step;
Described connection data base, inquires about acquisition tasks table, reads equipment the acquisition granularity information, generates equipment the acquisition granularity Caching, is to be connected to data base according to the database access parameter in configuration, reads equipment the acquisition granularity letter in acquisition tasks table Breath, and store equipment the acquisition granularity caching.Wherein equipment the acquisition granularity information such as table 1 in acquisition tasks table, including: equipment is only One mark and equipment the acquisition granularity (secondary/N minute);Equipment the acquisition granularity caching is a Hash array, uniquely marks according to equipment Knowledge carries out Hash calculation and obtains equipment hash code, according to equipment hash code location equipment the acquisition granularity in Hash array Storage position, deposit in array element is equipment the acquisition granularity numerical value.
Table 1
Equipment uniquely identifies Equipment the acquisition granularity (secondary/N minute)
x.x.x.x 1M (1 minute)
x.x.x.x 5M (5 minutes)
…… ……
3) starting device the acquisition granularity buffer update thread, periodically reads acquisition tasks table more new equipment the acquisition granularity Caching, enters next step;It is responsible for periodically more new equipment the acquisition granularity caching, its thread including starting a new thread Execution step is as follows:
(1) thread start, enter dormancy, one equipment the acquisition granularity buffer update week after date, perform next step;
(2) connect data base, enter next step;
(3) create an interim equipment the acquisition granularity caching, enter next step;
(4) from data base's acquisition tasks table, all of equipment the acquisition granularity information, and the collection that will read are read in circulation Granular information puts into interim equipment the acquisition granularity caching, enters next step;
(5) use interim equipment the acquisition granularity caching to replace old equipment the acquisition granularity caching, and discharge old equipment The acquisition granularity caches, and enters next step;
(6) turn-off data storehouse link, performs (1st) step.
4) start data exchange thread, each memory cycle Mo, switch the data in the first cache set and the second cache set, After switching and empty the data in the second cache set, enter next step;Including: start a new thread and be responsible for depositing each The end of term in storage week switches cache set data and empties the data in the second cache set, and the second cache set is used for storing a new memory cycle Data, its thread perform step as follows:
(1) thread sleep, after 1 minute, performs next step;
(2) judge whether the time is to terminate a memory cycle, be, enter next step, no, (1st) step;
(3) obtain global access and control to write lock, enter next step;
(4) create interim equipment Hash list buffer pointers, facility information buffer pointers, port information buffer pointers, Status data buffer pointers, the equipment Hash list caching being respectively directed in the first cache set, facility information caching, port information Caching, status data caching, enters next step;
(5) by the equipment Hash list caching in the second cache set, facility information caching, port information caching, status number Move on in the first cache set according to caching, enter next step;
(6) by the interim equipment Hash list buffer pointers created in (4th) step, facility information buffer pointers, port After data in the caching that information cache pointer and status data buffer pointers are pointed to empty, described equipment Hash list is delayed Deposit pointer, facility information buffer pointers, port information buffer pointers and status data buffer pointers and move in the second cache set, It is used for storing the device status data in a new cycle, enters next step;
(7) release global access controls to write lock, performs (1st) step.
5) start historical data initialization thread, connect data base, from device status data table, read previous storage Period Start Time is to the device status data of current time, and is stored in caching, enters next step;Including starting a new line Journey is responsible for reading previous time started memory cycle from database facility status data table to setting in current time frame Standby status data, it is as follows that its thread performs step:
(1) connect data base, perform next step;
(2) read device status data table, take out one from previous time started memory cycle to current time and set Standby status data, if there is a device status data, performs next step, if there is no a device status data, Perform step (6);
(3) decompose the one article of device status data taken out in (2nd) step, obtain equipment uniquely identify, port traffic labelling, According to the time, time and status information, judge that data should be stored in in a cache set, or in the second cache set, it is right to find The equipment Hash list answering cache set caches, and mark unique to equipment carries out Hash operation and obtain equipment hash code, according to setting Standby hash code, uniquely identifies at facility information chain to facility information chained list according to equipment in equipment Hash list cache lookup Table is searched facility information, if there is facility information, enters next step, if there is no facility information, then believe from equipment In breath caching, a facility information internal memory of application, is stored in facility information, delays according to equipment unique identifier lookup equipment the acquisition granularity Deposit and obtain equipment the acquisition granularity, the acquisition granularity is stored facility information, and uses sum every day minute to obtain divided by the acquisition granularity Store status data value maximum quantity to each port of equipment, in the facility information that will newly apply for, leave facility information linked list head in Node location, enters next step;
(4) decompose, according to (3rd) step, the port traffic labelling that the one article of device status data taken out in (2nd) step obtains, Obtain port hash code by Hash operation, look in device port status data Hash list according to port hash code Find port information chained list, be marked in port information chained list lookup port information according to port traffic, believe if there is port Breath, enters next step, and if there is no port information, then a port information internal memory of application from port information caches, deposits Ingress port information, and according to equipment each port storage status data value maximum quantity in the facility information obtained in (3rd) step Sufficiently large contiguous memory is applied for, by interior pointer assignment to the port status number of port information in status data caches According to array, leave port information linked list head node location in the port information that will newly apply in, enter next step;
(5) decompose, according to (3rd) step, the time that the one article of device status data taken out in (2nd) step obtains, use the time The number of minutes on place same day obtains status information in port status array of data divided by the equipment the acquisition granularity in facility information Storage position, obtain status information internal memory, (3rd) step decomposed the one article of device status data taken out in (2nd) step and obtains Time, status information be stored in status information internal memory, perform (2nd) step;
(6) turn-off data storehouse link, terminates thread.
6) start HTTP and monitor service, wait that reception processes teledata inquiry and data update request.Including starting one Individual network HTTP listening port, moment etc. is to be received and processes teledata inquiry and data update HTTP access request, wherein It is as follows that monitoring processes step:
(1) start a network HTTP listening port, perform next step;
(2) wait that remote access request arrives, when a request arrives, perform next step;
(3) start a new request processing thread, be responsible for processing access request, (2nd) step.
One new request processing thread of startup described in (3rd) step, is responsible for processing access request, is that startup one is new Thread, read access request parameter, and carry out processing and responding request according to parameter, including:
() read requests accesses parameter, performs next step;
Described request accesses parameter, accesses parameter and more newly requested access parameter two kinds including inquiry request.Described Inquiry request accesses parameter and includes: the unique identification list of request type, port, inquiry reference time data time started, inquiry The reference time data end time;The unique identification list of described port comprises multiple port and uniquely identifies, and each port is unique Mark includes: port traffic mark, equipment uniquely identify.Described more newly requested access parameter comprises multiple data cell, often Individual data cell includes: port uniquely identifies, status information, the time.
Wherein request form is as follows with parameter format:
The form of (a) data inquiry request and parameter
Request form:
Type=select&bus_pri_key=key1, key2, ... &start_time=yyyy-mm-dd_hh:mi: Ss&end_time=yyyy-mm-dd_hh:mi:ss
Required parameter:
Type: query type, value is fixed as select;
The unique identification list of bus_pri_key: port, uniquely identifies including multiple ports, and port uniquely identifies use ", " Segmentation, its middle port uniquely identifies form for " port traffic labelling _ equipment uniquely identifies "
Start_time: the time started of inquiry reference time data, form is " yyyy-mm-dd_hh:mi:ss "
End_time: the end time of inquiry reference time data, form is " yyyy-mm-dd_hh:mi:ss "
The more newly requested form of (b) data and parameter
Request form:
Data=<data_unit>;<data_unit>;…
Required parameter:
Data: data_unit list to be updated, use between data_unit ";" separate
Data_unit form: bus_pri_key, status_data, time
The unique identification list of bus_pri_key: port, uniquely identifies including multiple ports, and port uniquely identifies use ", " Segmentation, its middle port uniquely identifies form for " port traffic labelling _ equipment uniquely identifies "
Status_data: port status information
Time: the statistic time, form is " yyyy-mm-dd_hh:mi:ss "
() analysis request parameter, it is judged that request is inquiry request or more newly requested, if inquiry request, performs number According to query processing logic, if more newly requested, perform data renewal and process logic, enter next step;
Described data query processes logic, including:
A () analyzes the inquiry reference time data time started, inquire about the reference time data end time, if the time started It is later than current time, or the end time is early than previous time started memory cycle, or the time started is later than the end time, knot Bundle processes, and otherwise, creates the interim chained list of port information, performs next step;
A b port that () takes out in the unique identification list of required parameter port uniquely identifies, if there is a port Unique mark, performs next step, uniquely identifies if there is no a port, performs (e) step;
C () is decomposed the port that (b) step takes out and is uniquely identified and obtain port traffic labelling and equipment uniquely identifies, according to looking into Asking the reference time data time started, the inquiry reference time data end time judges that data to be asked are numbers in cache set one According to, or data in cache set two, finding the equipment Hash list caching of corresponding cache set, mark unique to equipment carries out Hash Computing obtains equipment hash code, according to equipment hash code in equipment Hash list cache lookup to facility information chained list, Uniquely identify lookup facility information in facility information chained list according to equipment, if there is facility information, enter next step, if There is not facility information, perform (b) step;
D () uniquely identifies, according to the port decomposing the taking-up of (b) step in (c) step, the port traffic labelling obtained, pass through Hash operation obtains port hash code, according to port hash code equipment in the facility information that (c) step finds Port status data Hash list finds port information chained list, is marked in port information chained list lookup according to port traffic Port information, if there is port information, joins the port information created in (a) step interim by the port information found Chained list, enters next step, if there is no port information, performs (b) step;
E () takes out a port information in the interim chained list of port information created in (a) step, if there is an end Message ceases, the port status array of data of read port information, by the status information time in status data array in inquiry data The time range time started, the device status data in the range of the inquiry reference time data end time is sent to HTTP client End, end processes, and if there is no a port information, the interim chained list of release port information, end processes.
Described renewal processes logic, including:
A () takes out a data cell in required parameter, if there is a data cell, perform next step, if There is not a data cell, end processes;
B () decomposes the data cell taken out in (a) step, obtain equipment uniquely identify, port traffic labelling, time Between, status information, judge that data should be stored in the first cache set according to the time, or in the second cache set, if neither It is the first cache set, is not the second cache set, abandon the data cell of taking-up, perform (a) step, otherwise, find corresponding slow Depositing the equipment Hash list caching of collection, mark unique to equipment carries out Hash operation and obtains equipment hash code, according to equipment Hash code, uniquely identifies at facility information chained list to facility information chained list according to equipment in equipment Hash list cache lookup Middle lookup facility information, if there is facility information, enters next step, if there is no facility information, then delays from facility information Deposit one facility information internal memory of middle application, storing device information, cache according to equipment unique identifier lookup equipment the acquisition granularity To equipment the acquisition granularity, the acquisition granularity stored in facility information and use all minute sums every day to obtain divided by the acquisition granularity Equipment each port storage status data value maximum quantity, leaves facility information chained list cephalomere in the facility information that will newly apply for Point position, enters next step;
C () decomposes, according to (b) step, the port traffic labelling that the data cell taken out in (a) step obtains, pass through Hash operation obtains port hash code, according to port hash code at device port status data Hash list lookup to end Mouth information chained list, is marked in port information chained list lookup port information according to port traffic, if there is port information, enters Next step, if there is no port information, then a port information internal memory of application from port information caches, is stored in port letter Breath, and according to equipment each port storage status data value maximum quantity in the facility information obtained in (b) step at status number According to applying for sufficiently large contiguous memory in caching, the port status array of data of association contiguous memory to port information, by new Shen Leave port information linked list head node location in port information please in, enter next step;
D () decomposes, according to (b) step, the time that the data cell taken out in (a) step obtains, use time place The number of minutes on the same day determines status information depositing in port status array of data divided by the equipment the acquisition granularity in facility information Storage space is put, and obtains status information internal memory, by decomposition (a) step take out a data cell obtain time, status information It is stored in status information internal memory, performs (a) step.
() closes HTTP link, terminates thread.
As it is shown in figure 1, be that datarams stores schematic diagram, equipment Hash list caching comprises the multiple chained list of facility information, Facility information chained list comprises multiple facility information, and each facility information comprises a device port information Hash table, device port Information Hash table comprises multiple port information chained list, and port information chained list comprises multiple port information, and each port information comprises One seasonal effect in time series status information array, in array, each element is one group of status information data.
As in figure 2 it is shown, be three rank data relationship schematic diagrams, device level data are that the data in units of equipment are deposited Storage, comprise equipment uniquely identify, equipment state the acquisition granularity, equipment each port storage status data value maximum quantity, equipment Port status data Hash list, device level thread lock;Port level data are the data storages in units of port, comprise port Hash code, the service marker of port, port status array of data, port status array of data used maximum subscript, Port level thread lock;Time Series is according to being the data storage in units of equipment state the acquisition granularity, and wherein data are certain a period of time Carve status information data.

Claims (11)

1. the method for memory storage particular device port status data, it is characterised in that first start an internal storage state Data, services process, process forever runs, and status service process performs following steps:
1) two parts of cache set of application: the first cache set and the second cache set;Each cache set includes: equipment Hash list caching, Facility information caching, port information caching and status data caching;First cache set deposits previous memory cycle equipment state Data, the second cache set deposits currently stored periodic device status data;Application global access controls Read-Write Locks, enters next step Suddenly;
2) connect data base, inquire about acquisition tasks table, read equipment the acquisition granularity information, generate equipment the acquisition granularity caching, enter Enter next step;
3) starting device the acquisition granularity buffer update thread, periodically reads acquisition tasks table and more new equipment the acquisition granularity delays Deposit, enter next step;
4) start data exchange thread, each memory cycle Mo, switch the data in the first cache set and the second cache set, switching Rear and empty the data in the second cache set, enter next step;
5) start historical data initialization thread, connect data base, read the previous memory cycle from device status data table Time started is to the device status data of current time, and is stored in caching, enters next step;
6) start HTTP and monitor service, wait that reception processes teledata inquiry and data update request.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 1) the equipment Hash list caching described in is a Hash table, uniquely identifies according to equipment and carries out Hash operation and obtain equipment Hash code, uses equipment hash code can directly position element in equipment Hash table, each element storage in Hash table One pointer, pointer points to a linked list head node, and chained list each node elements value is a facility information pointer, sensing equipment A certain position in information cache;
Step 1) described in facility information caching be the array of a storing device information, when needing to apply for new facility information During internal memory, then from facility information caches, distribute an array element be used for storing device information;Facility information includes: equipment is only One mark, equipment state the acquisition granularity, equipment each port storage status data value maximum quantity, device port status data Hash list and device level thread lock;Wherein one pointer of device port status data Hash list each element storage, pointer Pointing to a port information linked list head node, in chained list, each node elements value is a port information pointer, points to port letter A certain position in breath caching;
Step 1) described in port information caching be the array of a storage port information, when needing to apply for new port information During internal memory, then from port information caches, distribute an array element be used for storage port information;Port information includes: port Maximum subscript that hash code, the service marker of port, port status array of data, port status array of data have used and Port level thread lock;The hash code of its middle port is to perform Hash calculation according to port traffic labelling to obtain;Port status number Being one section of contiguous memory in status data caching according to array, each element of array is one group of status information, described state letter Breath includes all status datas to be stored.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 2) the connection data base described in, inquires about acquisition tasks table, reads equipment the acquisition granularity information, generates equipment the acquisition granularity and delays Deposit, be to be connected to data base according to the database access parameter in configuration, read equipment the acquisition granularity information in acquisition tasks table, And store equipment the acquisition granularity caching.Wherein in acquisition tasks table, equipment the acquisition granularity information includes: equipment uniquely identify and Equipment the acquisition granularity;Equipment the acquisition granularity caching is a Hash array, uniquely identifies according to equipment and carries out Hash calculation and obtain Equipment hash code, positions equipment the acquisition granularity storage position in Hash array, array unit according to equipment hash code Deposit in element is equipment the acquisition granularity numerical value.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 3) the starting device the acquisition granularity buffer update thread described in, periodically reads acquisition tasks table and more new equipment gathers grain Degree caching, is to start a new thread to be responsible for periodically more new equipment the acquisition granularity caching, and it is as follows that its thread performs step:
(1) thread start, enter dormancy, one equipment the acquisition granularity buffer update week after date, perform next step;
(2) connect data base, enter next step;
(3) create an interim equipment the acquisition granularity caching, enter next step;
(4) from data base's acquisition tasks table, all of equipment the acquisition granularity information, and the acquisition granularity that will read are read in circulation Information puts into interim equipment the acquisition granularity caching, enters next step;
(5) use interim equipment the acquisition granularity caching to replace old equipment the acquisition granularity caching, and discharge old equipment collection Granularity caches, and enters next step;
(6) turn-off data storehouse link, performs (1st) step.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 4) include that starting a new thread is responsible in switching cache set data of each memory cycle end and empties in the second cache set Data, the second cache set is used for storing the data of a new memory cycle, and it is as follows that its thread performs step:
(1) thread sleep, after 1 minute, performs next step;
(2) judge whether the time is to terminate a memory cycle, be, enter next step, no, (1st) step;
(3) obtain global access and control to write lock, enter next step;
(4) interim equipment Hash list buffer pointers, facility information buffer pointers, port information buffer pointers, state are created Data buffer storage pointer, the equipment Hash list caching being respectively directed in the first cache set, facility information caching, port information delay Deposit, status data caches, and enters next step;
(5) the equipment Hash list caching in the second cache set, facility information caching, port information caching, status data are delayed Deposit and move on in the first cache set, enter next step;
(6) by the interim equipment Hash list buffer pointers created in (4th) step, facility information buffer pointers, port information After data in the caching that buffer pointers and status data buffer pointers are pointed to empty, described equipment Hash list caching is referred to Pin, facility information buffer pointers, port information buffer pointers and status data buffer pointers move to, in the second cache set, be used for Store the device status data in a new cycle, enter next step;
(7) release global access controls to write lock, performs (1st) step.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 5) include that starting a new thread is responsible for reading previous time started memory cycle from database facility status data table Device status data in current time frame, it is as follows that its thread performs step:
(1) connect data base, perform next step;
(2) read device status data table, take out an equipment shape from previous time started memory cycle to current time State data, if there is a device status data, perform next step, if there is no a device status data, perform Step (6);
(3) decompose the one article of device status data taken out in (2nd) step, obtain equipment uniquely identify, port traffic labelling, the time And status information, judge that data should be stored in in a cache set according to the time, or in the second cache set, find corresponding slow Depositing the equipment Hash list caching of collection, mark unique to equipment carries out Hash operation and obtains equipment hash code, according to equipment Hash code, uniquely identifies at facility information chained list to facility information chained list according to equipment in equipment Hash list cache lookup Middle lookup facility information, if there is facility information, enters next step, if there is no facility information, then from facility information In caching, a facility information internal memory of application, is stored in facility information, caches according to equipment unique identifier lookup equipment the acquisition granularity Obtain equipment the acquisition granularity, the acquisition granularity is stored facility information, use sum every day minute to be set divided by the acquisition granularity Standby each port stores status data value maximum quantity, leaves facility information linked list head node in the facility information that will newly apply in Position, enters next step;
(4) decompose, according to (3rd) step, the port traffic labelling that the one article of device status data taken out in (2nd) step obtains, pass through Hash operation obtains port hash code, finds in device port status data Hash list according to port hash code Port information chained list, is marked in port information chained list lookup port information according to port traffic, if there is port information, enters Entering next step, if there is no port information, then a port information internal memory of application from port information caches, is stored in port Information, and according to equipment each port storage status data value maximum quantity in the facility information obtained in (3rd) step in state The contiguous memory of application in data buffer storage, by interior pointer assignment to the port status array of data of port information, will be new Leave port information linked list head node location in the port information of application, enter next step;
(5) decompose, according to (3rd) step, the time that the one article of device status data taken out in (2nd) step obtains, use time place The number of minutes on the same day obtains status information depositing in port status array of data divided by the equipment the acquisition granularity in facility information Storage space is put, and obtains status information internal memory, (3rd) step is decomposed that the one article of device status data taken out in (2nd) step obtains time Between, status information be stored in status information internal memory, perform (2nd) step;
(6) turn-off data storehouse link, terminates thread.
The method of a kind of memory storage particular device port status data the most according to claim 1, it is characterised in that step Rapid 6) including starting a network HTTP listening port, moment etc. is to be received and processes teledata inquiry and data update HTTP Access request, wherein monitoring process step is as follows:
(1) start a network HTTP listening port, perform next step;
(2) wait that remote access request arrives, when a request arrives, perform next step;
(3) start a new request processing thread, be responsible for processing access request, (2nd) step.
The method of a kind of memory storage particular device port status data the most according to claim 7, it is characterised in that the (3) one new request processing thread of the startup described in step, is responsible for processing access request, is to start a new thread, reads Access request parameters, and carry out processing and responding request according to parameter, including:
() read requests accesses parameter, performs next step;
() analysis request parameter, it is judged that request is inquiry request or more newly requested, if inquiry request, performs data and looks into Inquiry processes logic, if more newly requested, perform data renewal and processes logic, enter next step;
() closes HTTP link, terminates thread.
The method of a kind of memory storage particular device port status data the most according to claim 8, it is characterised in that institute Request described in the () step stated accesses parameter, accesses parameter and more newly requested access parameter two kinds including inquiry request.Institute The inquiry request stated accesses parameter and includes: the unique identification list of request type, port, the inquiry reference time data time started, The inquiry reference time data end time;The unique identification list of described port comprises multiple port and uniquely identifies, each port Unique mark includes: port traffic mark, equipment uniquely identify.Described more newly requested access parameter comprises multiple data sheet Unit, each data cell includes: port uniquely identifies, status information, the time.
The method of a kind of memory storage particular device port status data the most according to claim 8, it is characterised in that In described () step, data query processes logic, including:
A () analyzes the inquiry reference time data time started, inquire about the reference time data end time, if the time started is later than Current time, or the end time is early than previous time started memory cycle, or the time started is later than the end time, at end Reason, otherwise, creates the interim chained list of port information, performs next step;
A b port that () takes out in the unique identification list of required parameter port uniquely identifies, unique if there is a port Mark, performs next step, uniquely identifies if there is no a port, performs (e) step;
C () is decomposed the port that (b) step takes out and is uniquely identified and obtain port traffic labelling and equipment uniquely identifies, according to inquiry number According to the time range time started, the inquiry reference time data end time judges that data to be asked are data in cache set one, Or data in cache set two, find the equipment Hash list caching of corresponding cache set, and mark unique to equipment carries out Hash fortune Calculation obtains equipment hash code, according to equipment hash code in equipment Hash list cache lookup to facility information chained list, root Uniquely identify lookup facility information in facility information chained list according to equipment, if there is facility information, enter next step, if not There is facility information, perform (b) step;
D () uniquely identifies, according to the port decomposing the taking-up of (b) step in (c) step, the port traffic labelling obtained, pass through Hash Computing obtains port hash code, according to port hash code device port in the facility information that (c) step finds Status data Hash list finds port information chained list, is marked in port information chained list lookup port according to port traffic Information, if there is port information, joins the interim chain of port information created in (a) step by the port information found Table, enters next step, if there is no port information, performs (b) step;
E () takes out a port information in the interim chained list of port information created in (a) step, if there is a port letter Breath, the port status array of data of read port information, by the status information time in status data array at inquiry data time The scope time started, the device status data in the range of the inquiry reference time data end time is sent to HTTP client, knot Bundle processes, and if there is no a port information, the interim chained list of release port information, end processes.
The method of 11. a kind of memory storage particular device port status data according to claim 8, it is characterised in that Renewal described in described () step processes logic, including:
A () takes out a data cell in required parameter, if there is a data cell, perform next step, if do not deposited A data cell, end processes;
B () decomposes the data cell taken out in (a) step, obtain equipment uniquely identify, port traffic labelling, the time, shape According to the time, state information, judges that data should be stored in the first cache set, or in the second cache set, if neither first Cache set, is not the second cache set, abandons the data cell of taking-up, performs (a) step, otherwise, finds corresponding cache set Equipment Hash list caches, and mark unique to equipment carries out Hash operation and obtain equipment hash code, according to equipment hashcode In equipment Hash list cache lookup to facility information chained list, uniquely identify lookup equipment in facility information chained list according to equipment Information, if there is facility information, enters next step, if there is no facility information, then applies for one from facility information caches Individual facility information internal memory, storing device information, obtain equipment collection according to equipment unique identifier lookup equipment the acquisition granularity caching Granularity, stores the acquisition granularity in facility information and uses all minute sums every day to obtain each end of equipment divided by the acquisition granularity Mouth storage status data value maximum quantity, leaves facility information linked list head node location in, enters in the facility information that will newly apply for Enter next step;
C () decomposes, according to (b) step, the port traffic labelling that the data cell taken out in (a) step obtains, pass through Hash Computing obtains port hash code, believes at device port status data Hash list lookup to port according to port hash code Breath chained list, is marked in port information chained list lookup port information according to port traffic, if there is port information, enters next Step, if there is no port information, then a port information internal memory of application from port information caches, is stored in port information, And delay at status data according to equipment each port storage status data value maximum quantity in the facility information obtained in (b) step Depositing the contiguous memory that middle application is sufficiently large, the port status array of data of association contiguous memory to port information, by newly apply for Leave port information linked list head node location in port information in, enter next step;
D () decomposes, according to (b) step, the time that the data cell taken out in (a) step obtains, use place same day time The number of minutes determine status information storage position in port status array of data divided by the equipment the acquisition granularity in facility information Putting, obtain status information internal memory, the time, the status information that the data cell taken out in decomposition (a) step are obtained are stored in Status information internal memory, performs (a) step.
CN201610587164.8A 2016-07-22 2016-07-22 A kind of method of memory storage device port status data Active CN106294546B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610587164.8A CN106294546B (en) 2016-07-22 2016-07-22 A kind of method of memory storage device port status data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610587164.8A CN106294546B (en) 2016-07-22 2016-07-22 A kind of method of memory storage device port status data

Publications (2)

Publication Number Publication Date
CN106294546A true CN106294546A (en) 2017-01-04
CN106294546B CN106294546B (en) 2019-04-16

Family

ID=57652185

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610587164.8A Active CN106294546B (en) 2016-07-22 2016-07-22 A kind of method of memory storage device port status data

Country Status (1)

Country Link
CN (1) CN106294546B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108509273A (en) * 2018-03-22 2018-09-07 杭州迪普科技股份有限公司 A kind of internal memory processing method and device
CN109918382A (en) * 2019-03-18 2019-06-21 Oppo广东移动通信有限公司 Data processing method, device, terminal and storage medium
CN113010750A (en) * 2019-12-20 2021-06-22 深圳市帝迈生物技术有限公司 Query method and device for sample analyzer, sample analyzer and medium
CN113890746A (en) * 2021-08-16 2022-01-04 曙光信息产业(北京)有限公司 Attack traffic identification method, device, equipment and storage medium
CN115237609A (en) * 2022-09-22 2022-10-25 深圳市优网科技有限公司 Method, device and storage medium for user information quick association backfill
CN116389398A (en) * 2023-05-30 2023-07-04 阿里巴巴(中国)有限公司 Data access control method, vehicle control method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100238174B1 (en) * 1992-05-28 2000-01-15 윤종용 Parallel processor system
CN1450767A (en) * 2002-04-10 2003-10-22 深圳市中兴通讯股份有限公司 Data packet forwarding controller and method
CN101873269A (en) * 2010-06-24 2010-10-27 杭州华三通信技术有限公司 Data retransmission device and method for distributing buffer to ports
CN102648456A (en) * 2009-09-21 2012-08-22 飞思卡尔半导体公司 Memory device and method
CN105608229A (en) * 2016-01-29 2016-05-25 锐达互动科技股份有限公司 System and method for synchronizing master-slave databases

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100238174B1 (en) * 1992-05-28 2000-01-15 윤종용 Parallel processor system
CN1450767A (en) * 2002-04-10 2003-10-22 深圳市中兴通讯股份有限公司 Data packet forwarding controller and method
CN102648456A (en) * 2009-09-21 2012-08-22 飞思卡尔半导体公司 Memory device and method
CN101873269A (en) * 2010-06-24 2010-10-27 杭州华三通信技术有限公司 Data retransmission device and method for distributing buffer to ports
CN105608229A (en) * 2016-01-29 2016-05-25 锐达互动科技股份有限公司 System and method for synchronizing master-slave databases

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108509273A (en) * 2018-03-22 2018-09-07 杭州迪普科技股份有限公司 A kind of internal memory processing method and device
CN109918382A (en) * 2019-03-18 2019-06-21 Oppo广东移动通信有限公司 Data processing method, device, terminal and storage medium
CN109918382B (en) * 2019-03-18 2021-06-01 Oppo广东移动通信有限公司 Data processing method, device, terminal and storage medium
CN113010750A (en) * 2019-12-20 2021-06-22 深圳市帝迈生物技术有限公司 Query method and device for sample analyzer, sample analyzer and medium
CN113010750B (en) * 2019-12-20 2023-04-28 深圳市帝迈生物技术有限公司 Query method and device for sample analyzer, sample analyzer and medium
CN113890746A (en) * 2021-08-16 2022-01-04 曙光信息产业(北京)有限公司 Attack traffic identification method, device, equipment and storage medium
CN113890746B (en) * 2021-08-16 2024-05-07 曙光信息产业(北京)有限公司 Attack traffic identification method, device, equipment and storage medium
CN115237609A (en) * 2022-09-22 2022-10-25 深圳市优网科技有限公司 Method, device and storage medium for user information quick association backfill
CN115237609B (en) * 2022-09-22 2022-12-27 深圳市优网科技有限公司 Method, device and storage medium for user information quick association backfill
CN116389398A (en) * 2023-05-30 2023-07-04 阿里巴巴(中国)有限公司 Data access control method, vehicle control method and device
CN116389398B (en) * 2023-05-30 2023-10-20 阿里巴巴(中国)有限公司 Data access control method, vehicle control method and device

Also Published As

Publication number Publication date
CN106294546B (en) 2019-04-16

Similar Documents

Publication Publication Date Title
CN106294546A (en) A kind of method of memory storage particular device port status data
CN202058147U (en) Distribution type real-time database management system
CA3177212A1 (en) Resource allocating method, device, computer equipment, and storage medium
CN101493826B (en) Database system based on WEB application and data management method thereof
CN108337172A (en) Extensive OpenFlow flow table classification storage architecture and acceleration lookup method
CN110191148A (en) A kind of statistical function distribution execution method and system towards edge calculations
CN105069134B (en) A kind of automatic collection method of Oracle statistical informations
CN109861878A (en) The monitoring method and relevant device of the topic data of kafka cluster
CN102867071A (en) Management method for massive network management historical data
CN105740352A (en) Historical data service system used for smart power grid dispatching control system
CN110147372A (en) A kind of distributed data base Intelligent Hybrid storage method towards HTAP
CN111130842B (en) Dynamic network map database construction method reflecting network multidimensional resources
CN106228263A (en) Materials stream informationization methods based on big data
CN108717457A (en) A kind of e-commerce platform big data processing method and system
CN106911540A (en) The method and cloud platform of analysis power resource and service data
CN105843933A (en) Index building method for distributed memory columnar database
CN103945005A (en) Multiple evaluation indexes based dynamic load balancing framework
CN107895017A (en) A kind of electric energy quality monitoring system construction method based on big data technology
CN107193494A (en) RDD (remote data description) persistence method based on SSD (solid State disk) and HDD (hard disk drive) hybrid storage system
CN109033173A (en) It is a kind of for generating the data processing method and device of multidimensional index data
CN106897458A (en) A kind of storage and search method towards electromechanical equipment data
CN115344207A (en) Data processing method and device, electronic equipment and storage medium
CN102737061A (en) Distributed ticket query management system and method
CN100518146C (en) A method for global buffer management of the cluster storage system
CN106528448A (en) Distributed caching mechanism for multi-source heterogeneous electronic commerce big data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant