CN111556058A - Session processing method and device - Google Patents

Session processing method and device Download PDF

Info

Publication number
CN111556058A
CN111556058A CN202010355379.3A CN202010355379A CN111556058A CN 111556058 A CN111556058 A CN 111556058A CN 202010355379 A CN202010355379 A CN 202010355379A CN 111556058 A CN111556058 A CN 111556058A
Authority
CN
China
Prior art keywords
session
thread
target
processing
data
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
CN202010355379.3A
Other languages
Chinese (zh)
Other versions
CN111556058B (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.)
Hangzhou DPtech Information Technology Co Ltd
Original Assignee
Hangzhou DPtech Information 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 Hangzhou DPtech Information Technology Co Ltd filed Critical Hangzhou DPtech Information Technology Co Ltd
Priority to CN202010355379.3A priority Critical patent/CN111556058B/en
Publication of CN111556058A publication Critical patent/CN111556058A/en
Application granted granted Critical
Publication of CN111556058B publication Critical patent/CN111556058B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The disclosure relates to a session processing method, a session processing device, an electronic device and a computer readable medium. The method comprises the following steps: the main server authenticates the session from the client, and stores the session data into a session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; storing the processing result in the target element in response to the session. The session processing method, the session processing device, the electronic equipment and the computer readable medium achieve the effect that the server is connected to the plurality of clients concurrently and processes the clients at high speed, and meanwhile, the security and the efficiency of the session between the server and the clients can be kept.

Description

