CN108521351A - Session traffic statistical method, processor core, storage medium, electronic equipment - Google Patents
Session traffic statistical method, processor core, storage medium, electronic equipment Download PDFInfo
- Publication number
- CN108521351A CN108521351A CN201810237054.8A CN201810237054A CN108521351A CN 108521351 A CN108521351 A CN 108521351A CN 201810237054 A CN201810237054 A CN 201810237054A CN 108521351 A CN108521351 A CN 108521351A
- Authority
- CN
- China
- Prior art keywords
- session
- core
- user space
- traffic
- address
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0876—Network utilisation, e.g. volume of load or congestion level
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
This disclosure relates to a kind of session traffic statistical method, processor core, storage medium, electronic equipment.This method is applied to any user state core in multi-core processor, each User space core is correspondingly arranged on a conversational list, each session of the User space core is established in the conversational list a corresponding session entry, for each session of the User space core, the index information for the corresponding session entry of session that flow is generated in each measurement period is written in the message passing address of the User space core;Wherein, it stores the address of the conversational list and the message passing address belongs to the shared drive of User space core and kernel state core, the index information of session entry is counted for identifying memory address of the session entry in the conversational list of the User space core so that the kernel state core reads the flow information in corresponding session entry based on the index information in the message passing address.
Description
Technical field
This disclosure relates to computer realm, and in particular, to a kind of session traffic statistical method, processor core, storage
Medium, electronic equipment.
Background technology
For security firm, flow performance of the fire wall in real scene is the most important thing, this relates to right
The statistics of session traffic traffic.But the inner capacities of session traffic statistics is very huge, it is dialogue-based resource
Counted, and Session Resources with five-tuple for key (sip, sport, dip, dport, protocol), the key assignments of session by
Two five-tuple compositions of left and right directions, single size for counting key assignments just have 80 bytes, and the number of key assignments is even more may be up to ten million.This
Sample, if it is per second will carry out statistic sampling if, each second, each cpu of forwarding module will be to session traffic statistical module
Transmitted traffic information, statistical module are even more at every moment to carry out analyzing processing to flow, and the calculation amount consumed on the whole is huge.
In the related technology, most manufacturers are directed to the use of traffic statistic function, usually all can be when opening this function
Increase prompt " if opening traffic traffic statistics, the performance of system will decline to a great extent ", to prompt this function of user to property
The influence of energy.
Invention content
It is a general object of the present disclosure to provide a kind of session traffic statistical method, processor core, storage medium, electronics to set
Standby, the calculation amount to solve the problems, such as existing session traffic statistics consumption is excessive.
To achieve the goals above, disclosure first aspect provides a kind of session traffic statistical method, the method application
Any user state core in multi-core processor, each User space core are correspondingly arranged on a conversational list, the user
Each session of state core is established in the conversational list a corresponding session entry, the method includes:
For each session of the User space core, the corresponding session of session of flow will be generated in each measurement period
The index information of list item is written in the message passing address of the User space core;
Wherein, the address and the message passing address for storing the conversational list belong to User space core and kernel state
The shared drive of core, the index information of session entry is for identifying the session entry in the conversational list of the User space core
Memory address, so that the kernel state core reads corresponding conversational list based on the index information in the message passing address
Flow information in is counted.
Optionally, the index information by the corresponding session entry of session for generating flow in each measurement period is written
In the message passing address of the User space core, including:
Parsing generates the message of the session of flow, determines whether the session will lose by the session status in the message
Effect;
The session status indicate the session keep it is effective when, by No. handle of the corresponding session entry of the session with
And conversational list type is written in the message passing address of the User space core;
The method further includes:
When the session status indicates that the session will be invalid, according to the right and left key of the session and flow information at this
Create new traffic list items in the corresponding traffic tables of User space core, and by the handle of the new traffic list items
Number and traffic table types be written in the message passing address of the User space core, wherein store the traffic tables
Address belong to the shared drive of User space core and kernel state core.
Optionally, the right and left key and flow information according to the session is in the corresponding traffic of the User space core
New traffic list items are created in table, including:
Every traffic list items are created in order, and use Exchange rings, when having stored the memory of the traffic tables
Man Shi replaces each content that traffic list items have been established successively according to the sequence.
Optionally, it is to use consistency Hash ring that content is written in the corresponding message passing address of the User space core
Mode.
Disclosure second aspect provides another session traffic statistical method, and the method is applied in multi-core processor
Kernel state core, the method includes:
The message passing address of each User space core of poll obtains the message passing address in each measurement period
In the index information that is newly written, the index information is used to identify the corresponding session of session of the generation flow in the measurement period
Memory address of the list item in conversational list, wherein the address of the storage conversational list and the message passing address are equal
Belong to the shared drive of User space core and kernel state core;
The flow information in corresponding session entry, which is read, according to the index information carries out traffic statistics.
Optionally, described that the progress flow system of flow information in corresponding session entry is read according to the index information
Meter, including:
When the index information includes the handle of conversational list type and session entry, institute is counted in conversational list
State the flow information recorded in the session entry of No. handle mark;
The method further includes:
When the index information includes the handle of traffic tables type and traffic list items, in traffic
The flow information that records in the traffic list items of No. handle mark is counted in table, wherein the traffic list items are
The User space core is when determining that the session will be invalid in next measurement period, according to the right and left key and flow of the session
What information created in the traffic tables of the User space core.
Optionally, the corresponding message passing address of User space core described in poll is by the way of consistency Hash ring.
The disclosure third aspect provides a kind of User space core, including:
Writing module will generate flow for each session for the User space core in each measurement period
The index information of the corresponding session entry of session is written in the message passing address of the User space core;
Wherein, the User space core is correspondingly arranged on a conversational list, stores the address of the conversational list and described disappears
Breath transmits address and belongs to the shared drive of the User space core and kernel state core, the User space core per for a moment
Words are established in the conversational list a corresponding session entry, and the index information of the session entry exists for identifying the session entry
Memory address in the conversational list of the User space core, so that the kernel state core is based in the message passing address
The flow information that index information is read in corresponding session entry is counted.
Optionally, the User space core further includes packet parsing module, the message for parsing the session for generating flow,
Determine whether the session will fail by the session status in the message, said write module is used for, in the session shape
When state indicates that the session keeps effective, described in No. handle of the corresponding session entry of the session and the write-in of conversational list type
In the message passing address of User space core;
The User space core further includes creation module, for when the session status indicates that the session will fail,
It is created newly in the corresponding traffic tables of the User space core according to the right and left key of the session and flow information
Traffic list items, said write module are used for, and No. handle of the new traffic list items and traffic table types are write
In the message passing address for entering the User space core, wherein the address for storing the traffic tables is the User space core
With the shared drive of kernel state core.
Optionally, the creation module is used for:
Every traffic list items are created in order, and use Exchange rings, when having stored the memory of the traffic tables
Man Shi replaces each content that traffic list items have been established successively according to the sequence.
Disclosure fourth aspect provides a kind of kernel state core, including:
Poller module is used for the message passing address of each User space core of poll, obtains the institute in each measurement period
The index information being newly written in message passing address is stated, the index information is used to identify generates flow in the measurement period
Memory address of the corresponding session entry of session in conversational list, wherein the address of the storage conversational list and described
Message passing address belongs to the shared drive of User space core and kernel state core;
Flow statistical module is flowed for reading the flow information in corresponding session entry according to the index information
Amount statistics.
Optionally, the flow statistical module is used for:
When the index information includes the handle of conversational list type and session entry, institute is counted in conversational list
State the flow information recorded in the session entry of No. handle mark;
The flow statistical module is additionally operable to:
When the index information includes the handle of traffic tables type and traffic list items, in traffic
The flow information that records in the traffic list items of No. handle mark is counted in table, wherein the traffic list items are
The User space core is when determining that the session will be invalid in next measurement period, according to the right and left key and flow of the session
What information created in the traffic tables of the User space core.
The 5th aspect of the disclosure provides a kind of computer readable storage medium, is stored thereon with computer program, the program
The step of first aspect or second aspect the method are realized when being executed by processor.
The 6th aspect offer a kind of electronic equipment of the disclosure, including the first computer readable storage medium, User space core,
Second computer readable storage medium storing program for executing, kernel state core;
Wherein, when the User space core executes the computer program stored on first computer readable storage medium
The step of realizing first aspect the method;
The kernel state core is realized when executing the computer program stored on the second computer readable storage medium storing program for executing
The step of second aspect the method.
Through the above technical solutions, conversational list is designed as the shared drive of User space core and kernel state core, in this way, protecting
Card kernel state core can read session traffic information directly from the list item of conversational list.Also, User space core and kernel state
Information between core transmits rejection slip mechanism, and User space core need to will only generate the index information write-in of the session of flow
Message passing address, kernel state core can read index information from message passing address, and according to index information from correspondence
Session entry in read flow information, compared to User space core need system call by way of notify kernel state to receive
The informing mechanism of entire Session Resources, technical solution provided by the present disclosure saves a large amount of Messaging content, and avoids
User space core largely initiates system calling, to reduce calculation amount consumption.Also, due to conversational list and message transmission
Location is corresponding each User space core setting, avoids the competition between multi-core, ensure that multinuclear is not interfere with each other concurrently, from
And the performance of multi-core processor is accomplished with the increase of core and fairly linear growth.
Other feature and advantage of the disclosure will be described in detail in subsequent specific embodiment part.
Description of the drawings
Attached drawing is for providing further understanding of the disclosure, and a part for constitution instruction, with following tool
Body embodiment is used to explain the disclosure together, but does not constitute the limitation to the disclosure.In the accompanying drawings:
Fig. 1 is a kind of structural schematic diagram for asynchronous multi-core processor that the embodiment of the present disclosure provides;
Fig. 2 is a kind of flow diagram for session traffic statistical method that the embodiment of the present disclosure provides;
Fig. 3 is a kind of flow diagram for session traffic statistical method that the embodiment of the present disclosure provides;
Fig. 4 is the flow diagram for another session traffic statistical method that the embodiment of the present disclosure provides;
Fig. 5 is a kind of structural schematic diagram for User space core that the embodiment of the present disclosure provides;
Fig. 6 is a kind of structural schematic diagram for kernel state core that the embodiment of the present disclosure provides.
Specific implementation mode
The specific implementation mode of the disclosure is described in detail below in conjunction with attached drawing.It should be understood that this place is retouched
The specific implementation mode stated is only used for describing and explaining the disclosure, is not limited to the disclosure.
Disclosure following embodiment can be used for multi-core processor, and Fig. 1 provides a kind of structure of asynchronous multi-core processor 10
Schematic diagram, referring to Fig.1, the asynchronous multi-core processor 10 include CPU0, CPU1, CPU2 and the CPU3 for operating in User space, operation
In CPU4, CPU5, CPU6 and the CPU7 of kernel state.
It is worth noting that the distribution of the CPU of asynchronous multi-core processor is single-minded functional distribution, that is to say, that a CPU
Something is only done, rather than a CPU finishes all things.For this purpose, the intelligence of asynchronous multi-core processor is divided into two
Point, one is fast-forwarding logic (disclosure is referred to as quick module), and one is the complicated strategy of function logic (this public affairs at a slow speed
Open referred to as slow-side module).As shown in Figure 1, quickly module includes CPU0, CPU1, CPU2 and CPU3 as shown in Figure 1;At a slow speed
Module includes CPU4, CPU5, CPU6 and CPU7 as shown in Figure 1, wherein quick module is for being responsible for fast-forwarding logic, slowly
Fast module is used to be responsible for the tactic of function complexity logic at a slow speed.At runtime in state, asynchronous multi-core processor is divided into kernel state
And User space, kernel state realize that the logic of function complexity, slow-side module just operate in this tense for being responsible for, User space
It is responsible for from reception network interface card message and realizes that fast-forwarding logic, quick module operate in User space.That is, from when operation
It is seen in state, CPU0 shown in FIG. 1, CPU1, CPU2 and CPU3 are User space core, and CPU4, CPU5, CPU6 and CPU7 are kernel state
Core.
The flow statistical module that conversates is exactly in slow-side module, this function is realized sufficiently complex and time-consuming after all,
And general flow fast-forwarding processing is carried out by quick module.In the related technology, since the statistics of session traffic needs
Multinuclear counts and summarizes simultaneously gives session traffic statistical module, leads between multinuclear that there are the competitions of shared resource, due to existing
Lock competition causes the performance of multi-core processor there is no becoming more preferable because of multinuclear, it could even be possible to because that designs is bad
Cause multinuclear performance to be not so good as monokaryon, and has an effect on the forwarding of normal discharge.
The embodiment of the present disclosure provides a kind of session traffic statistical method, and this method is applied to any use in multi-core processor
Any user state core in family state core, such as asynchronous multi-core processor 10 shown in FIG. 1, wherein each User space core
It is correspondingly arranged on a conversational list, each session of the User space core is established in the conversational list a corresponding session entry,
As shown in Fig. 2, this method includes:
S101, each session for User space core will generate the corresponding meeting of session of flow in each measurement period
The index information of words list item is written in the message passing address of the User space core, so that kernel state core is passed based on the message
The flow information that the index information in address is read in corresponding session entry is passed to be counted.
Wherein, each User space core is correspondingly arranged on message passing address, and the address and message for storing conversational list pass
The shared drive that address belongs to User space core and kernel state core is passed, the index information of session entry is for identifying the session
Memory address of the list item in the conversational list of User space core.
Specifically, for the design of conversational list, conversational list is designed as every core mechanism, i.e. a user by the embodiment of the present disclosure
State core is correspondingly arranged a conversational list.Illustratively, the use of memory pool is each User space core in the module initialization stage
The memory of distribution storage conversational list, also, the memory address of each conversational list can be designed as continuous space.In this way, each meeting
It talks about table and corresponds to an array (memory headroom that the array representation is distributed from memory pool), each session of the User space core exists
The list item that the conversational list creates is a subscript of corresponding array, this subscript is the fixation of session entry in memory
Index, also referred to as No. handle.The index information can include No. handle, according to this No. handle, can find
Corresponding session entry, and then the content recorded in session entry can be read.
The meaning of session entry is practical to carry out message forwarding when receiving message for quick module based on this.Specifically, exist
Message is sent to slow-side module when not finding session entry and carries out strategy matching, then quickly newly-built session again, finds then base
It is forwarded in already-existing session table.In the related technology, conversational list is actually built upon in quick module, and user is also fast
Fast module, slow-side module can not be inquired, and cause the relevant technologies when conversating traffic statistics, need quick module to slow
The fast internuclear transmission flow information of module, these flow informations are all a parts for session entry, and quantity is substantially just session
The number of effective discharge in one second causes the data volume of internuclear transmission huge.And the disclosure optimizes this, it will
Words table is designed as shared drive, since the content that session traffic statistical module needs is exactly a part of content of session entry,
So being allowed after being designed as shared drive session traffic statistical module is directly accessed, saves a large amount of inter-core message and pass
It passs.
Also, about the transfer mode of message, in the related technology using informing mechanism, User space is called using system
Mode notify kernel state received message, i.e., send internuclear interruption IPI to kernel state core.Quick module meeting can be led to by doing so
A large amount of transmission systems are called to influence the message forwarding performance of quick module, and quick module is that User space is based on poll machine after all
The dpdk packet receivings of system are handled, and are occupied if calculating power and being called by a large amount of systems, can cause forwarding module due to packet receiving handles not in time
Packet loss.In order to solve this problem, in the technical solution that the embodiment of the present disclosure provides, User space core and kernel state core it
Between information transmit rejection slip mechanism, User space core need to only believe the index for the corresponding conversational list of session for generating flow
Breath write-in message passing address, the message passing address belong to the shared drive of User space core and kernel state core.In this way,
Kernel state core can read index information from message passing address, and according to the index information from corresponding session entry
Read flow information.It needs to notify kernel state to receive entire Session Resources in such a way that system is called compared to User space core
Informing mechanism, technical solution provided by the present disclosure saves a large amount of Messaging content, and avoids User space core
A large amount of systems of initiating are called, to reduce calculation amount consumption.Also, since conversational list and message passing address are corresponding every
One User space core is arranged, therefore also avoids the competition between multi-core, ensure that multinuclear is not interfere with each other concurrently, so that
The performance of multi-core processor can accomplish with the increase of core and fairly linear growth.
Specifically, content is written in the message passing address of User space core and consistency Hash ring (ring may be used
Ring) mode, i.e., state core establishes a ring ring for each user.Specifically, using ring mechanism, set up read and
Write pointers, User space core carry out continuous write operation, and kernel state core then constantly carries out read operation, when the two read-write is identical
When, it represents there is no the arrival of new message, which need not carry out the processing of any new information.In this way, using
Ring mechanism, kernel state core can use separate threads poll handle the ring rings of each User space core, in whole process
Only User space need to be safeguarded to multiple ring rings of kernel state, any memory life cycle of Maintenance free, so that any
Message traffic, which is transmitted to kernel state all, need not safeguard that memory discharges, and both simplify global design, decrease memory release institute band
The performance consumption come.
In the specific implementation, concurrent unaffected between multinuclear in order to ensure, it can only start one in kernel state
Traffic threads avoid locking competition caused by multinuclear, improve whole forwarding performance come the traffic statistics that conversate.
In addition, above-mentioned measurement period can be set according to actual demand, for example, the stream that statistics session generates in two seconds
Amount, the disclosure do not limit.But for the measurement period of setting, it is possible to exist and not have enough time counting a certain session also and exist
Flow in the measurement period, the session is with regard to situation to be deleted.Such as a certain session is just destroyed in this second, however
There is still a need for the flow of the session is passed to kernel state core, then kernel state core i.e. may be according to index information shared
Memory finds a session entry failed, leads to this partial discharge statistics missing.
In order to solve this problem, the embodiment of the present disclosure provides another session traffic statistical method, as shown in figure 3, should
Method is applied to any user state core in multi-core processor, and this method includes:
S201, the parsing of User space core generate the message of the session of flow, are determined by the session status in the message
Whether the session will fail.
Specifically, the session for generating flow refers to transmitting the session of message, in this way, obtaining message by parsing the message
In session status, you can by session status judge the session be to continue with holding or need disconnect.It is worth explanation
It is that client can send the message disconnected for announcement session when receiving the instruction that instruction session disconnects to server, because
This, the User space core is when forwarding the message, you can learns that session will be switched off by parsing the message.
Further, if the session status that parsing obtains indicates that the session keeps effective, S202 is thened follow the steps;If parsing
Obtained session status indicates that the session will fail, and thens follow the steps S203 to step S204.
S202, the User space core is written into No. handle of the corresponding session entry of the session and conversational list type
In message passing address.
Wherein, in the embodiment of the present disclosure, the design of conversational list and message passing address is referred to above-mentioned to shown in Fig. 1
The explanation of step S101, details are not described herein again.
S203, it is created in the corresponding traffic tables of the User space core according to the right and left key and flow information of the session
Build new traffic list items.
Wherein, the right and left key be respectively the left and right both direction recorded in session entry five-tuple (sip, sport,
dip,dport,protocol).Flow information refers to the flow in_pkts, out_pkts, in_bytes, out_ of this session
bytes.User space core can directly come out right and left key and flow information extraction from session entry.
In order to ensure that the Session Resources that will be failed can be transmitted correctly, each User space core is correspondingly arranged on one
Traffic tables, wherein this traffic table are consistent with the design of conversational list, and there are one corresponding arrays for internal each list item
Subscript, also referred to as No. handle.Also, the address for storing the traffic tables also belongs to as User space core and kernel state core
The shared drive of the heart, so that kernel state core is able to access that.
S204, the User space core is written into No. handle of the new traffic list items and traffic table types
In message passing address.
In this way, for the session that next measurement period will fail, kernel state core can count in traffic tables
Flow information avoids since traffic statistics caused by session failed lack, improves the accuracy of traffic statistics.
It is worth noting that for differentiating sessions table and traffic tables, User space core is written in message passing address
Content further includes memory pool type other than No. handle, and by taking ring rings as an example, the content of each element is in ring rings
(No. handle, the serial number of mempool), the wherein type of mempool is divided into two major classes, one of them is session pool, another kind of
For the ponds traffic.Since session pool and the ponds traffic are all each User space cores respectively one, so mempool serial numbers,
It is actually the session pool of corresponding each User space core and the global number in the ponds traffic, this is that initialization is determining.Such as
Traffic table types in conversational list type and step S204 in step S202, so that kernel state core is being read
When content includes the handle of session pool type and session entry, the meeting of No. handle mark is counted in conversational list
Talk about the flow information of list item record;It include No. handle of the ponds traffic type and traffic list items in the content read
When, the flow information of the traffic list items record of No. handle mark is counted in traffic tables.
In addition, in a kind of possible realization method of the embodiment of the present disclosure, the traffic tables are without releasing interior storage machine
System, User space core create every traffic list items, and use replacement machine in order in initial creation traffic list items
System replaces according to the sequence when the memory for storing the traffic tables has been expired and each traffic list items has been established successively
Content.The sequence for example can be the sequence that handle is successively increased.Also, in order to avoid in the distribution of traffic tables
It deposits too small, causes kernel state core not read newly-established traffic list items also, User space core is just newly-established by this
The case where traffic list items are replaced next time, the memory for the distribution of traffic tables should be greater than a measurement period
The maximum value of the interior session number that may be failed, in the specific implementation, the traffic list items of the memory storage of distribution can reach hundred
Ten thousand ranks.In this way, the ponds traffic only have memory application alloc operations, no releasing mechanism being read without kernel state
User space releasing memory is notified after a certain traffic list items, simplifies system complexity, is also avoided caused by memory release
Performance consumption.
The embodiment of the present disclosure also provides another session traffic statistical method, and this method is applied to interior in multi-core processor
Core state core, as shown in figure 4, this method includes:
The message passing address of each User space core of S301, poll obtains the message in each measurement period and passes
Pass the index information being newly written in address.
Wherein, the index information exists for identifying the corresponding session entry of session of the generation flow in the measurement period
Memory address in conversational list, wherein the address of the storage conversational list and the message passing address belong to use
The shared drive of family state core and kernel state core.
S302, the progress traffic statistics of the flow information in corresponding session entry are read according to the index information.
Optionally, described that the progress flow system of flow information in corresponding session entry is read according to the index information
Meter, including:
When the index information includes the handle of conversational list type and session entry, institute is counted in conversational list
State the flow information recorded in the session entry of No. handle mark;
The method further includes:
When the index information includes the handle of traffic tables type and traffic list items, in traffic
The flow information that records in the traffic list items of No. handle mark is counted in table, wherein the traffic list items are
The User space core is when determining that the session will be invalid in next measurement period, according to the right and left key and flow of the session
What information created in the traffic tables of the User space core.
Optionally, the corresponding message passing address of User space core described in poll is by the way of consistency Hash ring.
In addition, it is concurrent unaffected between multinuclear in order to ensure, it can only start a traffic thread in kernel state and come
Conversate traffic statistics, that is to say, that and method shown in Fig. 3 is the core for being applied to run traffic threads in kernel state,
It avoids locking competition caused by multinuclear, improves whole forwarding performance.
The design of conversational list and message passing address is counted referring in particular to the above-mentioned session traffic to User space core side
The explanation of method, details are not described herein again.
For the technical solution for making those skilled in the art more understand that the embodiment of the present disclosure provides, below with shown in Fig. 1
Asynchronous multi-core processor 10 for, to the embodiment of the present disclosure provide session traffic statistical method illustrate.
After turn-on flow rate statistical function, wherein CPU0, CPU1, CPU2 and CPU3 in asynchronous multi-core processor 10 are
The index information for the session for needing to transmit message will be passed in the ring rings of every core according to the measurement period of setting, message lattice
Formula is (No. handle, memory pool type).Wherein, which can preset, such as one second.It is worth noting that
It is the flow that dialogue-based table is forwarded in this operation reflection to code, in the case where measurement period is one second, if
The last timing of processing distance of a certain message is more than one second, then No. handle and conversational list type is write the User space
In the corresponding ring rings of core.Another situation, if the message will be deleted within next second, by the left and right of the session
Key assignments and flow information extraction come out, and application memory establishes a traffic from the ponds traffic of the corresponding User space core
List item, and the content of extraction is filled into newly-established traffic list items, then by No. handle of the traffic list items
And in traffic table types filling ring rings.Since each User space core has a ring rings, the write-in of ring rings
Process is to be not necessarily to lock completely.That is, each core is to be completely independent operation between multinuclear, without competing any money
Source, to ensure that, entire performance can accomplish with the increase of core and fairly linear growth under multiple nucleus system, completely not shadow
Ring the forwarding of normal discharge.
Further, a core can be used only in kernel state and runs traffic threads, such as asynchronous multi-core processor
CPU4 in 10, in this case, CPU4 polls handle that each User space core transmits (No. handle, memory pool class
Type), and the flow in this measurement period is counted based on the information read.In this way, since only there are one traffic lines
Journey, so without the resource competing problem between multinuclear so that performance can accomplish kernel state access operation not by competing on the whole
It strives.Also, the setting of traffic tables can lead to system to avoid since the access failure of kernel state core memory occurs in session deletion
The problem of collapse, ensure that the robustness of function.
From the foregoing, it will be observed that when carrying out traffic statistics, needs transmit entirely between kernel state and User space compared with prior art
Session Resources, the embodiment of the present disclosure need to only transmit No. handle or traffic of session entry between User space and kernel state
No. handle of list item, to which the byte number of message transmission be greatly decreased so that laid down during traffic statistics absolutely mostly
Number burden, improves overall treatment efficiency.Also, the design of conversational list and message passing address (such as ring rings), avoids more
Resource contention between core ensure that multinuclear is not interfere with each other concurrently so that the performance of multi-core processor can accomplish with
The increase of core and fairly linear growth, further improve multi-core processor overall performance.
The embodiment of the present disclosure also provides a kind of User space core 40, as shown in figure 5, the User space core 40 includes:
Writing module 401 will generate flow for each session for the User space core in each measurement period
The index information of the corresponding session entry of session be written in the message passing address of the User space core;
Wherein, the User space core is correspondingly arranged on message passing address and a conversational list, stores the conversational list
Address and the message passing address belong to the shared drive of the User space core and kernel state core, the use
Each session of family state core is established in the conversational list has a corresponding session entry, the index information of the session entry to be used for
Memory address of the session entry in the conversational list of the User space core is identified, so that the kernel state core is based on described
The index information being newly written in the message passing address in measurement period read the flow information in corresponding session entry into
Row statistics.
Optionally, the User space core further includes packet parsing module 402, the report for parsing the session for generating flow
Text determines whether the session will fail by the session status in the message, and said write module 401 is used for, described
When session status indicates that the session keeps effective, No. handle of the corresponding session entry of the session and conversational list type are write
In the message passing address for entering the User space core;
The User space core further includes creation module 403, for indicating that the session will fail in the session status
When, it is created newly in the corresponding traffic tables of the User space core according to the right and left key of the session and flow information
Traffic list items, said write module 401 are used for, by No. handle of the new traffic list items and traffic table classes
Type is written in the message passing address of the User space core, wherein the address for storing the traffic tables is the User space
The shared drive of core and kernel state core.
Optionally, the creation module 403 is used for:
Every traffic list items are created in order, and use Exchange rings, when having stored the memory of the traffic tables
Man Shi replaces each content that traffic list items have been established successively according to the sequence.
Using above-mentioned User space core, the conversational list in multi-core processor is designed as User space core and kernel state core
Shared drive, in this way, ensureing that kernel state core can read session traffic information directly from session entry.Also, User space
Information between core and kernel state core transmits rejection slip mechanism, and User space core need to will only generate the session of flow
Message passing address is written in index information, and the kernel state core of operation traffic threads can be read from message passing address
Index information, and flow information is read from corresponding session entry according to index information, it is needed compared to User space core logical
The mode for crossing system calling notifies kernel state to receive the informing mechanism of entire Session Resources, and technical solution provided by the present disclosure is saved
A large amount of Messaging content, and avoid User space core and largely initiate system calling, disappear to reduce calculation amount
Consumption, improves processor overall performance.
The embodiment of the present disclosure also provides a kind of kernel state core 50, as shown in fig. 6, the kernel state core 50 includes:
Poller module 501 is used for the message passing address of each User space core of poll, obtains in each measurement period
The index information being newly written in the message passing address, the index information generate flow for identifying in the measurement period
Memory address of the corresponding session entry of session in conversational list, wherein the address of the storage conversational list and institute
State the shared drive that message passing address belongs to User space core and kernel state core;
Flow statistical module 502, for read according to the index information flow information in corresponding session entry into
Row traffic statistics.
Optionally, the flow statistical module 502 is used for:
When the index information includes the handle of conversational list type and session entry, institute is counted in conversational list
State the flow information recorded in the session entry of No. handle mark;
The flow statistical module 502 is additionally operable to:
When the index information includes the handle of traffic tables type and traffic list items, in traffic
The flow information that records in the traffic list items of No. handle mark is counted in table, wherein the traffic list items are
The User space core is when determining that the session will be invalid in next measurement period, according to the right and left key and flow of the session
What information created in the traffic tables of the User space core.
Those skilled in the art can be understood that, for convenience and simplicity of description, only with above-mentioned each function mould
The division progress of block, can be as needed and by above-mentioned function distribution by different function modules for example, in practical application
It completes, i.e., the internal structure of device is divided into different function modules, to complete all or part of the functions described above.
The specific work process of foregoing description function module, can refer to corresponding processes in the foregoing method embodiment, no longer superfluous herein
It states.
The embodiment of the present disclosure also provides a kind of computer readable storage medium, is stored thereon with computer program, the program
The step of a kind of session traffic statistical method that above method embodiment provides is realized when being executed by processor.
The embodiment of the present disclosure also provides a kind of electronic equipment, including the first computer readable storage medium, User space core,
Second computer readable storage medium storing program for executing, kernel state core.
Wherein, when the User space core executes the computer program stored on first computer readable storage medium
The step of realizing the session traffic statistical method of above-mentioned User space core side, the kernel state core execute the second computer
The step of session traffic statistical method of above-mentioned kernel state core side is realized when the computer program stored on readable storage medium storing program for executing.
The preferred embodiment of the disclosure is described in detail above in association with attached drawing, still, the disclosure is not limited to above-mentioned reality
The detail in mode is applied, in the range of the technology design of the disclosure, a variety of letters can be carried out to the technical solution of the disclosure
Monotropic type, these simple variants belong to the protection domain of the disclosure.
It is further to note that specific technical features described in the above specific embodiments, in not lance
In the case of shield, can be combined by any suitable means, in order to avoid unnecessary repetition, the disclosure to it is various can
The combination of energy no longer separately illustrates.
In addition, arbitrary combination can also be carried out between a variety of different embodiments of the disclosure, as long as it is without prejudice to originally
Disclosed thought equally should be considered as disclosure disclosure of that.
Claims (10)
1. a kind of session traffic statistical method, which is characterized in that the method is applied to any user state in multi-core processor
Core, each User space core are correspondingly arranged on a conversational list, and each session of the User space core is in the conversational list
Middle foundation has a corresponding session entry, the method includes:
For each session of the User space core, the corresponding session entry of session of flow will be generated in each measurement period
Index information be written in the message passing address of the User space core;
Wherein, the address and the message passing address for storing the conversational list belong to User space core and kernel state core
Shared drive, the index information of session entry for identify the session entry in the conversational list of the User space core in
Address is deposited, so that the kernel state core is read based on the index information in the message passing address in corresponding session entry
Flow information counted.
2. according to the method described in claim 1, it is characterized in that, the session pair that flow will be generated in each measurement period
The index information for the session entry answered is written in the message passing address of the User space core, including:
Parsing generates the message of the session of flow, determines whether the session will fail by the session status in the message;
When the session status indicates that the session keeps effective, by No. handle of the corresponding session entry of the session and meeting
Words table type is written in the message passing address of the User space core;
The method further includes:
When the session status indicates that the session will fail, according to the right and left key of the session and flow information in the user
Create new traffic list items in the corresponding traffic tables of state core, and by No. handle of the new traffic list items with
And traffic table types are written in the message passing address of the User space core, wherein store the ground of the traffic tables
Location belongs to the shared drive of User space core and kernel state core.
3. according to the method described in claim 2, it is characterized in that, described exist according to the right and left key and flow information of the session
New traffic list items are created in the corresponding traffic tables of the User space core, including:
Every traffic list items are created in order, and use Exchange rings, when the memory for storing the traffic tables has been expired,
Each content that traffic list items have been established is replaced successively according to the sequence.
4. according to the method in any one of claims 1 to 3, which is characterized in that disappear the User space core is corresponding
It is by the way of consistency Hash ring that breath, which transmits write-in content in address,.
5. a kind of session traffic statistical method, which is characterized in that the method is applied to the kernel state core in multi-core processor,
The method includes:
The message passing address of each User space core of poll obtains new in the message passing address in each measurement period
The index information of write-in, the index information are used to identify the corresponding session entry of session that flow is generated in the measurement period
Memory address in conversational list, wherein the address of the storage conversational list and the message passing address belong to
The shared drive of User space core and kernel state core;
The flow information in corresponding session entry, which is read, according to the index information carries out traffic statistics.
6. according to the method described in claim 5, it is characterized in that, described read corresponding conversational list according to the index information
Flow information in carries out traffic statistics, including:
When the index information includes the handle of conversational list type and session entry, in conversational list described in statistics
The flow information recorded in the session entry of No. handle mark;
The method further includes:
When the index information includes the handle of traffic tables type and traffic list items, in traffic tables
Count the flow information recorded in the traffic list items of No. handle mark, wherein the traffic list items are described
User space core is when determining that the session will be invalid in next measurement period, according to the right and left key and flow information of the session
It is created in the traffic tables of the User space core.
7. a kind of User space core, which is characterized in that including:
Writing module will generate the session of flow for each session for the User space core in each measurement period
The index information of corresponding session entry is written in the message passing address of the User space core;
Wherein, the User space core is correspondingly arranged on a conversational list, and the address and the message for storing the conversational list pass
The shared drive that address belongs to the User space core and kernel state core is passed, each session of the User space core exists
Being established in the conversational list has a corresponding session entry, and the index information of the session entry is for identifying the session entry described
Memory address in the conversational list of User space core, so that the kernel state core is based on the index in the message passing address
The flow information that information is read in corresponding session entry is counted.
8. a kind of kernel state core, which is characterized in that including:
Poller module is used for the message passing address of each User space core of poll, obtains described in each measurement period disappear
Breath transmits the index information being newly written in address, and the index information is used to identify the session that flow is generated in the measurement period
Memory address of the corresponding session entry in conversational list, wherein the address of the storage conversational list and the message
Transmit the shared drive that address belongs to User space core and kernel state core;
Flow statistical module carries out flow system for reading the flow information in corresponding session entry according to the index information
Meter.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor
The step of any one of claim 1 to 6 the method is realized when row.
10. a kind of electronic equipment, which is characterized in that including the first computer readable storage medium, User space core, second calculates
Machine readable storage medium storing program for executing, kernel state core;
Wherein, it is realized when the User space core executes the computer program stored on first computer readable storage medium
The step of claim 1 the method;
The kernel state core realizes right when executing the computer program stored on the second computer readable storage medium storing program for executing
It is required that the step of 5 the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810237054.8A CN108521351B (en) | 2018-03-21 | 2018-03-21 | Session flow statistical method, processor core, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810237054.8A CN108521351B (en) | 2018-03-21 | 2018-03-21 | Session flow statistical method, processor core, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108521351A true CN108521351A (en) | 2018-09-11 |
CN108521351B CN108521351B (en) | 2021-02-05 |
Family
ID=63433886
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810237054.8A Active CN108521351B (en) | 2018-03-21 | 2018-03-21 | Session flow statistical method, processor core, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108521351B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112714021A (en) * | 2020-12-29 | 2021-04-27 | 北京格林威尔科技发展有限公司 | Method and device for obtaining flow statistical result in optical transport network based on packet network |
WO2023134574A1 (en) * | 2022-01-12 | 2023-07-20 | 华为技术有限公司 | Method for flow statistics, device, and system |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7363353B2 (en) * | 2001-07-06 | 2008-04-22 | Juniper Networks, Inc. | Content service aggregation device for a data center |
CN101178694A (en) * | 2006-11-07 | 2008-05-14 | 莱克斯信息技术(北京)有限公司 | Intel e1000 zero copy method |
US8127290B2 (en) * | 2007-06-22 | 2012-02-28 | Red Hat, Inc. | Method and system for direct insertion of a virtual machine driver |
CN102541461A (en) * | 2010-12-31 | 2012-07-04 | 阿里巴巴集团控股有限公司 | Data reading-writing method and device for remote data storage and system thereof |
US8539570B2 (en) * | 2007-06-22 | 2013-09-17 | Red Hat, Inc. | Method for managing a virtual machine |
CN103729329A (en) * | 2012-10-12 | 2014-04-16 | 深圳市中兴微电子技术有限公司 | ICN device and method |
CN104753711A (en) * | 2013-12-31 | 2015-07-01 | 华为技术有限公司 | Method and device for adjusting resource allocation of network equipment |
CN105763437A (en) * | 2014-12-17 | 2016-07-13 | 中兴通讯股份有限公司 | Message forwarding method and network equipment |
CN106713185A (en) * | 2016-12-06 | 2017-05-24 | 瑞斯康达科技发展股份有限公司 | Load balancing method and apparatus of multi-core CPU |
CN106789617A (en) * | 2016-12-22 | 2017-05-31 | 东软集团股份有限公司 | A kind of message forwarding method and device |
CN107046508A (en) * | 2016-02-05 | 2017-08-15 | 华为技术有限公司 | Message method of reseptance and the network equipment |
-
2018
- 2018-03-21 CN CN201810237054.8A patent/CN108521351B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7363353B2 (en) * | 2001-07-06 | 2008-04-22 | Juniper Networks, Inc. | Content service aggregation device for a data center |
CN101178694A (en) * | 2006-11-07 | 2008-05-14 | 莱克斯信息技术(北京)有限公司 | Intel e1000 zero copy method |
US8127290B2 (en) * | 2007-06-22 | 2012-02-28 | Red Hat, Inc. | Method and system for direct insertion of a virtual machine driver |
US8539570B2 (en) * | 2007-06-22 | 2013-09-17 | Red Hat, Inc. | Method for managing a virtual machine |
CN102541461A (en) * | 2010-12-31 | 2012-07-04 | 阿里巴巴集团控股有限公司 | Data reading-writing method and device for remote data storage and system thereof |
CN103729329A (en) * | 2012-10-12 | 2014-04-16 | 深圳市中兴微电子技术有限公司 | ICN device and method |
CN104753711A (en) * | 2013-12-31 | 2015-07-01 | 华为技术有限公司 | Method and device for adjusting resource allocation of network equipment |
CN105763437A (en) * | 2014-12-17 | 2016-07-13 | 中兴通讯股份有限公司 | Message forwarding method and network equipment |
CN107046508A (en) * | 2016-02-05 | 2017-08-15 | 华为技术有限公司 | Message method of reseptance and the network equipment |
CN106713185A (en) * | 2016-12-06 | 2017-05-24 | 瑞斯康达科技发展股份有限公司 | Load balancing method and apparatus of multi-core CPU |
CN106789617A (en) * | 2016-12-22 | 2017-05-31 | 东软集团股份有限公司 | A kind of message forwarding method and device |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112714021A (en) * | 2020-12-29 | 2021-04-27 | 北京格林威尔科技发展有限公司 | Method and device for obtaining flow statistical result in optical transport network based on packet network |
CN112714021B (en) * | 2020-12-29 | 2023-04-18 | 北京格林威尔科技发展有限公司 | Method and device for obtaining flow statistical result in optical transport network based on packet network |
WO2023134574A1 (en) * | 2022-01-12 | 2023-07-20 | 华为技术有限公司 | Method for flow statistics, device, and system |
Also Published As
Publication number | Publication date |
---|---|
CN108521351B (en) | 2021-02-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7710969B2 (en) | Rapid I/O traffic system | |
CN104092717B (en) | Message treatment method and system, message destination equipment | |
US20080168190A1 (en) | Input/Output Tracing in a Protocol Offload System | |
US9934077B2 (en) | Reader-writer lock | |
CN108023829B (en) | Message processing method and device, storage medium and electronic equipment | |
CN107613529B (en) | Message processing method and base station | |
CN109933438A (en) | High speed shared drive data receiving-transmitting system | |
CN105573711B (en) | A kind of data cache method and device | |
US9612934B2 (en) | Network processor with distributed trace buffers | |
CN108521351A (en) | Session traffic statistical method, processor core, storage medium, electronic equipment | |
CN113835902B (en) | Data processing method, device, computer equipment and storage medium | |
CN103577294B (en) | For the method and apparatus followed the tracks of that interconnects | |
JPS5883451A (en) | Device for scanning communication channel | |
CN107924330A (en) | Technology for integrated thread scheduling | |
CN109213828B (en) | Block generation method, device, equipment and storage medium | |
CN112698959A (en) | Multi-core communication method and device | |
CN114691595B (en) | Multi-core circuit, data exchange method, electronic device, and storage medium | |
CN110457251A (en) | Data communications method and device between a kind of multiprocessor | |
CN107729221A (en) | Cross-thread message monitoring method, device, computer equipment and storage medium | |
CN114020529A (en) | Backup method and device of flow table data, network equipment and storage medium | |
CN114691448A (en) | Application program pause monitoring method, device, equipment and storage medium | |
US9338219B2 (en) | Direct push operations and gather operations | |
US20200099669A1 (en) | Secure In-line Network Packet Transmittal | |
CN112217689B (en) | Network message tracking method and system based on OpenStack | |
US20060256877A1 (en) | Rapid I/O Compliant Message Mapper |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |