A method, device and equipment for pushing playback data of spatio-temporal data of maritime targets
By using multi-threading to query the cluster spatiotemporal database in time segments on the server side, the problem of stuttering playback of spatiotemporal data at sea targets is solved, high-speed and smooth data playback are achieved, and query efficiency and IO utilization are improved.
Patent Information
- Application Number
- CN202411212900.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-08-30
AI Technical Summary
The spatiotemporal data at sea targets have problems such as insufficient speed and stuttering when playing at double speed. It is difficult for the existing technology to achieve high speed and smooth data replay.
By using multithreading to query the cluster spatiotemporal database in time segments on the server side, the forward and inverse playback of the target playback data can be achieved. The specific steps include receiving the client's query request, creating the main thread for segmentation processing, obtaining the child thread querying data from the database, and pushing the data to the client through the daemon thread.
It quickly querys the historical data of the target, improves query efficiency, supports higher speed playback and reverse order playback, reduces the lag problem of the hyperspeed playback of maritime target monitoring data, and improves the utilization efficiency of query IO.
Smart Images

Figure CN119232790B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer information processing, and particularly to a method, device and equipment for pushing playback data of spatio-temporal data of maritime targets. Background Art
[0002] In the increasingly busy activities of maritime targets, spatio-temporal data of maritime targets need to be collected through various monitoring devices such as radars, Automatic Identification Systems (AIS) of ships, and Beidou. However, in the application process, it is usually necessary to replay historical events to analyze the purpose of target activities and to analyze a certain suspicious target within a certain time range. For unimportant time periods, fast playback is required to improve the efficiency of analyzing the activities of suspicious targets. Currently, there are problems with insufficient playback speed and playback jitter in the speeded-up playback function. Therefore, when replaying spatio-temporal data of maritime targets, high-speed and smooth playback needs to be achieved.
[0003] Most current technical solutions mostly store historical targets in the form of stored snapshots. The snapshot data is divided by province, with a frequency of one snapshot per 10 seconds, and is stored in an ES (Elastic Search, a background distributed storage and full-text retrieval) storage in chronological order. ES is a database with efficient query capabilities. However, when the data volume of a single province is large, data processing will be insufficient, there will be a bottleneck in query I / O during speeded-up playback. At the same time, since operations such as parsing and filtering of snapshots are required after querying the data, and finally the result data is sent to the WEB side for rendering, during speeded-up playback, the input / output pressure of the server data increases, and the phenomenon that the data query speed cannot meet the speeded-up playback and jitter occurs. Summary of the Invention
[0004] The present invention provides a method, device and equipment for pushing playback data of spatio-temporal data of maritime targets, which solves the problem that the speeded-up playback of maritime target monitoring data cannot be achieved or there is jitter during speeded-up playback.
[0005] To solve the above technical problems, the technical solution of the present invention is as follows:
[0006] An embodiment of the present invention provides a method for pushing playback data of spatio-temporal data of maritime targets, which is applied to a server. The method includes:
[0007] Receiving a query request for target playback data of spatio-temporal data of maritime targets sent by a client, where the query request carries query condition data;
[0008] Creating a first thread according to the query request data;
[0009] The first thread processes the target playback data in segments according to the query condition data to obtain query information of at least one segmented target playback data;
[0010] Obtain at least one second thread from the thread pool;
[0011] The at least one second thread obtains at least one segmented target playback data from the database according to the query information of the at least one segmented target playback data;
[0012] A third thread pushes the at least one segmented target playback data to the client.
[0013] Optionally, the first thread processes the target playback data in segments according to the query condition data to obtain query information of at least one segmented target playback data, including:
[0014] When the query condition data is that the target playback data needs to be played in chronological order in the forward direction, the first thread processes the target playback data in segments to obtain first query information of at least one segmented target playback data;
[0015] When the query condition data is that the target playback data needs to be played in chronological order in the reverse direction, the first thread processes the target playback data in segments to obtain second query information of at least one segmented target playback data.
[0016] Optionally, when the query condition data is that the target playback data needs to be played in chronological order in the forward direction, the first thread processes the target playback data in segments to obtain first query information of at least one segmented target playback data, including:
[0017] The first thread obtains the playback speed multiple n and the maximum period k of the target playback data;
[0018] When n < k, the target playback data is divided into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is (t e - t s ) / (n - 1), where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0019] When n > k, the target playback data is divided into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e - t s) / (n - 1) - k;
[0020] Query each segmented target playback data to obtain first query information of at least one segmented target playback data.
[0021] Optionally, when the query condition data is that the target playback data needs to be played in reverse chronological order, through the first thread, segment the target playback data to obtain second query information of at least one segmented target playback data, including:
[0022] Obtain the playback speed n and the maximum period k of the target playback data through the first thread;
[0023] When n < k, divide the target playback data into n - 1 segments with the end time as the starting point and the start time as the ending point, and the duration of each segmented target playback data is (t e -t s ) / (n - 1); where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0024] When n > k, divide the target playback data into n - 1 segments with the end time as the starting point and the start time as the ending point, and the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1) - k;
[0025] Query each segmented target playback data to obtain second query information of at least one segmented target playback data.
[0026] Optionally, push the at least one segmented target playback data to the client through a third thread, including:
[0027] Cache the at least one segmented target playback data to obtain buffered queue data;
[0028] Receive the sending frequency data sent by the client;
[0029] Compare the sending frequency data with a preset push frequency. When the sending frequency data is less than the preset push frequency, the third thread is in a sleep mode; when the sending frequency data is greater than or equal to the preset push frequency, the third thread sends the buffered queue data to the client.
[0030] An embodiment of the present invention further provides a method for receiving playback data of spatio-temporal data of a maritime target, which is applied to a client, and the method includes:
[0031] Send a query request for the target playback data of the maritime target spatio-temporal data to the server, where the query request carries query condition data;
[0032] Receive at least one segmented target playback data sent by the server through a third thread; the at least one segmented target playback data is that the server creates a first thread according to the query request, and through the first thread, according to the query condition data, segments the target playback data to obtain query information of at least one segmented target playback data, and obtains at least one second thread from the thread pool; through the at least one second thread, according to the query information of the at least one segmented target playback data, at least one segmented target playback data is obtained from the database.
[0033] Optionally, the method for receiving the playback data of the maritime target spatio-temporal data further includes:
[0034] Display the at least one segmented target playback data on the display interface of the client.
[0035] An embodiment of the present invention further provides a device for pushing the playback data of the maritime target spatio-temporal data, which is applied to a server, and the device includes:
[0036] A first transceiver module, configured to receive a query request for the target playback data of the maritime target spatio-temporal data sent by a client, where the query request carries query condition data;
[0037] A generation module, configured to create a first thread according to the query request data;
[0038] A processing module, configured to segment the target playback data according to the query condition data through the first thread to obtain query information of at least one segmented target playback data;
[0039] A first obtaining module, configured to obtain at least one second thread from the thread pool;
[0040] A second obtaining module, configured to obtain at least one segmented target playback data from the database through the at least one second thread according to the query information of the at least one segmented target playback data;
[0041] The first transceiver module is further configured to push the at least one segmented target playback data to the client through a third thread.
[0042] An embodiment of the present invention further provides a device for receiving the playback data of the maritime target spatio-temporal data, which is applied to a client, and the device includes:
[0043] A second transceiver module, configured to send a query request for target playback data of maritime target spatio-temporal data to a server, where the query request carries query condition data;
[0044] The second transceiver module is further configured to receive at least one segmented target playback data sent by the server through a third thread; the at least one segmented target playback data is that the server creates a first thread according to the query request, and through the first thread, according to the query condition data, segments the target playback data to obtain query information of at least one segmented target playback data, and obtains at least one second thread from a thread pool; through the at least one second thread, according to the query information of the at least one segmented target playback data, obtains at least one segmented target playback data from a database;
[0045] A display module, configured to display the at least one segmented target playback data on a display interface of the client.
[0046] An embodiment of the present invention further provides a computing device, including: a processor and a memory storing a computer program, where when the computer program is run by the processor, it executes the above method.
[0047] The technical solution of the present invention at least includes the following effects:
[0048] The above solution of the present invention receives a query request for target playback data of maritime target spatio-temporal data sent by a client, where the query request carries query condition data; creates a first thread according to the query request data; through the first thread, according to the query condition data, segments the target playback data to obtain query information of at least one segmented target playback data; obtains at least one second thread from a thread pool; through the at least one second thread, according to the query information of the at least one segmented target playback data, obtains at least one segmented target playback data from a database; pushes the at least one segmented target playback data to the client through a third thread; by using multi-threads to perform time-segmented query on a cluster spatio-temporal database in both forward and reverse directions, realizes the forward and reverse playback of data, can quickly query the historical data of the target, improves the query efficiency, supports higher-speed playback and reverse playback, reduces the jamming problem of the maritime target monitoring data during high-speed playback, and through time segmentation, improves the utilization efficiency of query I / O and reduces the risk of sudden concentration and increase of I / O. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flowchart of a method for pushing playback data of maritime target spatio-temporal data provided by an embodiment of the present invention;
[0050] Figure 2It is a schematic diagram of segmenting target playback data in ascending order of time when the playback multiple is less than the data period provided by an embodiment of the present invention;
[0051] Figure 3 It is a schematic diagram of segmenting target playback data in ascending order of time when the playback multiple is greater than the data period provided by an embodiment of the present invention;
[0052] Figure 4 It is a schematic diagram of segmenting target playback data in descending order of time when the playback multiple is less than the data period provided by an embodiment of the present invention;
[0053] Figure 5 It is a schematic diagram of segmenting target playback data in descending order of time when the playback multiple is greater than the data period provided by an embodiment of the present invention;
[0054] Figure 6 It is a schematic diagram of playback push frequency control in the method for pushing playback data of spatio-temporal data of maritime targets provided by an embodiment of the present invention;
[0055] Figure 7 It is the overall flowchart of target data playback in the method for pushing playback data of spatio-temporal data of maritime targets provided by an embodiment of the present invention;
[0056] Figure 8 It is the structural diagram of the device for pushing playback data of spatio-temporal data of maritime targets applied to a server provided by an embodiment of the present invention;
[0057] Figure 9 It is the structural diagram of the device for receiving playback data of spatio-temporal data of maritime targets applied to a client provided by an embodiment of the present invention;
[0058] Figure 10 It is the structural schematic diagram of the computing device provided by an embodiment of the present invention;
[0059] Wherein, 1. Time axis direction; 2. Program running timing sequence. Detailed implementation manners
[0060] Hereinafter, exemplary embodiments of the present invention will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present invention can be more thoroughly understood and the scope of the present invention can be completely conveyed to those skilled in the art.
[0061] As Figure 1 shown, an embodiment of the present invention proposes a method for pushing playback data of spatio-temporal data of maritime targets, which is applied to a server, and the method includes:
[0062] Step 11, receive a query request for target playback data of maritime target spatio-temporal data sent by a client, where the query request carries query condition data;
[0063] Step 12, create a first thread according to the query request data;
[0064] Step 13, through the first thread, segment the target playback data according to the query condition data to obtain query information of at least one segmented target playback data;
[0065] Step 14, obtain at least one second thread from a thread pool;
[0066] Step 15, through the at least one second thread, obtain at least one segmented target playback data from a database according to the query information of the at least one segmented target playback data;
[0067] Step 16, push the at least one segmented target playback data to the client through a third thread.
[0068] In this instance, the server first receives a query request from the client; this request is specific to the playback data of maritime target spatio-temporal data, including queries for information such as the historical positions, speeds, headings, etc. of the targets; the query request usually carries some query condition data, such as a time range (start time and end time), a geographical location range (longitude and latitude boundaries), a target identifier (such as a ship name, number, etc.), etc., for defining the specific content and scope of the query;
[0069] After receiving the query request, the server creates a main thread, i.e., the first thread, according to this request data; the purpose of creating the first thread is to process the query task in parallel, avoiding blocking the main thread due to long-term database queries or data processing, thereby maintaining the responsiveness and efficiency of the system;
[0070] In the first thread, the server performs segmented processing on the target playback data according to the query condition data, including dividing a large amount of spatio-temporal data according to time, space, or other logics for parallel processing and querying; segmented processing can effectively reduce the pressure on the database for a single query operation and improve the query efficiency; the result of the processing will be the query information of at least one segmented target playback data, and this information contains the specific parameters required for querying each segmented data; to improve the concurrent processing ability and resource utilization rate, the server usually maintains a thread pool, and the server can obtain one or more sub-threads, that is, the second thread, from the thread pool to execute the next data query task; the advantage of the thread pool is that it can reuse the created threads, reducing the overhead of thread creation and destruction, and at the same time can better control the number of threads running simultaneously in the server to avoid excessive resource consumption; each second thread will independently query and obtain the corresponding data from the database according to the query information of the segmented target playback data received from the first thread; this parallel query method can significantly reduce the total query time, especially when processing a large amount of data, each thread will only process its own assigned data segment, and after completion, it will return the result to the main thread or store it in the shared memory waiting for subsequent processing; to further optimize data transmission and processing, the server may create a daemon thread, that is, the third thread, to be responsible for pushing the queried data to the client; this can separate the data acquisition and transmission processes to ensure that even during large-scale data transmission, it will not affect the performance of database queries or other processing tasks. The third thread will assemble and send the collected segmented target playback data to the client according to an appropriate protocol and format, completing the entire query and data transmission process.
[0071] The above technical solution of the present invention realizes the forward and reverse playback of data by using multi-threads to perform time-segmented queries on the cluster spatio-temporal database in the forward and reverse directions, can quickly query the historical data of the target, improves the query efficiency, supports higher-speed playback and reverse playback, and through the time segmentation, improves the utilization efficiency of query I / O and reduces the risk of sudden concentration and increase of I / O.
[0072] In an optional embodiment proposed by the embodiment of the present invention, step 13 may include:
[0073] Step 131, when the query condition data is that the target playback data needs to be played forward in chronological order, through the first thread, perform segmented processing on the target playback data to obtain the first query information of at least one segmented target playback data;
[0074] Step 132, when the query condition data is target playback data that needs to be played in reverse chronological order, through the first thread, segment the target playback data to obtain second query information of at least one segmented target playback data.
[0075] In this example, the server first parses the query condition data to determine that the user hopes to play the target playback data in forward chronological order; based on this requirement, the server will segment the target playback data through the first thread to obtain first query information of at least one segmented target playback data; when it is determined that the user hopes to play the target playback data in reverse chronological order, the server will segment the target playback data through the first thread to obtain second query information of at least one segmented target playback data.
[0076] Such as Figure 2 and Figure 3 As shown, in an alternative embodiment proposed by the embodiment of the present invention, step 131 may include:
[0077] Step 1311, obtain the playback speed multiple n and the maximum period k of the target playback data through the first thread;
[0078] Step 1312, when n < k, divide the target playback data into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is (t e -t s ) / (n - 1), where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0079] Step 1313, when n > k, divide the target playback data into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1) - k;
[0080] Step 1314, query each segmented target playback data to obtain first query information of at least one segmented target playback data.
[0081] In this example, the server first determines the playback speed multiple n when playing the target playback data desired by the user and the maximum period k of the target playback data. The maximum period k can be understood as the maximum time for multiple groups of radar to scan one week, and n = 1 is the normal speed;
[0082] When n < k, at the first query, the start time t 0 = t s-k, the duration of the data for a complete cycle to be queried for the first time is k, where t 0 is the query start time, and t s is the start time of the target playback data and also the query end time; the target playback data is segmented from t s to t e , where t e is the end time of the target playback data; the segmentation process specifically includes: the start time of time segment 2 is t s and the end time is t 2 ; the start time of time segment 3 is t 2 and the end time is t 3 ...; the start time of time segment n is t n-1 and the end time is t e ; the duration of the target playback data for each segment is (t e -t s ) / (n - 1). Use a loop logic to query the segmented time, simultaneously query radar target data, AIS target data, and Beidou target data through multiple threads, and then merge them and put them into the buffer queue to continue executing the loop for the next time segment, ensuring that the time sequence in the buffer queue is in ascending order;
[0083] When n > k, at the first query, the start time t 0 = t s - k. Since the duration of the data for a complete cycle to be queried for the first time is k, the query start time is t 0 , and the end time is t s ; segment from t s to t e ; the segmentation process specifically includes: the start time of time segment 2 is t' 2 - k, and the end time is t' 2 ; the start time of time segment 3 is t' 3 - k, and the end time is t' 3 ...; the start time of segment time n is t e - k, and the end time is t e ; where the duration of the target playback data for each segment is k, and the time interval between adjacent segments of the target playback data is (t e - t s ) / (n - 1)- k; use a loop logic to query the segmented time, simultaneously query radar target data, AIS target data, and Beidou target data through multiple threads, and then merge them and put them into the buffer queue to continue executing the loop for the next time segment, ensuring that the time sequence in the buffer queue is in ascending order; query each segment of the target playback data to obtain the first query information of at least one segment of the target playback data.
[0084] As Figure 4 and Figure 5 shown, in an alternative embodiment of the present invention, step 132 may include:
[0085] Step 1321, obtaining the playback speed multiple n and the maximum period k of the target playback data through the first thread;
[0086] Step 1322, when n < k, dividing the target playback data into n - 1 segments with the end time as the starting point and the start time as the ending point, and the duration of each segmented target playback data is (t e -t s ) / (n - 1); where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0087] Step 1323, when n > k, dividing the target playback data into n - 1 segments with the end time as the starting point and the start time as the ending point, and the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1) - k;
[0088] Step 1324, querying each segmented target playback data to obtain second query information of at least one segmented target playback data.
[0089] In this example, the server first determines the playback multiple n when playing the target playback data desired by the user and the maximum period k of the target playback data;
[0090] When n < k, at the first query, the start time t 0 = t e + k, the duration of the data for one complete cycle to be queried for the first time is k, then the query start time is t e , and the end time is t 0 ; segment from t e to t s ; the specific segmentation process includes: the start time of time segment 2 is t 2 and the end time is t e ; the start time of time segment 3 is t 3 and the end time is t 2 ...; the start time of time segment n is t s and the end time is t n-1 ; where the duration of each segmented target playback data is (t e -t s) / (n - 1); Use loop logic to query segmented time. Query radar target data, AIS target data, and Beidou target data simultaneously through multi-threaded threads, then merge and put them into the buffer queue to continue executing the next time segment of the loop, ensuring the reverse order of time series in the buffer queue;
[0091] When n > k, at the first query, the start time t 0 = t s - k. The duration of the data for one complete cycle that needs to be queried for the first time is k, so the query start time is t e , and the end time is t 0 ; From t e to t s for segmentation; The specific segmentation process includes: The start time of time segment 2 is t' 2 + k, and the end time is t' 2 ; The start time of time segment 3 is t' 3 + k, and the end time is t' 3 ……; The start time of segmentation time n is t s , and the end time is t s + k; Among them, the duration of the playback data of each segmented target is k, and the time interval between the playback data of adjacent two segmented targets is (t e - t s ) / (n - 1)- k; Use loop logic to query segmented time. Query radar target data, AIS target data, and Beidou target data simultaneously through multi-threaded threads, then merge and put them into the buffer queue to continue executing the next time segment of the loop, ensuring the reverse order of time series in the buffer queue; Query the playback data of each segmented target to obtain the second query information of at least one segmented target playback data.
[0092] As Figure 6 and Figure 7 shown, in an optional embodiment proposed by the embodiment of the present invention, step 16 may include:
[0093] Step 161, cache the at least one segmented target playback data to obtain buffer queue data;
[0094] Step 162, receive the sending frequency data sent by the client;
[0095] Step 163, compare the sending frequency data with the preset push frequency. When the sending frequency data is less than the preset push frequency, the third thread is in the sleep mode; when the sending frequency data is greater than or equal to the preset push frequency, the third thread sends the buffer queue data to the client.
[0096] In this example, first, the queried data is filtered according to conditions to obtain the data stream that the user wants to see. Then, the filtered data is pushed into a buffer queue, which is a blocking queue. When the queue is full, the data acquisition module will pause data acquisition and release the query sub-thread, that is, the second thread. The daemon thread (i.e., the third thread) polls all connected clients an infinite number of times. One round of polling for all clients is a cycle. When no client is connected to the service, it is necessary to control the polling frequency to avoid idling and consuming resources. By setting a push value with a maximum frequency of m (unit: milliseconds per time), when there is no data to be pushed, the daemon thread will sleep for m milliseconds every time it polls. Let the frequency of the daemon thread to push one cycle be i (unit: milliseconds per time). If i < m, the daemon thread will enter the sleep stage, and the sleep time is set to m - i milliseconds. According to the maximum sending frequency value i n (unit: milliseconds per time) given by the client to perform frequency push for a single connection. For example, if the current push timestamp is t 1 , then the next push time is calculated as: t next = t 1 + i n ; The time for the next push is t 2 , if t 2 < t next , then it will not be pushed to the client. If t 2 ≥ t next , then it will be pushed to the client.
[0097] In the above embodiments of the present invention, by using multi-threading on the server side to query the cluster spatio-temporal database in the forward and reverse directions according to time segments, the forward and reverse playback of data is realized, the historical data of the target can be quickly queried, the query efficiency is improved, higher-speed playback and reverse playback are supported, and through time segmentation, the utilization efficiency of query I / O is improved, the risk brought by sudden centralized increase of I / O is reduced. After pushing the playback data to the client, the client can support higher-speed playback and reverse playback, and the problem of stuttering in the speeded-up playback of maritime target monitoring data is reduced.
[0098] An embodiment of the present invention proposes a method for receiving playback data of maritime target spatio-temporal data, which is applied to a client. The method includes:
[0099] Step 21, sending a query request for target playback data of maritime target spatio-temporal data to the server side, and the query request carries query condition data;
[0100] Step 22: Receive at least one segmented target playback data sent by the server through a third thread; the at least one segmented target playback data is obtained by the server according to the query request, creating a first thread, segmenting the target playback data according to the query condition data through the first thread to obtain query information of at least one segmented target playback data, and obtaining at least one second thread from a thread pool; and obtaining at least one segmented target playback data from a database through the at least one second thread according to the query information of the at least one segmented target playback data.
[0101] Further, the method for receiving playback data of maritime target spatio-temporal data further includes:
[0102] Step 23: Display the at least one segmented target playback data on a display interface of the client.
[0103] In this example, the client first sends a query request to the server. The query request is for the playback data of the spatio-temporal data of maritime targets, including queries for information such as the historical positions, speeds, and headings of the targets. The query request usually carries some query condition data, such as time range (start time and end time), geographical location range (longitude and latitude boundaries), target identifiers (such as ship names, numbers, etc.), etc., which are used to define the specific content and scope of the query. After receiving the query request, the server creates a main thread, that is, the first thread, based on these request data. The purpose of creating the first thread is to process the query tasks in parallel, avoiding blocking the main thread due to long database queries or data processing, thereby maintaining the responsiveness and efficiency of the system. In the first thread, the server performs segmented processing on the target playback data according to the query condition data, including dividing a large amount of spatio-temporal data according to time, space, or other logics for parallel processing and query. Segmented processing can effectively reduce the pressure on the database for a single query operation and improve the query efficiency. The result of the processing will be the query information of at least one segmented target playback data, which contains the specific parameters required for querying each segmented data. To improve the concurrent processing ability and resource utilization rate, the server usually maintains a thread pool. The server can obtain one or more sub-threads, that is, the second threads, from the thread pool to execute the subsequent data query tasks. The advantage of the thread pool is that it can reuse the created threads, reducing the overhead of thread creation and destruction, and at the same time can better control the number of threads running simultaneously in the server to avoid excessive resource consumption. Each second thread independently queries and obtains the corresponding data from the database according to the query information of the segmented target playback data received from the first thread. This parallel query method can significantly reduce the total query time, especially when dealing with a large amount of data. Each thread only processes its allocated data segment and returns the result to the main thread or stores it in the shared memory for subsequent processing. To further optimize data transmission and processing, the server may create a daemon thread, that is, the third thread, to be responsible for pushing the queried data to the client. This can separate the data acquisition and transmission processes, ensuring that even during large-scale data transmission, it will not affect the performance of database queries or other processing tasks. The third thread will assemble and send the collected segmented target playback data to the client according to an appropriate protocol and format, completing the entire query and data transmission process, and finally displaying the at least one segmented target playback data on the display interface of the client.
[0104] As Figure 6 and Figure 7 shown, a specific embodiment of the playback data push of the spatio-temporal data of maritime targets provided by the embodiment of the present invention is:
[0105] Step 1: The server starts and creates a daemon thread for pushing playback data, receiving a query request for target playback data of maritime target spatio-temporal data sent by the client, where the query request carries query condition data.
[0106] Step 2: The client initiates a websocket connection. After the backend receives the connection signal, it creates a main thread (the first thread), and the main thread caches the query conditions.
[0107] Step 3: The main thread processes the time to be queried in segments and obtains sub-threads from the thread pool to concurrently query the StarRocks database; by calculation, the maximum of a complete data cycle is k seconds.
[0108] (1) When playing back in chronological order, the start time of playback passed by the client is t s , and the end time is t e , and the playback speed is n; when n = 1, it is the normal playback speed. When n < k, at the first query, the start time t 0 = t s - k, and the duration of the data for the first query to obtain a complete cycle is k. Among them, t 0 is the query start time, t s is the start time of the target playback data and also the query end time; the target playback data is segmented from t s to t e , where t e is the end time of the target playback data; the segmentation process specifically includes: the start time of time segment 2 is t s and the end time is t 2 ; the start time of time segment 3 is t 2 and the end time is t 3 ...; the start time of time segment n is t n-1 and the end time is t e ; the duration of the target playback data for each segment is (t e - t s ) / (n - 1). Use a loop logic to query the segmented time, simultaneously query radar target data, AIS target data, and Beidou target data through multiple threads, and then merge them and put them into the buffer queue to continue executing the next time segment of the loop, ensuring that the time sequence in the buffer queue is in chronological order; when n > k, at the first query, the start time t 0 = t s - k, and the duration of the data for the first query to obtain a complete cycle is k, then the query start time is t 0 , and the end time is t s ; from t s to t eSegmentation is performed; the specific segmentation process includes: the start time of time segment 2 is t' 2 -k, and the end time is t' 2 ; the start time of time segment 3 is t' 3 -k, and the end time is t' 3 ……; the start time of segmentation time n is t e -k, and the end time is t e ; where the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1)-k; use loop logic to query the segmentation time, simultaneously query radar target data, AIS target data, and Beidou target data through multi-threaded threads, and then merge and put them into the buffer queue to continue executing the next time segment of the loop, ensuring that the time sequence in the buffer queue is in ascending order;
[0109] (2) When playing back in reverse chronological order, the start time of playback passed by the client is t s , and the end time is t e , when n < k, at the first query, the start time t 0 =t e +k, the duration of the data for the first query to obtain a complete cycle is k, then the query start time is t e , and the end time is t 0 ; from t e to t s segmentation is performed; the specific segmentation process includes: the start time of time segment 2 is t 2 and the end time is t e ; the start time of time segment 3 is t 3 and the end time is t 2 ……; the start time of time segment n is t s and the end time is t n-1 ; where the duration of each segmented target playback data is (t e -t s ) / (n - 1); use loop logic to query the segmentation time, simultaneously query radar target data, AIS target data, and Beidou target data through multi-threaded threads, and then merge and put them into the buffer queue to continue executing the next time segment of the loop, ensuring that the time sequence in the buffer queue is in reverse order; when n > k, at the first query, the start time t 0 =t s -k, the duration of the data for the first query to obtain a complete cycle is k, then the query start time is t e , and the end time is t 0 ; from t e to t sSegment; the segmentation process specifically includes: the start time of time segment 2 is t' 2 +k, and the end time is t' 2 ; the start time of time segment 3 is t' 3 +k, and the end time is t' 3 ……; the start time of segmentation time n is t s , and the end time is t s +k; where the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1)-k; use loop logic to query the segmentation time, simultaneously query radar target data, AIS target data, and Beidou target data through multi-threaded threads, and then merge and put them into the buffer queue to continue executing the next time segment of the loop, ensuring the chronological reverse order in the buffer queue;
[0110] Step 4, obtain at least one second thread from the thread pool;
[0111] Step 5, through the at least one second thread, obtain at least one segmented target playback data from the database according to the query information of the at least one segmented target playback data;
[0112] Step 6, push the at least one segmented target playback data to the client through the third thread;
[0113] Perform conditional filtering on the queried data to obtain the data stream that the user wants to see; then push the filtered data into the buffer queue, and this buffer queue is a blocking queue. When the queue is full, the data acquisition module will pause data acquisition and release the query sub-thread, that is, the second thread; the daemon thread (i.e., the third thread) polls all connected clients an infinite number of times, and one round of polling for all clients is one cycle. When no client is connected to the service, it is necessary to control the polling frequency to avoid idling and consuming resources; by setting a maximum frequency of m (unit: milliseconds per time) for the push value, when there is no data to be pushed, then the daemon thread will sleep for m milliseconds every time it polls; let the frequency of the daemon thread pushing one cycle be i (unit: milliseconds per time), if i < m, then the daemon thread will enter the sleep stage, and the sleep time is set to m - i milliseconds; perform frequency push for a single connection according to the maximum send frequency value i n (unit: milliseconds per time), such as the current push timestamp is t 1 , then calculate the next push time as: t next =t 1 +i n ; the time for the next push is t 2 , if t 2 <tnext If not, it is not pushed to the client. If t 2 ≥t next If so, it is pushed to the client.
[0114] Step 7: The client terminates the websocket connection, releases all main threads and child threads, and terminates the push of playback data.
[0115] The above method proposed by the present invention realizes the forward and reverse playback of data by using multi-threads to query the cluster spatio-temporal database in both forward and reverse directions, can quickly query the historical data of the target, improves the query efficiency, supports higher-speed playback and reverse playback, and improves the utilization efficiency of query IO through time segmentation, reduces the risk of sudden concentration increase of IO. After pushing the playback data to the client, the client can support higher-speed playback and reverse playback, reducing the stuttering problem of the speeded-up playback of maritime target monitoring data.
[0116] As Figure 8 shown, the embodiment of the present invention also provides a playback data pushing device 80 for maritime target spatio-temporal data, which is applied to a server. The device 80 includes:
[0117] A first transceiver module 81, configured to receive a query request for target playback data of maritime target spatio-temporal data sent by a client, where the query request carries query condition data;
[0118] A generation module 82, configured to create a first thread according to the query request data;
[0119] A processing module 83, configured to perform segmentation processing on the target playback data according to the query condition data through the first thread to obtain query information of at least one segmented target playback data;
[0120] A first obtaining module 84, configured to obtain at least one second thread from a thread pool;
[0121] A second obtaining module 85 is further configured to obtain at least one segmented target playback data from a database according to the query information of the at least one segmented target playback data through the at least one second thread;
[0122] The first transceiver module 81 is further configured to push the at least one segmented target playback data to the client through a third thread.
[0123] Optionally, the processing module 83 is specifically configured to:
[0124] When the query condition data is the target playback data and needs to be played in chronological order, the first thread is used to segment the target playback data to obtain the first query information of at least one segmented target playback data;
[0125] When the query condition data is the target playback data and needs to be played in reverse chronological order, the first thread is used to segment the target playback data to obtain the second query information of at least one segmented target playback data.
[0126] Optionally, when the query condition data is the target playback data and needs to be played in chronological order, the first thread is used to segment the target playback data to obtain the first query information of at least one segmented target playback data, including:
[0127] The first thread is used to obtain the playback speed n and the maximum period k of the target playback data;
[0128] When n < k, the target playback data is divided into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is (t e -t s ) / (n - 1), where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0129] When n > k, the target playback data is divided into n - 1 segments with the start time as the starting point and the end time as the ending point, and the duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e -t s ) / (n - 1) - k;
[0130] Each segmented target playback data is queried to obtain the first query information of at least one segmented target playback data.
[0131] Optionally, when the query condition data is the target playback data and needs to be played in reverse chronological order, the first thread is used to segment the target playback data to obtain the second query information of at least one segmented target playback data, including:
[0132] The first thread is used to obtain the playback speed n and the maximum period k of the target playback data;
[0133] When n < k, the target playback data is divided into n - 1 segments with the end time as the starting point and the start time as the ending point, and the duration of each segmented target playback data is (t e -t s) / (n - 1); where t s is the start time of the target playback data, and t e is the end time of the target playback data;
[0134] When n > k, the target playback data is divided into n - 1 segments with the end time as the starting point and the start time as the ending point. The duration of each segmented target playback data is k, and the time interval between two adjacent segmented target playback data is (t e - t s ) / (n - 1) - k;
[0135] Query each segmented target playback data to obtain the second query information of at least one segmented target playback data.
[0136] Optionally, the first transceiver module 81 is specifically configured to:
[0137] Cache the at least one segmented target playback data to obtain buffered queue data;
[0138] Receive the sending frequency data sent by the client;
[0139] Compare the sending frequency data with a preset push frequency. When the sending frequency data is less than the preset push frequency, the third thread is in a sleep mode; when the sending frequency data is greater than or equal to the preset push frequency, the third thread sends the buffered queue data to the client.
[0140] It should be noted that this device corresponds to the method on the server side above. All implementation manners of the method on the server side above are applicable to the embodiments of this device and can achieve the same technical effects.
[0141] As Figure 9 shown, an embodiment of the present invention further provides a playback data receiving device 90 for maritime target spatio-temporal data, which is applied to a client. The device 90 includes:
[0142] A second transceiver module 91, configured to send a query request for target playback data of maritime target spatio-temporal data to the server side, where the query request carries query condition data;
[0143] The second transceiver module 91 is further configured to receive at least one segmented target playback data sent by the server through a third thread; the at least one segmented target playback data is obtained by the server creating a first thread according to the query request, and through the first thread, segmenting the target playback data according to the query condition data to obtain query information of at least one segmented target playback data, and obtaining at least one second thread from a thread pool; and through the at least one second thread, obtaining at least one segmented target playback data from a database according to the query information of the at least one segmented target playback data.
[0144] Optionally, the device 90 further includes:
[0145] A display module 92, configured to display the at least one segmented target playback data on a display interface of the client.
[0146] It should be noted that this device corresponds to the device on the client side of the above method. All implementation manners in the method embodiment on the client side are applicable to this embodiment and can achieve the same technical effects.
[0147] As Figure 10 shown, an embodiment of the present invention further provides a computing device 100, including a processor 101, a memory 102, a program or instruction stored on the memory 102 and executable on the processor 101. When the program or instruction is executed by the processor 101, each process of the method embodiment for pushing playback data of spatio-temporal data of a maritime target is implemented, and the same technical effects can be achieved. To avoid repetition, details are not described here. It should be noted that the computing device in the embodiment of the present invention includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0148] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0149] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices, and units can refer to the corresponding processes in the foregoing method embodiments, and details are not described here again.
[0150] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed between each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.
[0151] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0152] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0153] Stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present invention. And the aforementioned storage medium includes: USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs and other various media that can store program codes.
[0154] In addition, it should be noted that in the devices and methods of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. And the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to execute in chronological order. Some steps can be executed in parallel or independently of each other. For those of ordinary skill in the art, it can be understood that all or any steps or components of the method and device of the present invention can be implemented in any computing device (including a processor, a storage medium, etc.) or a network of computing devices in the form of hardware, firmware, software, or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.
[0155] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a well-known general-purpose device. Therefore, the object of the present invention can also be achieved only by providing a program product containing program code for implementing the method or device. That is to say, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be noted that in the device and method of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. And, the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to be executed in chronological order. Some steps can be executed in parallel or independently of each other.
[0156] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A playback data push method for marine target spatiotemporal data, characterized in that: Applied to a server, the method comprises: Receive a query request for target playback data of marine target spatiotemporal data sent by a client, wherein the query request carries query condition data; Creating a first thread according to the query request; The target playback data is segmented and processed by the first thread according to the query condition data, including: when the query condition data indicates that the target playback data needs to be played in chronological order, the playback speed is obtained by the first thread. n and the maximum period of the target playback data k , where the maximum period k The maximum time for multiple radar scans to complete a week. exist n < k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is ( t e - t s ) / ( n -1), where t s is the start time of the target playback data, t e The end time of the target playback data; exist n > k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is k , the time interval between two adjacent segment target playback data is ( t e - t s ) / ( n -1)- k ; Obtain query information of at least one segment target playback data; Obtain at least one second thread from the thread pool; Acquire at least one segmentation target playback data from a database according to query information of the at least one segmentation target playback data by the at least one second thread; The at least one segment target playback data is pushed to the client through a third thread.
2. The playback data push method of marine target spatiotemporal data according to claim 1, characterized in that: The target playback data is segmented according to the query condition data by the first thread, and further includes: when the query condition data indicates that the target playback data needs to be played in reverse chronological order, the playback speed is obtained by the first thread. n and the maximum period of the target playback data k , exist n < k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is ( t e - t s ) / ( n -1); among which, t s is the start time of the target playback data, t e The end time of the target playback data; exist n > k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is k , the time interval between two adjacent segment target playback data is ( t e - t s ) / ( n -1)- k .
3. The playback data push method of marine target spatiotemporal data according to claim 1, characterized in that: Pushing the at least one segment target playback data to the client through a third thread includes: Cache the at least one segment target playback data to obtain buffer queue data; Receive the sending frequency data sent by the client; The sending frequency data is compared with the preset push frequency. When the sending frequency data is less than the preset push frequency, the third thread is in sleep mode; when the sending frequency data is greater than or equal to the preset push frequency, the third thread sends the buffer queue data to the client.
4. A playback data receiving method for marine target spatiotemporal data, characterized in that: Applied to a client, the method comprises: Sending a query request for target playback data of marine target spatiotemporal data to a server, wherein the query request carries query condition data; receiving at least one segmented target playback data sent by the server through a third thread; the at least one segmented target playback data is that the server creates a first thread according to the query request, and performs segment processing on the target playback data according to the query condition data through the first thread, including: when the query condition data is that the target playback data needs to be played in chronological order, obtaining the playback speed through the first thread n and the maximum period of the target playback data k , where the maximum period k The maximum time for multiple radar scans to complete a week. exist n < k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is ( t e - t s ) / ( n -1), where t s is the start time of the target playback data, t e The end time of the target playback data; exist n > k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is k , the time interval between two adjacent segment target playback data is ( t e - t s ) / ( n -1)- k ; obtain query information of at least one segmented target playback data, and obtain at least one second thread from the thread pool; and obtain at least one segmented target playback data from the database through the at least one second thread according to the query information of the at least one segmented target playback data.
5. The playback data receiving method of marine target spatiotemporal data according to claim 4, characterized in that: Also includes: The at least one segment target playback data is displayed on a display interface of the client.
6. A playback data push device for marine target spatiotemporal data, characterized in that: Applied to a server, the device comprises: A first transceiver module is used to receive a query request for target playback data of marine target spatiotemporal data sent by a client, wherein the query request carries query condition data; A generating module, configured to create a first thread according to the query request; a processing module, configured to perform segmented processing on the target playback data according to the query condition data through the first thread, including: when the query condition data indicates that the target playback data needs to be played in chronological order, obtaining the playback speed through the first thread n and the maximum period of the target playback data k , where the maximum period k The maximum time for multiple radar scans to complete a week. exist n < k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is ( t e - t s ) / ( n -1), where t s is the start time of the target playback data, t e The end time of the target playback data; exist n > k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is k , the time interval between two adjacent segment target playback data is ( t e - t s ) / ( n -1)- k ; Obtain query information of at least one segment target playback data; A first acquisition module, used to acquire at least one second thread from the thread pool; A second acquisition module, configured to acquire at least one segmentation target playback data from a database according to query information of the at least one segmentation target playback data through the at least one second thread; The first transceiver module is further configured to push the at least one segment target playback data to the client through the third thread.
7. A playback data receiving device for marine target spatiotemporal data, characterized in that: Applied to a client, the device comprises: A second transceiver module is used to send a query request for target playback data of marine target spatiotemporal data to a server, wherein the query request carries query condition data; The second transceiver module is further used to receive at least one segmented target playback data sent by the server through the third thread; the at least one segmented target playback data is that the server creates a first thread according to the query request, and the first thread performs segment processing on the target playback data according to the query condition data, including: when the query condition data is that the target playback data needs to be played in chronological order, the playback speed is obtained through the first thread n and the maximum period of the target playback data k , where the maximum period k The maximum time for multiple radar scans to complete a week. exist n < k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is ( t e - t s ) / ( n -1), where t s is the start time of the target playback data, t e The end time of the target playback data; exist n > k When the target playback data is divided into n -1 segment, the duration of each segment target playback data is k , the time interval between two adjacent segment target playback data is ( t e - t s ) / ( n -1)- k ; obtain query information of at least one segmented target playback data, and obtain at least one second thread from the thread pool; and obtain at least one segmented target playback data from the database through the at least one second thread according to the query information of the at least one segmented target playback data.
8. A computing device, characterized in that include: A processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 3 or the method according to any one of claims 4 to 5 is executed.
Citation Information
Patent Citations
Monitoring video playing method and device and readable storage medium
CN112437270A
Reversed-order playing method and system and reversed-order slicing method
CN115150675A