Session processing method and device
Technical Field
The present disclosure relates to the field of computer information processing, and in particular, to a session processing method and apparatus, an electronic device, and a computer-readable medium.
Background
Communication between a client and a server requires both parties to determine a protocol, i.e., a special message. Both sides can package and analyze the message, and the client packages the data into a message and sends the message to the server. The server receives the message from the client, analyzes the data and feeds back the result to the client. There is therefore a need to establish a reliable connection, i.e. a receive-acknowledge mechanism, between the client and the server. In a real online environment, multiple clients are typically used to communicate with the server, but a conventional server can only communicate with one client at a time. When the issued requests are confirmed and then the next request is made, other clients can not receive the response of the server and are in a waiting state.
The server spends a significant amount of time waiting from the last response to the next request, wasting a significant amount of server CPU performance and interface bandwidth. The method has low efficiency, and the time consumption of issuing scenes by large-scale rules is too long. Therefore, a new session processing method, apparatus, electronic device and computer readable medium are needed.
The above information disclosed in this background section is only for enhancement of understanding of the background of the disclosure and therefore it may contain information that does not constitute prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of the above, the present disclosure provides a session processing method, a session processing apparatus, an electronic device, and a computer-readable medium, which achieve the effect of concurrent connection and high-speed processing of a server to multiple clients, and at the same time, can maintain the security and efficiency of a session between the server and the client.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, a session processing method is provided, which includes: the main server authenticates the session from the client, and stores the session data into a session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; storing the processing result in the target element in response to the session.
In an exemplary embodiment of the present disclosure, further comprising: when the main server fails, the main/standby switching operation is carried out; the original main server is switched to a standby server after being restarted; the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
In an exemplary embodiment of the present disclosure, before the master server authenticates the session from the client, the method further includes: the main server carries out initialization, and the initialization comprises the following steps: initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
In an exemplary embodiment of the present disclosure, the authentication of a session from a client by a primary server includes: extracting user information from the data packet of the session; and authenticating the user information.
In an exemplary embodiment of the present disclosure, further comprising: the main server determines the validity of the client Internet protocol address; and when the legality passes, creating a session by the message information of the session, and adding the session into a session table.
In an exemplary embodiment of the disclosure, determining a target packet thread based on the identification of the session includes: determining a target thread pool based on the identification of the session, wherein the target thread pool comprises a plurality of data packet threads; determining the target data packet thread among the plurality of data packet threads.
In an exemplary embodiment of the present disclosure, determining a target data processing thread from a plurality of data processing threads includes: binding a plurality of virtual processors with the plurality of data processing threads.
In an exemplary embodiment of the present disclosure, processing the parsed session data by the target data processing thread based on the target thread data packet queue includes: the target data processing thread reads the nodes in the target thread data packet queue in sequence; and processing the analyzed session data in the node.
In an exemplary embodiment of the present disclosure, storing the processing result in the target element in response to the session includes: determining a target element from the plurality of elements based on the target data packet thread; storing the processing result in the target element in response to the session.
In an exemplary embodiment of the present disclosure, storing the processing result in the target element in response to the session includes: storing the processing result into the target element; mounting the target element on a hash chain table in response to the session.
According to an aspect of the present disclosure, a session processing apparatus is provided, the apparatus including: the authentication module is used for the main server to authenticate the session from the client and store the session data into a session message buffer area after the authentication is passed; the analysis module is used for determining a target data packet thread based on the identifier of the session and analyzing the session data through the target data packet thread; the queue module is used for adding the analyzed session data into a target thread data packet queue; the thread module is used for determining a target data processing thread from a plurality of data processing threads; the processing module is used for processing the analyzed session data by the target data processing thread based on the target thread data packet queue; and the storage module is used for storing the processing result into the target element so as to respond to the conversation.
In an exemplary embodiment of the present disclosure, further comprising: the switching module is used for carrying out main/standby switching operation when the main server fails; the original main server is switched to a standby server after being restarted; the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
In an exemplary embodiment of the present disclosure, further comprising: an initialization module, configured to perform initialization by a main server, where the initialization includes: initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
According to an aspect of the present disclosure, an electronic device is provided, the electronic device including: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method as above.
According to an aspect of the disclosure, a computer-readable medium is proposed, on which a computer program is stored, which program, when being executed by a processor, carries out the method as above.
According to the session processing method, the session processing device, the electronic equipment and the computer readable medium, the main server authenticates the session from the client, and stores the session data into the session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; and storing the processing result into the target element to respond to the session, thereby realizing the effect of concurrent connection and high-speed processing of the server to a plurality of clients, and simultaneously maintaining the security and the high efficiency of the session between the server and the clients.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are merely some embodiments of the present disclosure, and other drawings may be derived from those drawings by those of ordinary skill in the art without inventive effort.
Fig. 1 is a flow diagram illustrating a session processing method in accordance with an exemplary embodiment.
Fig. 2 is a diagram illustrating a session handling method according to an example embodiment.
Fig. 3 is a flow chart illustrating a session handling method according to another exemplary embodiment.
Fig. 4 is a diagram illustrating a session processing method according to another exemplary embodiment.
Fig. 5 is a diagram illustrating a session processing method according to another exemplary embodiment.
Fig. 6 is a diagram illustrating a session processing method according to another exemplary embodiment.
Fig. 7 is a block diagram illustrating a session processing apparatus according to an example embodiment.
Fig. 8 is a block diagram illustrating a session processing apparatus according to another exemplary embodiment.
FIG. 9 is a block diagram illustrating an electronic device in accordance with an example embodiment.
FIG. 10 is a block diagram illustrating a computer-readable medium in accordance with an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The same reference numerals denote the same or similar parts in the drawings, and thus, a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another. Thus, a first component discussed below may be termed a second component without departing from the teachings of the disclosed concept. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
It will be appreciated by those skilled in the art that the drawings are schematic representations of exemplary embodiments and that the blocks or processes in the drawings are not necessarily required to practice the present disclosure and are, therefore, not intended to limit the scope of the present disclosure.
The method of combining the session table and the thread pool is adopted to process the messages from a plurality of clients, namely, a specific scheme for processing the messages from the clients by the server is provided. The adopted devices running on the actual network line usually have a main device and a standby device, the main device mainly processes actual services, and the standby device is used for backup and automatically replaces the main device when the main device has problems. How the server works in detail will be explained below.
It should be noted that before the primary server authenticates the session from the client, the method further includes: the main server carries out initialization, and the initialization comprises the following steps: initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
After the device is started, the server starts initialization and prepares for receiving a client message as follows:
1. initializing a session table, wherein the session table is used for storing information of each session, performing security authentication when a data stream arrives at the device, and allowing the data stream to enter the device after the data stream passes the authentication. The structure of the session table is as follows:
session ID Number of authentication requests from user Session state Establishing a source IP address for a session Receiving message information Read-write message thread
2. The packet thread pkt _ thread is initially processed, and contains a packet queue qkt _ que. The thread stores the packet in the node and suspends the packet in the packet queue for subsequent processing of the packet. The queue is thread independent, i.e. there is an independent qkt _ que queue for each thread, so there is no problem that concurrent operations affect performance.
3. A process thread handle _ thread is created for processing the nodes on the packet queue pkt _ que.
4. And initializing a socket for communication between the client and the server. And the server side listens at the appointed port.
5. And establishing a read socket thread, authenticating the data packet in the socket and reading the data packet to the session data buffer area.
6. And creating a thread reading session, and analyzing the message sent from the client.
7. And starting the server socket service to monitor the port.
8. And creating n thread pools for message processing. The device processes using a total of x threads, i.e., each thread pool initializes x/n threads for use. The x/n threads in each thread pool are all bound on the same VCPU, so that different thread pools do not have competition relation on scheduling opportunities. The values of n and x should be selected as powers of 2 (e.g., n is 4 and x is 64) in principle, so that the distribution is simple and uniform.
9. And initializing tlv _ buff global variables of the n elements, wherein the tlv _ buff global variables are respectively used for storing the processed data in each thread pool.
By this initialization is completed, the server process begins to receive client requests.
Fig. 1 is a flow diagram illustrating a session processing method in accordance with an exemplary embodiment. The session processing method 10 includes at least steps S102 to S112.
As shown in fig. 1, in S102, the host server authenticates the session from the client, and stores the session data in the session packet buffer after the authentication is passed. The method comprises the following steps: extracting user information from the data packet of the session; and authenticating the user information.
More specifically, the user uses the client to send the message to the server. The client end can actively establish connection with the server end to complete socket initialization, connection and data transmission. The client firstly sends authentication information to the server through the socket and obtains the feedback of the server.
In one embodiment, further comprising: the main server determines the validity of the client Internet protocol address; when the validity passes, establishing a session through the message information of the session; and adding the session into a session table.
In S104, a target data packet thread is determined based on the identifier of the session, and the session data is analyzed by the target data packet thread. The method comprises the following steps: determining a target thread pool based on the identification of the session, wherein the target thread pool comprises a plurality of data packet threads; determining the target data packet thread among the plurality of data packet threads
And in S106, adding the analyzed session data into a target thread data packet queue.
In S108, a target data processing thread is determined from the plurality of data processing threads. Can include the following steps: binding a plurality of virtual processors with the plurality of data processing threads.
In S110, based on the target thread data packet queue, the target data processing thread processes the analyzed session data. The method comprises the following steps: the target data processing thread reads the nodes in the target thread data packet queue in sequence; and processing the analyzed session data in the node.
In S112, the processing result is stored in response to the session. The method comprises the following steps: determining a target element from the plurality of elements based on the target data packet thread; storing the processing result in the target element in response to the session. Further comprising: and mounting the target element on a hash chain table to respond to the session.
According to the session processing method disclosed by the invention, the main server authenticates the session from the client, and stores the session data into the session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; and storing the processing result into the target element to respond to the session, thereby realizing the effect of concurrent connection and high-speed processing of the server to a plurality of clients, and simultaneously maintaining the security and the high efficiency of the session between the server and the clients.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Fig. 2 is a diagram illustrating a session handling method according to an example embodiment. As shown in fig. 2, when the main server fails, the main/standby switching operation is performed; the original main server is switched to a standby server after being restarted; the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
The main device and the standby device have different use functions and therefore have different flow designs. The main function of the main device is to receive messages from the client for processing, and the main function of the standby device is to synchronize data of the main device so as to replace the main device to work when the main device fails. The main-standby synchronization is also realized by the session, and the standby equipment does not send data to the outside and only receives the synchronous data from the main equipment. The protocol data processing processes of the main device and the standby device are basically consistent, and only the protocol data processing processes are not fed back to the client and are not used for actively sending data.
The master device establishes a connection socket at initialization and starts receiving connection requests from the standby device. And establishing a session for the master-slave communication, and starting to send data of the master device to the backup device after the backup device is connected, or when the master device and the backup device are both in work, the master control receives the data from the client and then sends the received data to the backup device through the master-slave communication session. The session table of the standby device is also from the primary device and the standby device does not accept connections from the client.
When the main device fails and needs to be switched between the main device and the standby device, the main device actively sends a main-standby switching signal to the standby device, and at the moment, the main device is restarted, and the standby device receives the signal and switches the signal into the main device. Firstly, x conversation threads used for synchronizing data and corresponding n thread pools (corresponding to the threads of the main equipment) are destroyed, and then the flow of the main equipment is carried out. When the initialization process of the main device is finished, the device starts to work normally.
Fig. 3 is a flow chart illustrating a session handling method according to another exemplary embodiment. The flow shown in fig. 3 is a detailed description of S102 "the host server authenticates the session from the client, and stores the session data in the session message buffer after the authentication is passed" in the flow shown in fig. 1.
As shown in fig. 3, in S302, the client IP is checked.
In S304, a session is created using header information of the packet, and added to the session table.
In S306, when the client IP has an error, feedback information is generated.
In S308, the client IP is checked.
In S310, information such as a user name and a password in the packet is verified.
In S312, when the verification fails, feedback information is generated.
In S314, a read thread is created, and data is placed in the session buffer.
In S316, when an error occurs in the buffer, feedback information is generated.
The server monitors the socket, triggers the receiving process of the server and receives the socket of the client. The validity of the ip of the client is checked, i.e. whether the ip is trusted, i.e. whether the client to which the socket belongs is trusted. After the examination, the session is added to the session table, and the session related information is updated.
If the message is an invalid message, feeding back the information to the client; and if the message is a valid message, authenticating the user information and reading the data. And authenticating the user name, the password and the client ip of the user. If the authentication fails, feeding back the information to the client; and if the authentication is successful, a reading thread is created, and the information in the socket is read and put into the session message buffer area. And connecting with the end after the reading is finished.
Fig. 4 is a diagram illustrating a session processing method according to another exemplary embodiment. As shown in fig. 4, determining a target data packet thread based on the identifier of the session, and analyzing the session data through the target data packet thread; and adding the analyzed session data into a target thread data packet queue.
More specifically, x threads pkt _ thread may be created, for example, to obtain a session, obtain a thread pool number by dividing the session id by n, and obtain an idle thread pkt _ thread _ i (packet thread) from the thread pool to parse a packet sent from the client. And n threads work at the same time, so that concurrent processing of n users can be realized. After the data of each thread is read, the node corresponding to the data is added to the thread data packet queue qkt-que, and the data is processed by the data processing thread handle _ thread. And taking the next node from the read packet queue pkt _ que to the packet node corresponding to the session, and receiving and returning the data in the socket buffer.
Fig. 5 is a diagram illustrating a session processing method according to another exemplary embodiment. As shown in fig. 5, a target data processing thread is determined from a plurality of data processing threads; and processing the analyzed session data by the target data processing thread based on the target thread data packet queue.
More specifically, n data processing threads handle _ thread may be created, for example, to be bound to n VCPUs respectively (the n VCPUs are different from the VCPU to which the thread pool is bound, so there is no scheduling contention between the two). A node on the queue qkt-que for processing packets, and when the queue is empty, the thread is in a wait state; if not, entering to circularly read the message information in the data packet queue node, performing corresponding processing, and putting the processed data into the elements corresponding to the corresponding subscripts of tlv _ buff. After the information in the nodes is processed, the nodes are mounted at the tail of the data packet queue qkt-que, and resources are recycled. And continuously entering a thread waiting state after no data packet needing to be processed exists.
Fig. 6 is a diagram illustrating a session processing method according to another exemplary embodiment. As shown in fig. 6, the processing result is stored in the target element in response to the session.
More specifically, the data may be stored on a hash chain, for example, and the basic unit is a rule node on the chain. After the n kernel mode management threads take data from the user mode process, hash values are calculated according to a certain algorithm and then are inserted into the hash chain table. The device will pre-apply for idle node in advance for use, in the invention, the original single idle node linked list is changed into n idle node linked lists, which respectively correspond to n user mode threads and n kernel mode management threads, and the number of idle nodes on each idle node linked list in the initial state is the same. When processing user mode data, the idle nodes on the idle node linked list corresponding to the current thread are pre-allocated to each thread for use. When the nodes pre-distributed by a certain thread are used up, other idle node linked lists are traversed to obtain idle nodes, the idle nodes are released and put on the idle node linked list of the current thread, and the access of each linked list is concurrently protected by a mutual exclusion lock.
In general, the rule issuing speed on each thread is balanced, so that the condition that a certain idle node linked list is used up does not occur generally; once the idle node occurs, the idle node is obtained from the idle node linked list corresponding to other threads, so that the probability of lock contention is very low. Therefore, the method not only ensures the global concurrent use of all idle rule nodes, but also reduces the lock competition among threads to the maximum extent.
Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as computer programs executed by a CPU. When executed by the CPU, performs the functions defined by the above-described methods provided by the present disclosure. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic or optical disk, or the like.
Furthermore, it should be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
Fig. 7 is a block diagram illustrating a session processing apparatus according to an example embodiment. As shown in fig. 7, the session processing device 70 includes: authentication module 702, parsing module 704, queue module 706, thread module 708, processing module 710, storage module 712.
The authentication module 702 is used for the main server to authenticate the session from the client, and after the authentication is passed, the session data is stored in the session message buffer area; the method comprises the following steps: extracting user information from the data packet of the session; and authenticating the user information.
The analysis module 704 is configured to determine a target data packet thread based on the identifier of the session, and analyze the session data through the target data packet thread; the method comprises the following steps: determining a target thread pool based on the identification of the session, wherein the target thread pool comprises a plurality of data packet threads; determining the target data packet thread among the plurality of data packet threads
The queue module 706 is configured to add the parsed session data to a target thread data packet queue;
the thread module 708 is configured to determine a target data processing thread from the plurality of data processing threads; can include the following steps: binding a plurality of virtual processors with the plurality of data processing threads.
The processing module 710 is configured to process the analyzed session data by the target data processing thread based on the target thread data packet queue; the method comprises the following steps: the target data processing thread reads the nodes in the target thread data packet queue in sequence; and processing the analyzed session data in the node.
The storage module 712 is used to store the processing results into the target element in response to the session. The method comprises the following steps: determining a target element from the plurality of elements based on the target data packet thread; storing the processing result in the target element in response to the session. Further comprising: and mounting the target element on a hash chain table to respond to the session.
Fig. 8 is a block diagram illustrating a session processing apparatus according to another exemplary embodiment. As shown in fig. 8, the session processing device 80 includes: a switching module 802 and an initializing module 804.
The switching module 802 is configured to perform a main/standby switching operation when the main server fails; the original main server is switched to a standby server after being restarted; the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
The initialization module 804 is configured to perform initialization by the main server, where the initialization includes: initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
According to the session processing device disclosed by the invention, the main server authenticates the session from the client, and stores the session data into the session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; and storing the processing result into the target element to respond to the session, thereby realizing the effect of concurrent connection and high-speed processing of the server to a plurality of clients, and simultaneously maintaining the security and the high efficiency of the session between the server and the clients.
FIG. 9 is a block diagram illustrating an electronic device in accordance with an example embodiment.
An electronic device 900 according to this embodiment of the disclosure is described below with reference to fig. 9. The electronic device 900 shown in fig. 9 is only an example and should not bring any limitations to the functionality or scope of use of the embodiments of the present disclosure.
As shown in fig. 9, the electronic device 900 is embodied in the form of a general purpose computing device. Components of electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different system components (including the storage unit 920 and the processing unit 910), a display unit 940, and the like.
Wherein the storage unit stores program codes, which can be executed by the processing unit 910, so that the processing unit 910 performs the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned electronic prescription flow processing method section of this specification. For example, the processing unit 910 may perform the steps shown in fig. 1 and 3.
The storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM)9201 and/or a cache memory unit 9202, and may further include a read only memory unit (ROM) 9203.
The memory unit 920 may also include a program/utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 930 can be any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 900 may also communicate with one or more external devices 900' (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 900, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 900 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interface 950. Also, the electronic device 900 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 960. The network adapter 960 may communicate with other modules of the electronic device 900 via the bus 930. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, as shown in fig. 10, the technical solution according to the embodiment of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiment of the present disclosure.
The software product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The computer readable medium carries one or more programs which, when executed by a device, cause the computer readable medium to perform the functions of: the main server authenticates the session from the client, and stores the session data into a session message buffer area after the authentication is passed; determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread; adding the analyzed session data into a target thread data packet queue; determining a target data processing thread from a plurality of data processing threads; processing the analyzed session data by the target data processing thread based on the target thread data packet queue; storing the processing result in the target element in response to the session.
Those skilled in the art will appreciate that the modules described above may be distributed in the apparatus according to the description of the embodiments, or may be modified accordingly in one or more apparatuses unique from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules.
Exemplary embodiments of the present disclosure are specifically illustrated and described above. It is to be understood that the present disclosure is not limited to the precise arrangements, instrumentalities, or instrumentalities described herein; on the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (13)

