A method for high-concurrency real-time bus data request response
By caching bus data on the business server and directly matching and querying from memory, the problem of high database pressure under high concurrency is solved, and fast-response real-time bus data query is achieved.
Patent Information
- Application Number
- CN202410306034.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-03-18
AI Technical Summary
Under high concurrency conditions, the existing real-time bus query system can easily lead to excessive pressure on the database and too many connections, resulting in slow response or crash, affecting user access experience.
The bus static data and dynamic real-time data are cached on the business server, and the client directly matches and queries from the memory, reducing dependence on the database and shortening the response link.
By reducing the number of steps involved in the database, the time-consuming data search is shortened, the response speed to real-time bus data requests is significantly accelerated, and the risk of database crash is avoided.
Smart Images

Figure CN118260494B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of real-time public transportation query, and in particular to a method for responding to high-concurrency real-time public transportation data requests. Background Art
[0002] The peak and valley characteristics of real-time bus data are that the morning and evening peaks are particularly high (7-9 a.m., 17-20 p.m.), and the daytime period is flat (9 a.m.-17 p.m.). However, the bus frequency decreases in the evening and early morning (20 p.m.-7 a.m. the next day). At this time, the number of user visits is extremely small, and the amount of bus dynamic data that needs to be transmitted is also small due to the reduction in vehicle operations.
[0003] Using real-time bus query software to query the real-time arrival information of buses can significantly reduce passengers' anxiety while waiting for the bus, allowing passengers to arrange travel time more reasonably and choose appropriate means of transportation.
[0004] The solution adopted in the prior art is as follows: when a user accesses the real-time bus query system through the Http protocol, the real-time bus business system directly reads the database to find the static bus route information, station information, etc. required by the user, and returns the data after matching with the real-time dynamic GPS location information of the bus to the user. This access mode is likely to cause a large database pressure in the case of high concurrency with millions of people accessing at the same time, and will cause too many database connections, resulting in slow database response or crash, leading to user access failure, and the overall request response process will be affected by the slowest database reading link in the entire process.
[0005] Therefore, there is an urgent need for a solution that can improve the request response speed. Summary of the invention
[0006] The present invention provides a method for high-concurrency real-time public transportation data request response to solve the above problems existing in the prior art.
[0007] The present invention provides a method for high-concurrency real-time public transportation data request response, the method comprising:
[0008] S100, the business server of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data into the business server memory;
[0009] S200, the client initiates a request to the business server to access the business server;
[0010] S300, the business server matches the bus routes and bus driving data from the business server memory according to the user's request data, and returns the matched bus routes and bus driving data to the client.
[0011] Preferably, before step S100, the method further includes: S400, establishing a bus static data information table in a database, wherein the database is used to synchronize the bus static data information table to a business service end of a real-time bus query system.
[0012] Preferably, the S400 includes:
[0013] S401, obtaining bus static route information elements and bus static stop information elements through each city bus system; the bus static route information elements include: route number, route name, first bus time, last bus time and route type; the bus static stop information elements include: route number, up and down lines, stop name, stop longitude, stop latitude and stop sequence;
[0014] S402, constructing a bus static data information table according to the bus static route information elements and the bus static station information elements;
[0015] S403, updating the bus static data information table in the database according to the data in the bus systems of each city.
[0016] Preferably, the step S100, in which the business service end of the real-time bus query system obtains static bus data and dynamic real-time bus vehicle data, and caches the static bus data and dynamic real-time bus vehicle data in the business service end memory, includes:
[0017] S101, the business server of the real-time bus query system receives the real-time bus data sent by each city bus system in the form of Socket, and caches the real-time bus data into the memory of the business server;
[0018] S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory.
[0019] Preferably, in S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory, including:
[0020] S1021, the business server obtains bus static data according to the bus systems of various cities, cleans and pre-processes the bus static data, and obtains the pre-processed bus static data;
[0021] S1022, organizing the pre-processed bus static data into a HashMap with the route name as the key and the route information as the value;
[0022] S1023, loading the HashMap into the business server memory for caching to form static initial cache data;
[0023] S1024, at a preset time point, the business server reads the updated bus static data in the bus static data information table from the database, and caches the updated bus static data into the business server memory;
[0024] In S102, the bus static data in the bus static data information table in the database is read at a preset time node, including:
[0025] S1025, real-time monitoring of data update time in the database;
[0026] S1026, setting the time when the data in the database is updated as a preset time node;
[0027] S1027, at a preset time point, the business server obtains updated data in the bus static data information table in the database, and caches the updated data in the business server memory.
[0028] Preferably, in S101, the business service end of the real-time public transportation query system receives the real-time public transportation vehicle data sent by each city public transportation system in the form of a socket, and caches the real-time public transportation vehicle data into the memory of the business service end, including:
[0029] S1011, the service server of the real-time bus query system obtains the real-time GPS location information of the bus from the bus systems of each city; the real-time GPS location information of the bus includes: license plate number, longitude, latitude, line number, up and down, arrival and departure status and station sequence;
[0030] S1012, the business service end constructs the real-time bus data according to the real-time GPS location information of the bus;
[0031] S1013, cache the real-time data of the public transportation vehicle into the memory of the business server.
[0032] Preferably, in S200, the client initiates a request to the business server to access the business server, including:
[0033] S201, the user initiates a request through the HTTP protocol in the form of GET or POST based on the client;
[0034] S202, the information of the line and the running direction to be queried is provided, with the line name and the line running direction as request parameters;
[0035] S203, submitting the request parameters to the business server of the real-time public transportation query system to access the business server.
[0036] Preferably, in S300, the business server matches the bus routes and bus vehicle travel data from the business server memory according to the user's request data, including:
[0037] S301, according to the user's request data, the business server selects the route information from the bus static data in the server memory, searches for the route information based on the route name in the request data as the key, and obtains the route information;
[0038] S302, according to the obtained route information, the business service end matches the public transport vehicle driving data from the public transport vehicle dynamic real-time data cached in the server memory;
[0039] The step S300, returning the matched bus routes and bus driving data to the client, includes:
[0040] S303, setting the matched bus routes and bus driving data as data transmission objects;
[0041] S304, deconstructing the data transmission object from json or xml into a byte stream;
[0042] S305, outputting the byte stream in sequence and returning it to the client. The client parses the data of the byte stream through the data dictionary and deserializes it into identifiable data objects. The identifiable data objects are the matched bus routes and bus vehicle travel data.
[0043] Preferably, S300, the business server matches the bus routes and bus vehicle travel data from the business server memory according to the user's request data, and further includes:
[0044] The business server is provided with a processor, which performs semantic analysis on the user's request data based on the semantic analysis model in the processor to obtain the semantic analysis result;
[0045] Based on the semantic analysis results, the preset knowledge graph recommendation unit is used to recommend and generate a bus route template; according to the bus route template, the bus route and bus vehicle driving data are matched;
[0046] Among them, the construction process of the knowledge graph recommendation unit is: based on the historical request data of users obtained by the business server, using the preset bus route template, construct a knowledge graph with request data and bus route template as entities.
[0047] Preferably, the step S300, returning the matched bus routes and bus driving data to the client, further includes:
[0048] The business service end uses a multi-objective function to establish and generate a bus route importance level value based on the bus route length, route complexity, route popularity, and route request frequency;
[0049] According to the line importance level value, set the corresponding request feedback priority, and set the matching relationship library between the line importance level value and the request feedback priority;
[0050] When the user's access is highly concurrent, the probability value of the user's query on the bus line is predicted based on the user's request data and the preset neural network probability prediction model; and the priority of the request feedback is obtained based on the line importance level value of the bus line in the user's request data and the matching relationship library;
[0051] The probability value and the request feedback priority are weighted and summed to generate a comprehensive feedback sequence value;
[0052] Based on the comprehensive feedback sequence value, the user's requests are returned to the client in order.
[0053] Compared with the prior art, the present invention has the following advantages:
[0054] The present invention provides a method for high-concurrency real-time bus data request response, including: the business service end of the real-time bus query system obtains bus static data and bus vehicle dynamic real-time data, and caches the bus static data and bus vehicle dynamic real-time data in the business service end memory; the client initiates a request to the business service end and accesses the business service end; the business service end matches the bus route and bus vehicle driving data from the business service end memory according to the user's request data, and returns the matched bus route and bus vehicle driving data to the client. Through this solution, by reducing the links involved in the entire request response, the original client, business service end, and database are changed to client and business service end, the participation of the database in the access process is reduced, the overall access link is shortened, and the time-consuming speed of finding data is shortened at the cost of increasing the memory used by the business server, thereby accelerating the speed of the entire real-time bus data request response.
[0055] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0056] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0058] Figure 1 A flowchart of a method for responding to high-concurrency real-time public transportation data requests in an embodiment of the present invention;
[0059] Figure 2 A flow chart of a method for caching public transportation static data into a business server memory in an embodiment of the present invention;
[0060] Figure 3 The present invention is a specific flow chart of a method for responding to high-concurrency real-time public transportation data requests in an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0062] The embodiment of the present invention provides a method for high-concurrency real-time bus data request response, please refer to Figure 1 The method for responding to high-concurrency real-time bus data requests includes:
[0063] S100, the business server of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data into the business server memory;
[0064] S200, the client initiates a request to the business server to access the business server;
[0065] S300, the business server matches the bus routes and bus driving data from the business server memory according to the user's request data, and returns the matched bus routes and bus driving data to the client.
[0066] The working principle and beneficial effects of the above technical solution are as follows: The solution adopted in this embodiment is specifically as follows: first, the business server of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data in the business server memory; secondly, after completing the above preparation steps, when actually querying the bus route, the client initiates a request to the business server and accesses the business server; finally, the business server matches the bus route and bus vehicle driving data from the business server memory according to the user's request data, and returns the matched bus route and bus vehicle driving data to the client.
[0067] The business scenario of the solution provided by the present embodiment for client access is: the user requests the route information and real-time bus data of the specified direction through the client. In this scenario, the solution provided by the present embodiment directly caches the static bus data and the dynamic real-time bus vehicle data in the business service end of the real-time bus query system. When querying the bus route, the bus route and bus vehicle driving data can be directly matched from the business service end memory, and the matched bus route and bus vehicle driving data are returned to the client without matching through the database. This solves the problem in the prior art that in the case of high concurrency of millions of people accessing at the same time, the database is easily overloaded, too many database connections will cause the database to respond too slowly or crash, and user access failures will be caused.
[0068] Therefore, the solution provided by this embodiment reduces the links involved in the entire request response, changing the original client, business server, and database to client and business server, thereby reducing the participation of the database in the access process, shortening the overall access link, and shortening the time required to search for data at the cost of increased memory usage by the business server, thereby accelerating the speed of the entire real-time bus data request response.
[0069] In another embodiment, before step S100, the method further includes: S400, a database establishes a bus static data information table, and the database is used to synchronize the bus static data information table to a business service end of the real-time bus query system.
[0070] In another embodiment, the S400 includes:
[0071] S401, obtaining bus static route information elements and bus static stop information elements through each city bus system; the bus static route information elements include: route number, route name, first bus time, last bus time and route type; the bus static stop information elements include: route number, up and down lines, stop name, stop longitude, stop latitude and stop sequence;
[0072] S402, constructing a bus static data information table according to the bus static route information elements and the bus static station information elements;
[0073] S403, updating the bus static data information table in the database according to the data in the bus systems of each city.
[0074] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is to first construct a database before caching static and dynamic data on the business service end of the real-time bus query system. Specifically, the database establishes a bus static data information table, and the database is used to synchronize the bus static data information table to the business service end of the real-time bus query system. The bus static data information table in the database includes: line number, line name, first bus time, last bus time and line type, line number, up and down, station name, station longitude, station latitude and station sequence, etc. Due to the particularity of the information such as the bus static line passing stations, first and last bus times, etc., the frequency of changes is low and will not be updated frequently, so the data in the database is not updated frequently. The database is also set up so that when the data in the database is updated, the updated data can be synchronized to the business service end memory, so that in the subsequent real-time bus query, the business service end can still directly match and search for static bus routes from the server memory.
[0075] In another embodiment, the S100, the business service end of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data into the business service end memory, including:
[0076] S101, the business server of the real-time bus query system receives the real-time bus data sent by each city bus system in the form of Socket, and caches the real-time bus data into the memory of the business server;
[0077] S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory.
[0078] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the business service end of the real-time bus query system obtains the bus static data and the dynamic real-time data of the bus vehicle, and caches the bus static data and the dynamic real-time data of the bus vehicle in the memory of the business service end, including: the business service end of the real-time bus query system receives the real-time bus vehicle data sent by each city bus system in the form of Socket, and caches the real-time bus vehicle data in the memory of the business service end; the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data in the memory of the business service end. Therefore, the solution provided by this embodiment can read both static data and dynamic data in the server memory, and does not need to directly access the link to the database. By reducing the links involved in the entire request response, the original client, business service, and database are changed to client and business service, which reduces the participation of the database in the access process, shortens the overall access link, and shortens the time-consuming speed of finding data at the cost of increasing the memory used by the business server, thereby accelerating the speed of the entire real-time bus data request response.
[0079] In another embodiment, please refer to Figure 2 In S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory, including:
[0080] S1021, the business server obtains bus static data according to the bus systems of various cities, cleans and pre-processes the bus static data, and obtains the pre-processed bus static data;
[0081] S1022, organizing the pre-processed bus static data into a HashMap with the route name as the key and the route information as the value;
[0082] S1023, loading the HashMap into the business server memory for caching to form static initial cache data;
[0083] S1024, at a preset time point, the business server reads the updated bus static data in the bus static data information table from the database, and caches the updated bus static data into the business server memory;
[0084] In S102, the bus static data in the bus static data information table in the database is read at a preset time node, including:
[0085] S1025, real-time monitoring of data update time in the database;
[0086] S1026, setting the time when the data in the database is updated as a preset time node;
[0087] S1027, at a preset time point, the business server obtains updated data in the bus static data information table in the database, and caches the updated data in the business server memory.
[0088] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the business server of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business server memory, including: first, the business server obtains the bus static data according to the bus systems of each city, cleans and pre-processes the bus static data, and obtains the pre-processed bus static data; the pre-processed bus static data is organized into a HashMap with the line name as the key and the line information as the value.
[0089] HashMap is a combination of array + linked list that stores the mapping relationship between two objects, which is the linked address method HashMap. The linked list exists mainly to resolve hash conflicts. When the located array contains a linked list, first traverse the linked list, and then compare and search one by one through the equals method of the key object.
[0090] Secondly, the HashMap is loaded into the business server memory for caching to form static initial cache data; finally, at a preset time node, the business server reads the updated bus static data in the bus static data information table from the database, and caches the updated bus static data into the business server memory. Therefore, the solution of this embodiment is due to the particularity of the bus static line passing stations, first and last bus times and other information, the change frequency is low and will not be updated frequently, so the business server will clean and organize this part of the data in advance into a HashMap with the line name as the key and the line information as the value, and load it into the memory for caching to form static initial cache data. When the subsequent specific line query is required, the business server can read the updated data in the database when the bus static line information needs to be changed, and synchronize these updated static data to the business server memory. The overall access link is shortened, and the time-consuming speed of finding data is shortened at the cost of increasing the memory used by the business server, thereby accelerating the speed of the entire real-time bus data request response;
[0091] The bus static data in the bus static data information table in the database is read at a preset time node, including: real-time monitoring of the data update time in the database; setting the time of data update monitored in the database as a preset time node; at the preset time node, the business service end obtains the updated data in the bus static data information table in the database, and caches the updated data in the business service end memory. Since the frequency of change of bus static data information is low, the scheme provided by this embodiment can monitor the data update of the database in real time through the monitoring method of data update in the database. If there is data update, a preset time node is formed, and then the business service end will obtain the updated data in the database to cache the updated data. When the bus route is queried later, the business service end can directly perform query matching in the server memory when matching and searching according to the request parameters, and can ensure that the information obtained by the query is the latest data after update, that is, to ensure the speed of request response, and can also ensure the accuracy of the information obtained by the query.
[0092] In another embodiment, the S101, the business service end of the real-time public transportation query system receives the real-time public transportation vehicle data sent by each city public transportation system in the form of a socket, and caches the real-time public transportation vehicle data into the business service end memory, including:
[0093] S1011, the service server of the real-time bus query system obtains the real-time GPS location information of the bus from the bus systems of each city; the real-time GPS location information of the bus includes: license plate number, longitude, latitude, line number, up and down, arrival and departure status and station sequence;
[0094] S1012, the business service end constructs the real-time bus data according to the real-time GPS location information of the bus;
[0095] S1013, cache the real-time data of the public transportation vehicle into the memory of the business server.
[0096] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the business service end of the real-time bus query system receives the real-time bus data sent by each city bus system in the form of Socket, and caches the real-time bus data into the business service end memory, including: the business service end of the real-time bus query system obtains the real-time GPS location information of the bus from each city bus system; the real-time GPS location information of the bus includes: license plate number, longitude, latitude, line number, up and down, arrival and departure status and station sequence; the business service end constructs the real-time bus data according to the real-time GPS location information of the bus; and caches the real-time bus data into the business service end memory.
[0097] Socket is an abstract layer between the application layer and the transport layer. It abstracts the complex operations of the TCP / IP layer into several simple interfaces for the application layer to call the implemented process to communicate in the network. In the solution provided by this embodiment, the real-time data of public transportation vehicles does not need to be stored in the database. Therefore, in the process of querying bus routes, it is not necessary to access the link database, and the query matching can be directly performed in the memory of the business server.
[0098] Since the bus running track GPS data information is highly real-time, the business server needs to update the changes in the bus GPS data as quickly as possible. It does not need to be directly implemented in the database, but can be directly cached in the business server memory and updated in real time according to actual conditions.
[0099] In another embodiment, the step S200, in which the client initiates a request to the business server to access the business server, includes:
[0100] S201, the user initiates a request through the HTTP protocol in the form of GET or POST based on the client;
[0101] S202, the information of the line and the running direction to be queried is provided, with the line name and the line running direction as request parameters;
[0102] S203, submitting the request parameters to the business server of the real-time public transportation query system to access the business server.
[0103] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the client initiates a request to the business server and accesses the business server, including: the user initiates a request based on the client through the Http protocol in the form of a GET or POST request; the information of the line and the running direction to be queried is used as the request parameters with the line name and the line running direction; the request parameters are submitted to the business server of the real-time bus query system to access the business server.
[0104] In another embodiment, the S300, the business server matches the bus routes and bus driving data from the business server memory according to the user's request data, includes:
[0105] S301, according to the user's request data, the business server selects the route information from the bus static data in the server memory, searches for the route information based on the route name in the request data as the key, and obtains the route information;
[0106] S302, according to the obtained route information, the business service end matches the bus driving data from the bus dynamic real-time data cached in the server memory;
[0107] The step S300, returning the matched bus routes and bus driving data to the client, includes:
[0108] S303, setting the matched bus routes and bus driving data as data transmission objects;
[0109] S304, deconstructing the data transmission object from json or xml into a byte stream;
[0110] S305, outputting the byte stream in sequence and returning it to the client. The client parses the data of the byte stream through the data dictionary and deserializes it into identifiable data objects. The identifiable data objects are the matched bus routes and bus vehicle travel data.
[0111] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the user's access request submits the information of the route and running direction to be queried to the real-time bus query system through the HTTP protocol in the form of GET or POST request, with the route name plus the route running direction as parameters. The business server directly uses the route name as the key to search for the route information cached in the server memory in the previous step, and then directly returns it to the user after matching it with the real-time dynamic data in the memory.
[0112] In addition, the scale of the business service end can be expanded horizontally through load balancing, further reducing the system load and increasing the system throughput.
[0113] The matched bus routes and bus driving data are returned to the client, including: setting the matched bus routes and bus driving data as data transmission objects; deconstructing the data transmission objects from json or xml into byte streams; outputting the byte streams in sequence and returning them to the client, and the client parses the data of the byte stream through a data dictionary and deserializes it into identifiable data objects, which are the matched bus routes and bus driving data.
[0114] A byte stream refers to a stream in which the most basic unit of data transmitted during the transmission process is a stream of bytes, a continuous stream that does not contain boundary data; a byte stream is composed of bytes and is mainly used to process binary data. Byte data is in binary form, and to convert it into normal characters that we can recognize, we need to select the correct encoding method. The data dictionary in this embodiment is the rules for encoding and decoding, which are ultimately deserialized into recognizable data objects. Therefore, this embodiment reduces the transmission size of invalid and redundant data by changing the form of the returned data, reduces bandwidth usage, and further accelerates the speed of request responses.
[0115] In another embodiment, S300, the service server matches the bus route and the bus vehicle driving data from the service server memory according to the user's request data, and further includes:
[0116] The business server is provided with a processor, which performs semantic analysis on the user's request data based on the semantic analysis model in the processor to obtain the semantic analysis result;
[0117] Based on the semantic analysis results, the preset knowledge graph recommendation unit is used to recommend and generate a bus route template; according to the bus route template, the bus route and bus vehicle driving data are matched;
[0118] Among them, the construction process of the knowledge graph recommendation unit is: based on the historical request data of users obtained by the business server, using the preset bus route template, construct a knowledge graph with request data and bus route template as entities.
[0119] The working principle and beneficial effects of the above technical solution are as follows: the business service end is provided with a processor, and based on the semantic analysis model in the processor, semantic analysis is performed on the user's request data to obtain the semantic analysis result; based on the semantic analysis result, a preset knowledge graph recommendation unit is used to recommend and generate a bus route template; according to the bus route template, the bus route and bus vehicle driving data are matched and obtained; wherein, the construction process of the knowledge graph recommendation unit is as follows: based on the historical request data of the user obtained by the business service end, a preset bus route template is used to construct a knowledge graph with the request data and the bus route template as entities;
[0120] By using the semantic analysis model to perform semantic analysis and constructing a knowledge graph for recommendation, accurate matching results can be guaranteed.
[0121] In another embodiment, the step S300 of returning the matched bus routes and bus driving data to the client further includes:
[0122] The business service end uses a multi-objective function to establish and generate a bus route importance level value based on the bus route length, route complexity, route popularity, and route request frequency;
[0123] According to the line importance level value, set the corresponding request feedback priority, and set the matching relationship library between the line importance level value and the request feedback priority;
[0124] When the user's access is highly concurrent, the probability value of the user's query on the bus line is predicted based on the user's request data and the preset neural network probability prediction model; and the priority of the request feedback is obtained based on the line importance level value of the bus line in the user's request data and the matching relationship library;
[0125] The probability value and the request feedback priority are weighted and summed to generate a comprehensive feedback sequence value;
[0126] Based on the comprehensive feedback sequence value, the user's requests are returned to the client in order.
[0127] The working principle and beneficial effects of the above technical solution are as follows: the business service end establishes a route importance level value for generating bus routes based on the route length, route complexity, route riding popularity, and route request frequency of the bus routes using a multi-objective function; according to the route importance level value, a corresponding request feedback priority is set, and a matching relationship library between the route importance level value and the request feedback priority is set; when the user's access is in high concurrency, according to the user's request data, based on a preset neural network probability prediction model, the probability value of the user's query on the bus route is predicted; and based on the route importance level value of the bus route in the user's request data, the request feedback priority obtained is matched according to the matching relationship library; the probability value and the request feedback priority are distributed and weighted and summed to generate a comprehensive feedback sequence value; based on the comprehensive feedback sequence value, the user's request is returned to the client in order;
[0128] By setting the comprehensive feedback sequence value, it is convenient to return the bus route data in a targeted and efficient manner when the user's access is in a high concurrency situation, thereby improving the efficiency of returning the bus data to the client.
[0129] In summary, the present invention provides a method for high-concurrency real-time bus data request response. For the specific scheme adopted, please refer to Figure 3 , the specific plan is as follows:
[0130] First, the database establishes a bus static data information table, then the business service end receives the real-time bus data sent by each city in the form of Socket and stores it in the business service end memory, and regularly reads the static line data in the database and caches it in the business service end memory, the client accesses the business service end in the form of Http, the business service end reads the user request data and matches the bus static data line and bus real-time data in the memory, and the business service end returns the matched line and bus vehicle driving data to the client in order in the form of byte stream. The scheme of the present invention reduces the links involved in the entire request response on the one hand, and changes the original client, business service, and database into the client and business service, reduces the participation of the database in the access process, shortens the link of the overall access, and shortens the time-consuming speed of finding data at the cost of the business server using increased memory, thereby accelerating the speed of the entire real-time bus data request response. On the other hand, by changing the form of the returned data, the transmission size of invalid and redundant data is reduced, the bandwidth occupation is reduced, and the speed of the request response is further accelerated.
[0131] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for high-concurrency real-time bus data request response, characterized in that: include: S100, the business server of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data into the business server memory; S200, the client initiates a request to the business server to access the business server; S300, the business server matches the bus routes and bus driving data from the business server memory according to the user's request data, and returns the matched bus routes and bus driving data to the client; The step S300, returning the matched bus routes and bus driving data to the client, further includes: The business service end uses a multi-objective function to establish and generate bus route importance level values based on the bus route length, route complexity, route popularity, and route request frequency; According to the line importance level value, set the corresponding request feedback priority, and set the matching relationship library between the line importance level value and the request feedback priority; When the user's access is highly concurrent, the probability value of the user's query on the bus line is predicted based on the user's request data and the preset neural network probability prediction model; and the priority of the request feedback is obtained based on the line importance level value of the bus line in the user's request data and the matching relationship library; The probability value and the request feedback priority are weighted and summed to generate a comprehensive feedback sequence value; Based on the comprehensive feedback sequence value, the user's requests are returned to the client in order.
2. A method for responding to high-concurrency real-time public transportation data requests according to claim 1, characterized in that: Before step S100, the method further includes: S400, a database establishes a bus static data information table, and the database is used to synchronize the bus static data information table to a business service end of a real-time bus query system.
3. A method for high-concurrency real-time public transportation data request response according to claim 2, characterized in that: The S400 includes: S401, obtaining bus static route information elements and bus static stop information elements through each city bus system; the bus static route information elements include: route number, route name, first bus time, last bus time and route type; the bus static stop information elements include: route number, up and down lines, stop name, stop longitude, stop latitude and stop sequence; S402, constructing a bus static data information table according to the bus static route information elements and the bus static station information elements; S403, updating the bus static data information table in the database according to the data in the bus systems of each city.
4. A method for responding to high-concurrency real-time public transportation data requests according to claim 2, characterized in that: In S100, the business service end of the real-time bus query system obtains the bus static data and the bus vehicle dynamic real-time data, and caches the bus static data and the bus vehicle dynamic real-time data into the business service end memory, including: S101, the business server of the real-time bus query system receives the real-time bus data sent by each city bus system in the form of Socket, and caches the real-time bus data into the memory of the business server; S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory.
5. A method for responding to high-concurrency real-time public transportation data requests according to claim 4, characterized in that: The S102, the business service end of the real-time bus query system reads the bus static data in the bus static data information table in the database at a preset time node, and caches the bus static data into the business service end memory, including: S1021, the business server obtains bus static data according to the bus systems of various cities, cleans and pre-processes the bus static data, and obtains the pre-processed bus static data; S1022, organizing the pre-processed bus static data into a HashMap with the route name as the key and the route information as the value; S1023, loading the HashMap into the business server memory for caching to form static initial cache data; S1024, at a preset time point, the business server reads the updated bus static data in the bus static data information table from the database, and caches the updated bus static data into the business server memory; In S102, the bus static data in the bus static data information table in the database is read at a preset time node, including: S1025, real-time monitoring of data update time in the database; S1026, setting the time when the data in the database is updated as a preset time node; S1027, at a preset time point, the business server obtains updated data in the bus static data information table in the database, and caches the updated data in the business server memory.
6. A method for high-concurrency real-time public transportation data request response according to claim 4, characterized in that: The above S101, the business service end of the real-time public transportation query system receives the real-time public transportation vehicle data sent by each city public transportation system in the form of a socket, and caches the real-time public transportation vehicle data into the memory of the business service end, including: S1011, the service server of the real-time bus query system obtains the real-time GPS location information of the bus from the bus systems of each city; the real-time GPS location information of the bus includes: license plate number, longitude, latitude, line number, up and down, arrival and departure status and station sequence; S1012, the business service end constructs the real-time bus data according to the real-time GPS location information of the bus; S1013, cache the real-time data of the public transportation vehicle into the memory of the business server.
7. A method for high-concurrency real-time public transportation data request response according to claim 1, characterized in that: In S200, the client initiates a request to the business server to access the business server, including: S201, the user initiates a request through the HTTP protocol in the form of GET or POST based on the client; S202, the information of the line and the running direction to be queried is provided, with the line name and the line running direction as request parameters; S203, submitting the request parameters to the business server of the real-time public transportation query system to access the business server.
8. A method for high-concurrency real-time public transportation data request response according to claim 7, characterized in that: In S300, the business server matches the bus routes and bus vehicle travel data from the business server memory according to the user's request data, including: S301, according to the user's request data, the business server selects the route information from the bus static data in the server memory, searches for the route information based on the route name in the request data as the key, and obtains the route information; S302, according to the obtained route information, the business service end matches the public transport vehicle driving data from the public transport vehicle dynamic real-time data cached in the server memory; The step S300, returning the matched bus routes and bus driving data to the client, includes: S303, setting the matched bus routes and bus driving data as data transmission objects; S304, deconstructing the data transmission object from json or xml into a byte stream; S305, outputting the byte stream in sequence and returning it to the client. The client parses the data of the byte stream through the data dictionary and deserializes it into identifiable data objects. The identifiable data objects are the matched bus routes and bus vehicle travel data.
9. The method for responding to high-concurrency real-time public transportation data requests according to claim 1, characterized in that: S300, the business server matches the bus routes and bus driving data from the business server memory according to the user's request data, and also includes: The business server is provided with a processor, which performs semantic analysis on the user's request data based on the semantic analysis model in the processor to obtain the semantic analysis result; Based on the semantic analysis results, the preset knowledge graph recommendation unit is used to recommend and generate a bus route template; according to the bus route template, the bus route and bus vehicle driving data are matched; Among them, the construction process of the knowledge graph recommendation unit is: based on the historical request data of users obtained by the business server, using the preset bus route template, construct a knowledge graph with request data and bus route template as entities.
