A virtual reference station high-stability and high-performance differential data broadcasting method and device
By adopting asynchronous event mechanism and multi-level thread pool in the differential data propagation system, slow I/O operations and data propagation processing are isolated, and zero copy technology is applied in data copy, the problem of insufficient thread resources when a large number of users is connected is solved, and differential data propagation with high stability and low latency is achieved.
Patent Information
- Application Number
- CN202410696611.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-05-31
AI Technical Summary
When a large number of users are connected at the same time, existing differential data propagation systems will lead to insufficient thread resources, resulting in delay in differential data propagation and affecting system stability.
Adopt an asynchronous event mechanism to establish a multi-level thread pool and task queue, isolate slow I/O operations and data propagation processing, put user authentication and connection processing into the queue processing, deny service when the load is too high, ensure system stability, and use zero copy technology to optimize data copying.
It effectively reduces the delay in differential data broadcasting, improves the stability and performance of the system, and avoids service drag due to insufficient thread resources.
Smart Images

Figure CN118488092B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of satellite navigation technology, and in particular relates to a virtual reference station high-stability and high-performance differential data broadcasting method and device. Background Art
[0002] Satellite navigation technology is a technology that uses navigation satellites to navigate and locate users on the ground, ocean, air and space. Satellite navigation combines the advantages of traditional navigation and realizes global, all-weather, high-precision navigation positioning, navigation and timing services. In the late 20th century, China began to explore the development path of satellite navigation systems suitable for its national conditions. At the end of 2000, the BeiDou-1 system was built to provide services to China; at the end of 2012, the BeiDou-2 system was built to provide services to the Asia-Pacific region; in 2020, the BeiDou-3 system was built to provide services to the world. Ordinary pseudo-range single-point positioning technology is mature and low-cost. It has been widely used in many fields such as vehicle positioning and mobile phone navigation. The horizontal positioning accuracy can reach about 10 meters. Differential positioning technology calculates the difference between the distance from the base station to the satellite and the pseudo-distance observed by the base station receiver due to errors based on the known precise coordinates of the base station. This difference is sent out by the base station in real time. While the user receiver is observing the navigation satellite, it also receives the correction number from the base station and corrects the positioning result to eliminate common errors. Depending on the different user receiver equipment, the differential positioning technology can achieve decimeter, centimeter and millimeter levels, significantly improving positioning accuracy.
[0003] The effective coverage range of a base station is generally about 50 kilometers. A base station is established every 40 to 50 kilometers. Each base station uploads differential data to the data center. The data center constructs a triangulated network with three nearby base stations, and performs filtering, re-differentiation and other technical processing on the data of the three base stations to improve the accuracy and stability of the differential data. The constructed multiple triangulated networks are then connected to cover the entire country, forming a differential data network covering the entire country. When the user receiver is connected to the differential data network server, the server will virtualize a base station around the user receiver to send differential data to the user receiver. Such a differential data network is called a virtual reference station network, or VRS for short.
[0004] The Radio Technical Commission for Maritime Services (RTCM) defines the differential data format and recommends the service protocol NTRIP (Networked Transport of RTCM via Internet Protocol) between user receivers that need to be positioned and differential data broadcasting platforms. Currently, user receivers that use carrier phase positioning and pseudo-range differential positioning all follow the NTRIP protocol and RTCM data format.
[0005] The existing technical solution for the VRS differential data broadcasting platform is to divide the system into a differential data processing center and a user access service. The differential data processing center is used to receive and process the differential data sent by the base station. The user access service is used to accept the network connection of the user receiver, obtain the differential data from the differential data processing center according to the user's location, and send the data to the user receiver in real time.
[0006] Differential positioning technology has high requirements for data latency. When the user receiver is connected to the differential data network server, the server will send data to the user receiver at a frequency of 1 Hz. The amount of data sent each time is about 800 bytes. The existing technical solution is to divide the system into a differential data processing center and a user access service. The differential data processing center is used to receive and process the differential data sent by the base station. 2,000 to 3,000 base stations can basically cover the entire country, and the connection source is stable. However, the user access service needs to accept a large number of concurrent network connections. The user access service uses the epoll event mechanism and multi-threading technology to improve the concurrent processing capability, and can stably handle the real-time online data broadcasting of 10,000 users. Any more concurrent connections will affect the timeliness of the differential data broadcasting.
[0007] The reason why this problem occurs in the prior art is that users need to execute multiple business logics such as user authentication, obtaining mount points, data subscription and data broadcasting when accessing services, and user authentication and mount point information are stored in the database or cache. These I / O operations are slow operations compared to the CPU. When a large number of users connect to the system for user authentication at the same time, a large amount of thread resources will be occupied. Insufficient thread resources will cause delays in broadcasting differential data to users, but all differential data that need to be broadcast are always received from the differential data processing center at a frequency of 1 Hz. Once the sending speed is lower than the receiving speed, the differential data that needs to be sent to the user's receiver will be backlogged, the delay in sending differential data will increase, and the service will slowly be dragged down. Even if the peak period of user connection has passed and the service has returned to normal, the data delay during this peak period will still be obvious. Summary of the invention
[0008] The purpose of the present invention is to provide a high-stability and high-performance differential data broadcasting method for a virtual reference station, which is used to solve the problem that in the existing differential data broadcasting, when a large number of users are connected to the system for user authentication at the same time, a large amount of thread resources will be occupied. Insufficient thread resources will cause delays in broadcasting differential data to users, but all differential data that need to be broadcast are always received from the differential data processing center at a frequency of 1 Hz. Once the sending speed is lower than the receiving speed, the differential data that needs to be sent to the user receiver will be backlogged, the delay in sending the differential data will increase, and the service will slowly be dragged down.
[0009] In order to achieve the above object, the present invention provides the following technical solutions:
[0010] A virtual reference station high-stability and high-performance differential data broadcasting method comprises the following steps:
[0011] The S1 differential data broadcasting platform monitors the network port and puts the client into the connection queue. When the client connection is ready, the client connection is handed over to the authentication processor;
[0012] S2 authentication service module determines the status of the authentication queue, the authentication processing thread obtains tasks from the authentication queue, parses the client connection information, and passes the parsed user information to the terminal authentication service module, and the authentication service module passes the authenticated client connection to the session processor;
[0013] The S3 session processor determines the state of the session connection hash table, binds a fixed thread from the session processing thread pool to the session connection of the client that has successfully shaken hands, and finally puts the session connection into the session connection hash table;
[0014] The S4 session processor subscribes to the network differential data message queue from the message middleware, obtains the subscribed client session connection, and sends it to the client's corresponding differential data broadcast thread to the client connection.
[0015] The S1 specifically includes:
[0016] The differential data broadcasting platform listens to the specified network port. When the client connects to the differential broadcasting platform, the program notifies the connection processor through the event mechanism. The connection processor determines the status of the connection queue. If the connection queue is full, it writes a status code to the client connection to indicate that the service is full and closes the connection. Otherwise, the client connection is placed in the connection queue. The connection processing threads in the connection processing thread pool obtain tasks from the connection queue in turn and process the connection status.
[0017] The S1 specifically also includes: the client sends NTRIP protocol connection information, the authentication processor determines the status of the authentication queue, if the authentication queue is full, the authentication processor writes a status code to the client connection to indicate that the server is full, and closes the connection, the upper-layer LVS load balancer will load the new client connection to other terminal access services in the cluster environment, otherwise the client NTRIP connection information is placed in the authentication queue, if the client connection does not send NTRIP connection information within the specified time, the authentication processor will directly close the client connection.
[0018] Furthermore, the S2 specifically includes:
[0019] The authentication processing thread parses the NTRIP client connection information, and parses out the username, password and mount point information. If the mount point is empty, it obtains the mount point list from the mount point service module, writes the status code and the mount point list content to the client connection, indicating that the mount point list is successfully obtained, and closes the client connection; otherwise, the username, password and mount point information are handed over to the terminal authentication service module for processing.
[0020] Furthermore, S3 includes: the session processor uses a sequential loop method to bind a fixed thread to the session connection from the session processing thread pool, and finally puts the session connection into a session connection hash table. The session connection is then processed by the thread for data transmission and reception throughout its entire life cycle.
[0021] Furthermore, when the client receives the 200 status code information sent by the server, the client will periodically send data packets of the global positioning system fixed data GGA to indicate its own location. The session processor parses the longitude and latitude information from the GGA data, calculates the grid of the virtual reference station network based on the longitude and latitude information, and subscribes to the grid differential data through the message middleware.
[0022] Furthermore, the S4 specifically includes:
[0023] The session processor subscribes to the grid differential data message queue from the message middleware. When the session processor receives the differential data, it puts the differential data into the direct memory in a zero-copy manner. The session processor obtains the subscribed client session connection from the grid subscription hash table and sends it to the client connection through the differential data broadcasting thread corresponding to the client.
[0024] Furthermore, the queue size and number of thread pools in the connection processor and authentication processor, the number of online sessions and the number of threads in the thread pool of the session processor are initialized in the form of a configuration file when the program starts, and can be viewed and dynamically adjusted at any time during the actual operation.
[0025] Furthermore, the initialization configuration specifically includes:
[0026] (1) When the program is initialized, it reads the connection processor configuration parameters, the authentication processor configuration parameters, and the session processor configuration parameters;
[0027] (2) Publishing connection handler configuration parameters, session handler configuration parameters, and authentication handler configuration parameters as JMX endpoints;
[0028] (3) Publish multiple metrics such as memory, processor, and TCP requests as JMX endpoints;
[0029] (4) Publish memory snapshots, thread snapshots, and TCP connection snapshots as JMX endpoints to query memory, thread, and TCP connection status in real time, and check for potential memory leaks, thread execution time, and online client status;
[0030] (5) System operation and maintenance personnel use the JMX client to view the system execution status and adjust various parameters in real time.
[0031] Furthermore, the zero copy technology specifically includes:
[0032] (1) When the program is initialized, it requests a specified size of direct memory from the operating system kernel. The operating system kernel allocates memory for the system from the kernel buffer and pools the direct memory.
[0033] (2) The session processor obtains the differential data and applies for direct memory from the pooled direct memory. If the direct memory application fails, a system alarm is triggered and the data is not sent. Otherwise, the differential data is written to the applied direct memory and the reference count is enabled.
[0034] (3) After the differential data is successfully written into the direct memory, the session processor queries the client session connection list that subscribes to the differential data, traverses the client session connection list, and the bound session processing thread copies the content in the direct memory to the socket buffer area of the client session connection;
[0035] (4) Before the session processing thread starts sending, it increases the data reference count by 1. When the data is copied from the direct memory to the socket buffer area, it decreases the reference count of the differential data in the direct memory by 1. When the reference count is 0, the session processing thread that last operated the data is responsible for releasing the applied direct memory, and the direct memory is put back into the pooled direct memory area.
[0036] (5) The DMA controller is responsible for sending the data in the Socket buffer to the network card.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] (1) This application establishes a multi-level thread pool and a corresponding task queue based on asynchronous events without increasing hardware costs. By isolating the slow I / O operations in the system from the data broadcasting processing, slow operations such as user receiver connection and user authentication processing can be put into the queue and processed in sequence. When the load is too large, it can even deny service, allowing the upper-level load balancer to reasonably load the connection to other services in the cluster, thereby ensuring the stability of the system service and reducing differential data delay.
[0039] (2) This application applies zero-copy technology in the differential data broadcasting process. Zero-copy technology is a hardware-level optimization. The data copying is done by the DMA (Direct Memory Access) controller. When the CPU interacts with external hardware such as disks and network cards, due to the speed limit of the hardware, the CPU will send a data copy command to the DMA controller on the motherboard, and the DMA controller will complete the data copying. The DMA copying does not require the participation of the CPU. The zero-copy technology does not mean that the copying is unnecessary, but it saves the data copying from the user buffer to the kernel buffer that requires the participation of the CPU. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0041] Figure 1 A flow chart of a virtual reference station high-stability and high-performance differential data broadcasting method of the present invention;
[0042] Figure 2 A flowchart of a kernel memory application and use method based on zero-copy technology of the present invention;
[0043] Figure 3 It is a structural schematic diagram of a virtual reference station high-stability and high-performance differential data broadcasting device of the present invention;
[0044] Figure 4 This is an overall architecture diagram of a virtual reference station high-stability and high-performance differential data broadcasting system of the present invention. DETAILED DESCRIPTION
[0045] In order to clearly describe the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, words such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first threshold and the second threshold are only used to distinguish different thresholds, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0046] It should be noted that, in the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0047] In the present invention, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, the combination of a and b, the combination of a and c, the combination of b and c, or the combination of a, b and c, where a, b, c can be single or multiple.
[0048] In the process of differential data broadcasting, ensuring the stability of the data broadcasting thread pool resources is the key to ensuring low latency of data broadcasting. The purpose of the present invention is to establish a multi-level thread pool and a corresponding task queue based on asynchronous events without increasing the hardware cost. By isolating the slow I / O operations in the system from the data broadcasting processing, slow operations such as user receiver connection and user authentication processing can be put into the queue for sequential processing. When the load is too large, it can even deny service to allow the upper-level load balancer to reasonably load the connection to other services in the cluster, thereby ensuring the stability of the system service and reducing the differential data delay.
[0049] Embodiment 1:
[0050] Figure 1 This is a flow chart of a method for high-stability and high-performance differential data broadcasting of a virtual reference station of the present invention, and the specific steps are as follows:
[0051] (1) First, the differential data broadcasting platform listens on the specified network port as a TCP server and is responsible for processing the TCP connection of the user receiver. When the user receiver (hereinafter referred to as the client) connects to the differential data broadcasting platform, the program notifies the connection handler through the event mechanism. The connection handler determines the status of the connection queue. If the connection queue is full, it writes a 503 status code to the client connection to indicate that the service is full and closes the connection. Otherwise, the client connection is placed in the connection queue. The connection processing threads in the connection processing thread pool obtain tasks from the connection queue in turn and process the connection status.
[0052] (2) When the client connection is ready after passing through the states of ACCEPT, CONNECT, READ, WRITE, etc. or the connection is closed, the processing thread is released (RELEASE) to the connection processing thread pool, and the client connection is handed over to the authentication handler (Auth Handler).
[0053] (3) After the client connection is ready, the client will send the NTRIP protocol connection information. The authentication processor (Auth Handler) determines the status of the authentication queue. If the authentication queue is full, the authentication processor writes a 503 status code to the client connection to indicate that the server is full and closes the connection. The upper-level LVS load balancer will load the new client connection to other terminal access services in the cluster environment. Otherwise, the client NTRIP connection information is placed in the authentication queue. If the client connection does not send the NTRIP connection information within a specified time, such as 10 seconds, the authentication processor will directly close the client connection.
[0054] (4) The authentication processing threads in the authentication processing thread pool obtain tasks from the authentication queue in turn. The authentication processing threads parse the NTRIP client connection information and parse out the user name, password and mount point information. If the mount point is empty, the mount point list is obtained from the mount point service module, and a 200 status code and the mount point list content are written to the client connection, indicating that the mount point list is obtained successfully, and the client connection is closed; otherwise, the user name, password and mount point information are handed over to the terminal authentication service module for processing. If the authentication fails, a 401 status code is returned to the client connection and the connection is closed. Otherwise, the client connection is handed over to the session handler.
[0055] (5) The session handler determines the status of the session connection hash table. If the session connection hash table is full, the session handler writes a 503 status code to the client connection to indicate that the server is full and closes the connection. Otherwise, it returns a 200 status code to indicate that the handshake between the two parties is successful. The session handler uses a round-robin method to bind a fixed thread to the session connection from the session processing thread pool, and finally puts the above session connection into the session connection hash table. The session connection is then processed by this thread for data reception and transmission throughout its entire life cycle. A session processing thread is responsible for processing multiple client session connections, which improves performance, but there is no thread switching, freeing data reception and transmission processing from thread safety and lock synchronization.
[0056] (6) After the client receives the 200 status code from the server, it will continuously report GGA (Global Positioning System Fix Data) data packets at a certain frequency to indicate its own location. The session processor parses the longitude and latitude information from the GGA data and calculates the grid of the virtual reference station network based on the longitude and latitude information.
[0057] (7) The differential data subscription service module publishes the grid differential data subscription message to the grid subscription queue of the message middleware. If the grid data has been subscribed, the subscription information is ignored. Otherwise, the grid differential data is obtained from the differential data processing center at a regular interval and sent to the differential data message queue of the message middleware.
[0058] (8) The session processor subscribes to the grid differential data message queue from the message middleware. When the session processor receives the differential data, it puts the differential data into direct memory in a zero-copy manner. The session processor obtains the subscribed client session connection from the grid subscription hash table and sends it to the client connection through the differential data broadcasting thread corresponding to the client.
[0059] Embodiment 2:
[0060] The data broadcasting method provided by the present invention also designs a set of differential data grid generation methods to simplify and decouple the differential data generation by the differential data processing center and the data broadcasting work of the data broadcasting service module. The differential data processing center generates differential data in units of grids according to the coverage range and networking conditions of the reference station, that is, a reference station is virtualized at the center of each grid. When the terminal uploads GGA data, the system extracts valid longitude and latitude from the GGA data, matches the longitude and latitude to the corresponding coverage grid, and subscribes to the data of the corresponding grid according to the grid ID. The specific steps are as follows:
[0061] 1. With the length and width of 3 minutes (i.e. 0.05 degrees) as the grid side length, the global longitude range [-180,180] is divided into 7200 grids according to 0.05 degrees, numbered from 0 to 7199 from small to large; the latitude range [-90,90] is divided into 3600 grids according to 0.05 degrees, numbered from 0 to 3599 from small to large, and projected onto the Cartesian coordinates, that is, the X direction is numbered from 0 to 7199, and the Y direction is numbered from 0 to 3500.
[0062] 2. Set the reference coordinate position of the virtual reference station at the intersection of the grid, and use the numbers in the XY direction of the position to generate a 32-bit unsigned integer as the grid ID of the grid. The grid ID generation rule is: the 0th to 12th bits of the 32-bit unsigned integer are used to place the grid number in the X direction, the 13th to 24th bits are used to place the grid number in the Y direction, and the 25th to 31st bits are reserved and filled with 0 by default. The ID generation rule is shown in Table 1 below:
[0063] Table 1 is the grid numbering rules
[0064] 3125 2413 120 reserve Y-direction grid number Grid number in X direction
[0065] 3. The data processing center generates a coverage network of an effective service grid based on the coverage range and networking conditions of the original base station. The coverage network generates a vector diagram and superimposes it on the map to display the service coverage range to users in real time. The service grid coverage of a specified location can be queried based on provinces, cities, districts, counties, or longitude and latitude.
[0066] 4. When the terminal is successfully connected to the system, it will continue to report GGA data at a certain frequency. The system extracts valid longitude and latitude from the GGA data and converts them into grid IDs. If the current grid ID of the terminal is empty or the grid ID has changed, it is necessary to subscribe to the differential data of the corresponding grid through the differential data subscription service module according to the grid ID.
[0067] 5. The differential data subscription service module subscribes to the differential data of the grid from the data processing center and monitors the grid differential data message queue. If the grid differential data message queue does not receive the differential data of the grid within the specified time, such as within 20 seconds, the grid data abnormality alarm is triggered. If the specified grid does not have any subscribed terminals, the grid subscription is automatically canceled after a specified countdown time, such as 10 seconds. The automatic cancellation of subscription mechanism is to prevent invalid subscriptions and save system resources in the event of abnormal exit of the terminal or terminal access service.
[0068] 6. When the session processor of the terminal access service receives the differential data, it will determine whether the grid ID to which the differential data belongs is consistent with the currently subscribed grid ID before sending the differential data to the terminal. If they are consistent, it will be sent normally. Otherwise, it will trigger the terminal to send an abnormal grid ID alarm and discard the differential data.
[0069] Embodiment three:
[0070] Figure 2 The present invention is a structural diagram of a high-stability and high-performance broadcasting device for differential data, including a connection processor, an authentication processor, a session processor and an authentication service module, and a database, which are sequentially connected to a service access module.
[0071] The data broadcasting method provided by the present invention establishes three groups of task queues and thread pools to process client connection, user authentication and data broadcasting respectively. Among them, the first group of task queues and thread pools included in the connection processor act as the first-level buffer of the system, which can play the role of buffer when a large number of client connections are connected instantly. Even if a network DoS (Denial of service) attack is encountered, the program abnormality or server downtime will not be caused by exhausting system resources. Similarly, the second set of task queues and thread pools established for the authentication processor for user authentication can effectively isolate slow operations from real-time operations such as differential data processing and sending, without affecting business and achieving the goal of more stable and efficient system operation. Because the user receiver generally takes more than 30 seconds to lock the satellite during a cold start, and more than 10 seconds to re-lock the satellite during a hot start, the user receiver (including field workers) is not sensitive to the waiting time of the user authentication operation. On the contrary, the product requirement for data broadcast delay is generally not less than 2-3 seconds. Taking into account the actual time it takes for the differential data to arrive at the user receiver, in an ideal state, the time difference between the system receiving the differential data and successfully sending it, that is, the broadcast delay is controlled within 500 milliseconds. The session processor contains the third group of task queues and thread pools. In the third group of thread pools, there is no task list, only a connection hash table containing online client connections. The threads in the thread pool no longer perform data processing and data reception and transmission in a stateless manner as public resources. Instead, the threads are directly bound to the client connections. The reception, processing and transmission of any client data are always performed by the same thread in a first-in-first-out (FIFO) order. There is no need to add a mutex lock to ensure the order of data reception and transmission, and there is no thread switching cost.
[0072] In actual applications, the system will closely monitor the broadcast delay and use the rule engine to configure the delay timeout alarm rules. For example, if the delay exceeds 500 milliseconds for five consecutive times, the system will generate an alarm or automatically reduce the service online connection data.
[0073] As part of system optimization, the queue size and number of thread pools in the connection processor and authentication processor, the number of online sessions and the number of threads in the thread pool of the session processor will be initialized in the form of a configuration file when the program starts, and can be viewed and dynamically adjusted at any time during actual operation. The steps are as follows:
[0074] (1) When the program is initialized, it reads the connection processor configuration parameters, including the number of core threads, the maximum number of threads, the thread holding time, the task queue capacity, the rejection policy, etc.; it reads the authentication processor configuration parameters, including the number of core threads, the maximum number of threads, the thread holding time, the task queue capacity, the rejection policy; it reads the session processor configuration parameters, including the number of core threads, the maximum number of threads, the thread holding time, the maximum number of online connections, etc.
[0075] (2) Publishing connection handler configuration parameters, session handler configuration parameters, and authentication handler configuration parameters as JMX (Java Management Extensions) endpoints.
[0076] (3) Publish multiple metrics such as memory, processor, TCP requests, etc. as JMX endpoints.
[0077] (4) By publishing memory snapshots (Heap Dump), thread snapshots (Thread Dump), and TCP connection snapshots (TCP Dump) as JMX endpoints, you can query the memory, thread, and TCP connection status in real time to troubleshoot potential memory leaks, thread execution time, and online client status.
[0078] (5) System operation and maintenance personnel can use the JMX client to view the system execution status and adjust various parameters in real time.
[0079] Embodiment 4:
[0080] Figure 3This is a flow chart of a kernel memory application and use method based on zero-copy technology of the present invention. This patent applies zero-copy technology in the process of differential data broadcasting. Zero-copy technology is a hardware-level optimization. Data broadcasting involves two data copying mechanisms: CPU copy and DMA copy. CPU copy is the data copying that is responsible for the CPU, which will consume CPU time slices; DMA copy is the data copying that is responsible for the DMA (Direct Memory Access) controller. When the CPU interacts with external hardware such as disks and network cards, due to the speed limit of the hardware, the CPU will send a data copy command to the DMA controller on the motherboard, and the DMA controller will complete the data copying. DMA copy does not require the participation of the CPU. Zero-copy technology does not mean that copying is not required, but it saves the data copying from the user buffer to the kernel buffer that requires the participation of the CPU. The specific steps are as follows:
[0081] 1. When the program is initialized, it applies to the operating system kernel for direct memory of a specified size. The operating system kernel allocates memory for the system from the kernel buffer. Since the direct memory allocation and recovery cost is high, but the read and write performance is good, in order to prevent performance loss caused by frequent application and release of direct memory, the applied direct memory will be pooled.
[0082] 2. The session processor obtains the differential data and applies for direct memory from the pooled direct memory. If the direct memory in the pool is insufficient, a large block of direct memory is re-applied to the operating system kernel. If the direct memory application fails, a system alarm is triggered and the data is stopped from being sent. Otherwise, the differential data is written to the applied direct memory. The differential data placed in the direct memory uses reference counting technology and reference counting is turned on.
[0083] 3. After the differential data is successfully written into the direct memory, the session processor queries the client session connection list that subscribes to the differential data, traverses the client session connection list, and the bound session processing thread copies the content in the direct memory to the Socket buffer area of the client session connection.
[0084] 4. Before the session processing thread starts sending, it adds 1 to the data reference count. When the data is copied from the direct memory to the Socket buffer area (Finally, the copy is called completed whether it succeeds or fails), the reference count of the differential data in the direct memory is reduced by 1. When the reference count is 0, the session processing thread that last operated the data is responsible for releasing the direct memory requested above, and the direct memory is put back into the pooled direct memory area.
[0085] 5. The DMA controller is responsible for sending the data in the Socket buffer to the network card.
[0086] like Figure 4 The figure shows the overall architecture diagram of a virtual reference station high-stability and high-performance differential data broadcasting system of the present invention. The overall architecture diagram of the system is described as follows:
[0087] Multiple reference stations push the solved raw differential data to the data processing and control center.
[0088] The data processing control center is responsible for collecting differential data, preprocessing, filtering and other related processing on the differential data, and then sending the data to the data computing storage service through the data service module.
[0089] The data computing storage service is responsible for collecting real-time differential data, performing data calculations such as error modeling and atmospheric delay correction on the data, and sending the original differential data and differential data after baseline solution to the big data storage engine. The message middleware kafka cluster of the big data storage engine is responsible for data collection, the data storage service is responsible for big data storage, and the data analysis service is responsible for data analysis and monitoring; the grid subscription module is responsible for filtering differential data by subscription and sending the subscribed differential data to the real-time message middleware.
[0090] Comprehensive positioning enhancement services include terminal access of customer receivers, terminal authentication, product or mounting point query, differential data subscription, differential data transmission and other functions. System monitoring and statistical processing services will monitor the delay of differential data transmission, abnormal terminal login, terminal login, data broadcasting, GGA data reception and other statistics.
[0091] Service coordination cluster management uses Docker container technology to package services into independently running containers, and uses Kubernetes to manage service containers distributed on multiple servers or cloud hosts, providing functions such as automated service deployment, application container management, multi-instance load balancing, service health detection and automatic startup.
[0092] The monitoring and management platform is responsible for managing account authentication and management, anti-attack settings such as whitelist / blacklist access, setting security keys, etc., monitoring service operation status, checking and setting alarm functions such as grid delay alarm and terminal abnormal access alarm, data format conversion such as RTCM 10403.3 and RINEX (Receiver Independent Exchange Format, receiver-independent exchange format), and metering data usage.
[0093] All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0094] The method disclosed in the above embodiment of the present invention can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an ASIC, a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0095] On the one hand, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed, the functions performed by the various modules in the above embodiments are implemented.
[0096] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present invention is executed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user device or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instruction can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD).
[0097] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0098] Although the present invention has been described in conjunction with specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present invention. Accordingly, this specification and the accompanying drawings are merely exemplary illustrations of the present invention as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present invention. Obviously, those skilled in the art may make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, the present invention is intended to include such modifications and variations if they fall within the scope of the claims of the present invention and their equivalents.
Claims
1. A virtual reference station high-stability and high-performance differential data broadcasting method, characterized in that: The steps include: The S1 differential data broadcasting platform monitors the network port, puts the client into the connection queue, and hands the client connection to the authentication processor when the client connection is ready; The authentication processing thread in the S2 authentication processor obtains tasks from the authentication queue, parses the client connection information, and passes the parsed information to the authentication service module. The authentication service module passes the authenticated client connection to the session processor; The S3 session processor determines the state of the session connection hash table, binds a fixed thread to the session connection of the client with a successful handshake, and then puts the session connection into the session connection hash table; The S4 session processor subscribes to the network differential data message queue from the message middleware, obtains the subscribed client session connection, and hands it over to the differential data broadcast thread corresponding to the client for broadcasting; Wherein, the S1 includes that the client sends NTRIP protocol connection information, the authentication processor determines the status of the authentication queue, if the authentication queue is full, the authentication processor writes a status code to the client connection to indicate that the server is full, and closes the connection, the upper layer LVS load balancer connects the new client to other terminal access services in the cluster environment, otherwise the client NTRIP connection information is placed in the authentication queue, if the client connection does not send NTRIP connection information within the specified time, the authentication processor will directly close the client connection; S3 specifically includes: the session processor uses a sequential loop to bind a fixed thread to the session connection from the session processing thread pool, and then puts the session connection into the session connection hash table. The thread processes data transmission and reception of the session connection throughout its entire life cycle. One session processing thread is responsible for processing multiple client session connections, but there is no thread switching, so that data transmission and reception processing is freed from thread safety and lock synchronization. The S4 specifically includes: the session processor subscribes to the grid differential data message queue from the message middleware. When the session processor receives the grid differential data, it puts the grid differential data into the direct memory in a zero-copy manner. The session processor obtains the subscribed client session connection from the hash table, hands it to the differential data broadcast thread corresponding to the client and sends it to the client connection; the grid differential data is generated by the differential data processing center in units of grids according to the coverage range of the reference station and the networking situation, that is, a reference station is virtualized at the center of each grid. When the terminal uploads the global positioning system fixed data GGA data, the system extracts the valid longitude and latitude from the GGA data, matches the longitude and latitude to the corresponding coverage grid, and subscribes to the data of the corresponding grid according to the grid ID; The zero-copy method includes: the session processor obtains the differential data, applies for direct memory from the pooled direct memory, and if the direct memory in the pool is insufficient, re-applies for a large block of direct memory from the operating system kernel. If the direct memory application fails, a system alarm is triggered and the data is terminated. Otherwise, the differential data is written to the applied direct memory. The differential data placed in the direct memory uses reference counting technology to turn on reference counting.
2. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 1, characterized in that: S1 specifically includes: The differential data broadcasting platform listens to the specified network port. When the client connects to the differential broadcasting platform, the connection processor is notified through the event mechanism. The connection processor determines the status of the connection queue. If the connection queue is full, a status code is written to the client connection to indicate that the service is full and the connection is closed; otherwise, the client connection is placed in the connection queue, and the connection processing threads in the connection processing thread pool obtain tasks from the connection queue in turn and process the connection status.
3. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 2, characterized in that: S2 specifically includes: The authentication processing thread parses the NTRIP client connection information, and parses out the username, password and mount point information from it. If the mount point is empty, it obtains the mount point list from the mount point service module, writes the status code and the mount point list content to the client connection, indicating that the mount point list is successfully obtained, and closes the client connection; otherwise, the username, password and mount point information are handed over to the terminal authentication service module for processing.
4. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 1, characterized in that: When the client receives the 200 status code from the server, it periodically sends a data message of the global positioning system fixed data GGA to indicate its own location. The session processor parses the longitude and latitude information from the GGA data, calculates the grid of the virtual reference station network based on the longitude and latitude information, and subscribes to the grid differential data through the message middleware.
5. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 1, characterized in that: When the client uploads GGA data, the session processor extracts the valid longitude and latitude from the GGA data, matches the longitude and latitude to the corresponding coverage grid, and subscribes to the data of the corresponding grid according to the grid ID. The differential data subscription service module subscribes to the differential data of the grid from the data processing center and monitors the grid differential data message queue.
6. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 1, characterized in that: The queue size and number of thread pools in the connection processor and authentication processor, the number of online sessions in the session processor and the number of threads in the thread pool are initialized in the form of a configuration file when the program starts. The initialization configuration specifically includes: (1) When the program is initialized, it reads the connection processor configuration parameters, the authentication processor configuration parameters, and the session processor configuration parameters; (2) Publishing connection handler configuration parameters, authentication handler configuration parameters, and session handler configuration parameters as JMX endpoints; (3) Publish multiple metrics such as memory, processor, and TCP requests as JMX endpoints; (4) Publish memory snapshots, thread snapshots, and TCP connection snapshots as JMX endpoints to query memory, thread, and TCP connection status in real time, and check for potential memory leaks, thread execution time, and online client status; (5) System operation and maintenance personnel use the JMX client to view the system execution status and adjust various parameters in real time.
7. The method for broadcasting virtual reference station differential data with high stability and high performance according to claim 1, characterized in that: The zero copy method specifically includes: (1) When the program is initialized, it requests a specified size of direct memory from the operating system kernel. The operating system kernel allocates memory for the system from the kernel buffer and pools the direct memory. (2) The session processor obtains the differential data and applies for direct memory from the pooled direct memory. If the direct memory application fails, a system alarm is triggered and the differential data is terminated. Otherwise, the differential data is written to the applied direct memory and reference counting is enabled. (3) After the differential data is successfully written into the direct memory, the session processor queries the client session connection list that subscribes to the differential data, traverses the client session connection list, and the bound session processing thread copies the content in the direct memory to the socket buffer area of the client session connection; (4) Before the session processing thread starts sending, it increases the reference count by 1. When the data is copied from the direct memory to the socket buffer area, the reference count of the differential data in the direct memory is reduced by 1. When the reference count is 0, the session processing thread that last operated the data is responsible for releasing the applied direct memory, and the direct memory is put back into the pooled direct memory area; (5) The DMA controller is responsible for sending the data in the Socket buffer to the network card.
Citation Information
Patent Citations
Petrochemical field precise spatio-temporal information processing and service system based on Beidou
CN115767430A