Search

CN-121984983-A - Data storage method and system for network vehicle

CN121984983ACN 121984983 ACN121984983 ACN 121984983ACN-121984983-A

Abstract

The invention discloses a data storage method and a data storage system for network taxi taking, wherein the data storage method comprises the steps of receiving driver heartbeat data through a distributed message queue, wherein the driver heartbeat data at least comprises longitude and latitude coordinates, service state data and metadata, consuming the longitude and latitude coordinates through a grid index constructor, obtaining corresponding geographic grids according to the longitude and latitude coordinates, sending an index update request to a grid index service cluster according to the geographic grids by the grid index constructor, updating driver list data through the grid index service cluster, integrating the service state data and the metadata through a state processor, storing the service state data and the metadata into a multi-level cache storage cluster, acquiring the updated driver list data through the grid index service cluster by a matching engine, and sending a batch request to the multi-level cache storage cluster according to the updated driver list data by the matching engine to obtain target driver total data. The invention can realize that the matching delay is obviously reduced and more stable.

Inventors

  • LIU XINGWEI

Assignees

  • 北京白驹易行科技有限公司

Dates

Publication Date
20260505
Application Date
20260211

Claims (10)

  1. 1. The data storage method for the network appointment vehicle is characterized by comprising the following steps of: The distributed message queue receives the heartbeat data of a driver, wherein the heartbeat data of the driver at least comprises longitude and latitude coordinates, service state data and metadata; Consuming the longitude and latitude coordinates through a grid index constructor, and obtaining a corresponding geographic grid according to the longitude and latitude coordinates; according to the geographic grid, the grid index builder sends an index update request to a grid index service cluster, and the grid index service cluster updates driver list data; consuming the service state data and the metadata through a state processor, integrating the service state data and the metadata, and storing the integrated service state data and the metadata into a multi-level cache storage cluster; And according to the updated driver list data, the matching engine sends a batch request to the multi-level cache storage cluster to obtain target driver total data.
  2. 2. The network-oriented data storage method of claim 1, wherein the grid-indexed service cluster comprises at least one service node, each service node corresponding to at least one of the geographic grids, each of the geographic grids managing at least one driver list data.
  3. 3. The network-oriented about-car data storage method of claim 2, wherein the matching engine obtaining the updated driver list data through the grid index service cluster comprises: A grid index interface is deployed on the grid index service cluster; The matching engine calls the grid index interface, the grid index interface queries the corresponding geographic grid according to order coordinates, and sends query requests to the service nodes corresponding to the geographic grid in parallel, and the updated driver list data returned by each service node is aggregated and denoised and integrated and then returned to the matching engine.
  4. 4. The network-oriented data storage method of claim 1, wherein the index update request is to remove a driver identification code from an original grid list and to add the driver identification code to a target grid list.
  5. 5. The network-oriented data storage method of claim 4, wherein the removing the driver's identification code from the original grid list and adding the driver's identification code to the target grid list comprises a grid index unit, a lock manager, a reverse index, a remove operation branch, an add operation branch, wherein, The grid index builder packages the update contents of all clients in the same geographic grid into a batch update request; the grid index unit receives the batch updating requests, initiates requests to the lock manager, acquires distributed locks corresponding to the geographic grids, and then circularly processes the updating requests of each geographic grid, and queries the current geographic grid with the identification code of the driver to be removed by using the reverse index; moving the driver identification code out of the original grid list by using the removing operation branch, and moving the driver identification code into the target grid list by using the adding operation branch; and then, the grid index unit informs the lock manager to release the distributed lock corresponding to the geographic grid.
  6. 6. The network-oriented data storage method according to claim 1, wherein the integrating the service status data with the metadata is followed by storing the service status data in a multi-level cache storage cluster, and the method comprises: the metadata at least comprises a driver identification code and a vehicle type; And integrating the service state data, the driver identification code and the vehicle type to obtain integrated service state data and metadata, and attaching a service tag to the driver identification code according to a static rule when the integrated service state data and metadata are written into the multi-level cache storage cluster.
  7. 7. The network-oriented data storage method of claim 6, wherein the matching engine sends a batch request to the multi-level cache storage cluster according to the driver list data to obtain target driver total data, comprising; the multi-level cache storage cluster consists of a local cache, a shared cache and a relational database; After receiving the batch request sent by the matching engine, the multi-level cache storage cluster generates a query instruction corresponding to the driver list data; And according to the query instruction, firstly querying the local cache, querying the shared cache if the local cache is not hit, and querying a relational database if the shared cache is not hit, so as to acquire the target driver total data.
  8. 8. The method for storing data for network-oriented vehicles according to claim 7, wherein said querying the local cache according to the query command, querying the shared cache if the local cache misses, querying a relational database if the shared cache misses, and obtaining the target driver total data comprises: if the shared cache acquires the target driver full data, the target driver full data is stored into the local cache by using a write-back instruction of the state processor; And if the relation database acquires the target driver total data, the target driver total data is respectively stored into the local cache and the shared cache by using a write-back instruction of the state processor, and the corresponding expiration time is set.
  9. 9. The network-oriented data storage method of claim 8, wherein the expiration time corresponding to storing the target driver full data in the local buffer is a first expiration time, wherein the expiration time corresponding to storing the target driver full data in the shared buffer is a second expiration time, and wherein the first expiration time is less than the second expiration time.
  10. 10. A network-oriented data storage system for a vehicle, comprising: The distributed message queue layer is used for receiving heartbeat data of a driver, and the heartbeat data of the driver at least comprises longitude and latitude coordinates, service state data and metadata; The dynamic grid index layer is interacted with the distributed message queue layer and the matching calculation layer respectively and is used for consuming the longitude and latitude coordinates through a grid index constructor and obtaining a corresponding geographic grid according to the longitude and latitude coordinates; The multi-level cache state storage layer is interacted with the distributed message queue layer and the matching calculation layer respectively and is used for consuming the service state data and the metadata through a state processor, integrating the service state data and the metadata and then storing the service state data and the metadata into a multi-level cache storage cluster; the matching calculation layer is respectively interacted with the dynamic grid index layer and the multi-level cache state storage layer and is used for a matching engine to acquire updated driver list data through the grid index service cluster, and the matching engine sends batch requests to the multi-level cache storage cluster according to the driver list data to acquire target driver total data.