1. A session processing method, comprising:
the main server authenticates the session from the client, and stores the session data into a session message buffer area after the authentication is passed;
determining a target data packet thread based on the identification of the session, and analyzing the session data through the target data packet thread;
adding the analyzed session data into a target thread data packet queue;
determining a target data processing thread from a plurality of data processing threads;
processing the analyzed session data by the target data processing thread based on the target thread data packet queue;
storing the processing result in response to the session.
2. The method of claim 1, further comprising:
when the main server fails, the main/standby switching operation is carried out;
the original main server is switched to a standby server after being restarted;
the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
3. The method of claim 2, wherein prior to the primary server authenticating the session from the client, further comprising:
the main server carries out initialization, and the initialization comprises the following steps:
initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
4. The method of claim 1, wherein the primary server authenticating the session from the client comprises:
extracting user information from the data packet of the session;
and authenticating the user information.
5. The method of claim 4, further comprising:
the main server determines the validity of the client Internet protocol address;
when the validity passes, establishing a session through the message information of the session;
and adding the session into a session table.
6. The method of claim 3, wherein determining a target packet thread based on the identification of the session comprises:
determining a target thread pool based on the identification of the session, wherein the target thread pool comprises a plurality of data packet threads;
determining the target data packet thread among the plurality of data packet threads.
7. The method of claim 1, wherein determining a target data processing thread from among a plurality of data processing threads comprises:
binding a plurality of virtual processors with the plurality of data processing threads.
8. The method of claim 1, wherein processing the parsed session data by the target data processing thread based on the target thread packet queue comprises:
the target data processing thread reads the nodes in the target thread data packet queue in sequence;
and processing the analyzed session data in the node.
9. The method of claim 3, wherein storing processing results in response to the session comprises:
determining a target element from the plurality of elements based on the target data packet thread;
storing the processing result in the target element in response to the session.
10. The method of claim 9, wherein storing the processing result in the target element in response to the session comprises:
storing the processing result into the target element;
and mounting the target element on a hash chain table to respond to the session.
11. A session processing apparatus, comprising:
the authentication module is used for the main server to authenticate the session from the client and store the session data into a session message buffer area after the authentication is passed;
the analysis module is used for determining a target data packet thread based on the identifier of the session and analyzing the session data through the target data packet thread;
the queue module is used for adding the analyzed session data into a target thread data packet queue;
the thread module is used for determining a target data processing thread from a plurality of data processing threads;
the processing module is used for processing the analyzed session data by the target data processing thread based on the target thread data packet queue;
and the storage module is used for storing the processing result into the target element so as to respond to the conversation.
12. The apparatus of claim 11, further comprising:
the switching module is used for carrying out main/standby switching operation when the main server fails; the original main server is switched to a standby server after being restarted; the original standby server receives the switching signal, and the configuration of the original main server is reserved and converted into the main server.
13. The apparatus of claim 12, further comprising:
an initialization module, configured to perform initialization by a main server, where the initialization includes: initializing a session table; initializing a plurality of data packet processing threads; creating a plurality of processing threads; initializing a socket; creating a read socket thread; creating a reading conversation thread; starting a socket service; creating a plurality of thread pools; a plurality of elements are initialized.
CN202010355379.3A 2020-04-29 2020-04-29 Session processing method and device Active CN111556058B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010355379.3A CN111556058B (en) 2020-04-29 2020-04-29 Session processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010355379.3A CN111556058B (en) 2020-04-29 2020-04-29 Session processing method and device