Description

Data storage method and system for network vehicle Technical Field The invention relates to the technical field of distributed data storage, in particular to a data storage method and a system for a network contract car. Background The core of the network vehicle service is to match massive travel demands and transport capacity supply in real time. This process requires the completion of the query, filtering and computation of tens of millions of spatio-temporal state data in an extremely short time (100 to 500 milliseconds). The performance of the underlying data storage system directly determines the efficiency of the matching algorithm and the final business index. In the early stage of network about car service development, a scheme of combining a traditional relational database (such as My Structured Query Language, mySQL) with a spatial expansion (such as PostgreSQL Geographic Information Systems, postGIS) is mostly adopted, but high concurrent read-write requirements cannot be met. Subsequently, the general shift to NoSQL (such as Remote Dictionary Server, redis) and built-in GEO (Geospatial ) hash indexes of the non-relational database realizes the initial improvement of performance, but the problems of low query efficiency, high expansion cost and the like in a dense area are gradually highlighted along with the increase of network about vehicle traffic. The prior art discloses a state storage and query method based on Redis GEO indexes and a relational database, which adopts a hybrid storage architecture to realize real-time matching of driver-orders, and the real-time geographic position of a driver is stored by Redis GEO (according to urban partitions, key format is driver: GEO: { city_id }), and coordinates are encoded into a Score value of 52-bit integers by using a Geohash principle. Driver metadata (e.g., vehicle model, service score) is stored in MySQL or Redis. The matching process comprises three steps of 1) geofence inquiry, namely, acquiring a driver identification code in the radius of an order through GEORADIUS command, 2) metadata batch acquisition, namely, using MGET to inquire detailed state information of the driver concurrently, and 3) memory filtering and sorting, namely, finishing condition filtering (such as removing the driver with unmatched vehicle types) and sorting of priorities at an application layer. Redis GEO is a Redis geographic position data structure, sorted Set is an ordered set based on Sorted Set, the structure is ordered according to Score, GEO is an underlying structure, driver is GEO: { city_id } is a geographic position key, urban isolation data is pressed, score is an ordering Score, here is a Geohash coding value of geographic coordinates, GEORADIUS is a geographic radius query command, a central point coordinate and a radius are input, MGET is a batch key value query command, and the method is used for efficiently acquiring a plurality of driver metadata. The technical problems of high inquiry delay and obvious jitter are that in a driver-intensive area such as an urban core business district, the time complexity of GEORADIUS commands can be obviously increased along with the rapid increase of the inquiry result quantity, so that the interface response time is unstable. In addition, the scene needs to adopt a two-step query flow, namely, firstly querying the driver ID through GEO and then querying the driver details in batches, even if a Pipeline is used for optimizing a network request, a large number of network IO and data serialization/deserialization operations still bring millisecond-level delay, and the two-step query flow becomes a main performance bottleneck of the whole order-driver matching flow. Therefore, the query delay is high and the jitter is obvious, which is a technical problem to be solved in the field. Disclosure of Invention In view of the above, the present invention provides a data storage method for a network about vehicle, which is used for solving the problems of high inquiry delay and obvious jitter. In a first aspect, the present invention provides a method for storing data for a network-oriented vehicle, including: The distributed message queue receives the heartbeat data of the driver, wherein the heartbeat data of the driver at least comprises longitude and latitude coordinates, service state data and metadata; The grid index builder sends an index update request to the grid index service cluster according to the geographic grid, and the grid index service cluster updates driver list data; The service state data and the metadata are consumed through the state processor, integrated and stored into the multi-level cache storage cluster; the matching engine acquires updated driver list data through the grid index service cluster, and sends a batch request to the multi-level cache storage cluster according to the updated driver list data to obtain target driver total data. Optionally, the grid index service cluster includes at l