Publications (2)

Publication Number Publication Date
CN111556058A true CN111556058A (en) 2020-08-18
CN111556058B CN111556058B (en) 2022-09-09

Family

ID=72003145

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010355379.3A Active CN111556058B (en) 2020-04-29 2020-04-29 Session processing method and device

Country Status (1)

Country Link
CN (1) CN111556058B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112437125A (en) * 2020-11-10 2021-03-02 北京百度网讯科技有限公司 Information concurrent processing method and device, electronic equipment and storage medium
CN113377265A (en) * 2021-06-25 2021-09-10 数字广东网络建设有限公司 Annotating method, annotating device, mobile terminal and storage medium
CN113691589A (en) * 2021-07-27 2021-11-23 杭州迪普科技股份有限公司 Message transmission method, device and system
CN115665042A (en) * 2022-12-12 2023-01-31 深圳艾灵网络有限公司 Data processing method, device, user plane functional entity and storage medium
CN116668412A (en) * 2023-06-02 2023-08-29 北京首都在线科技股份有限公司 Communication interaction method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020116505A1 (en) * 2001-02-19 2002-08-22 Geoff Higgins Content provider and method for a computer system
CN101453452A (en) * 2007-12-07 2009-06-10 国际商业机器公司 SIP message processing method and apparatus based on multiple cores
CN107592303A (en) * 2017-08-28 2018-01-16 北京明朝万达科技股份有限公司 A kind of high speed mirror is as the extracting method and device of outgoing document in network traffics

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020116505A1 (en) * 2001-02-19 2002-08-22 Geoff Higgins Content provider and method for a computer system
CN101453452A (en) * 2007-12-07 2009-06-10 国际商业机器公司 SIP message processing method and apparatus based on multiple cores
CN107592303A (en) * 2017-08-28 2018-01-16 北京明朝万达科技股份有限公司 A kind of high speed mirror is as the extracting method and device of outgoing document in network traffics

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
丘志杰: "分布式文件系统的研究―并发通信及网络互斥的设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112437125A (en) * 2020-11-10 2021-03-02 北京百度网讯科技有限公司 Information concurrent processing method and device, electronic equipment and storage medium
CN112437125B (en) * 2020-11-10 2022-05-03 阿波罗智联(北京)科技有限公司 Information concurrent processing method and device, electronic equipment and storage medium
CN113377265A (en) * 2021-06-25 2021-09-10 数字广东网络建设有限公司 Annotating method, annotating device, mobile terminal and storage medium
CN113377265B (en) * 2021-06-25 2024-05-28 数字广东网络建设有限公司 Annotating method and device, mobile terminal and storage medium
CN113691589A (en) * 2021-07-27 2021-11-23 杭州迪普科技股份有限公司 Message transmission method, device and system
CN113691589B (en) * 2021-07-27 2023-12-26 杭州迪普科技股份有限公司 Message transmission method, device and system
CN115665042A (en) * 2022-12-12 2023-01-31 深圳艾灵网络有限公司 Data processing method, device, user plane functional entity and storage medium
CN115665042B (en) * 2022-12-12 2023-02-28 深圳艾灵网络有限公司 Data processing method, device, user plane functional entity and storage medium
CN116668412A (en) * 2023-06-02 2023-08-29 北京首都在线科技股份有限公司 Communication interaction method and device, electronic equipment and storage medium
CN116668412B (en) * 2023-06-02 2024-02-13 北京首都在线科技股份有限公司 Communication interaction method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111556058B (en) 2022-09-09

Similar Documents

Publication Publication Date Title
CN111556058B (en) Session processing method and device
RU2419986C2 (en) Combining multiline protocol accesses
US10037266B2 (en) Game stream fuzz testing and automation
WO2019184164A1 (en) Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium
CN109213900B (en) Data modification method, device, equipment and medium for block chain
US20220311607A1 (en) Key generation method and apparatus, device, and medium
CN114218133A (en) Data transmission method and device
Boutros et al. Build fast, trade fast: FPGA-based high-frequency trading using high-level synthesis
CN109032796A (en) A kind of data processing method and device
WO2014194452A1 (en) Message publishing and subscribing method and apparatus
CN109254854A (en) Asynchronous invoking method, computer installation and storage medium
CN112187491A (en) Server management method, device and equipment
CN113922968B (en) Method and device for generating and verifying access token, electronic equipment and storage medium
US20090132638A1 (en) Server-processor hybrid system for processing data
KR20220074971A (en) Blockchain-based data processing method, apparatus and device, and readable storage medium
JP2009123202A (en) Processor-server hybrid system for processing data
CN113946816A (en) Cloud service-based authentication method and device, electronic equipment and storage medium
US20070169012A1 (en) Asynchronous just-in-time compilation
US20170279777A1 (en) File signature system and method
CN111221655A (en) Method and device for managing resources of OpenStack platform
CN115499889A (en) VPP-based UPF forwarding plane implementation method, device, system and related equipment
CN111905361B (en) Game service system, game processing method, storage medium and device
US20150032789A1 (en) Dynamic object oriented remote instantiation
WO2021128936A1 (en) Message processing method and apparatus
KR101946620B1 (en) Method and server for generating a block of data comprising signature of the server

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