Summary of the invention
The object of the embodiment of the present invention is to propose a kind of map display system, and the network transfer speeds that is intended to solve prior art map display system is slow, concurrent indifferent, processes the long problem of response time of request.
A map display system, described system comprises:
Network transmission device, map protocol apparatus, distributed caching device, described map protocol apparatus is connected with distributed caching device with network transmission device respectively, wherein,
Network transmission device, adds decoding for NIO framework adaptation, data receiver and transmission, data;
Map protocol apparatus, is connected with described network transmission device, for the treatment of the distributing of the parsing of agreement and assembling, agreement, protocol logic is processed, key assignments generates;
Distributed caching device, be connected, and described distributed caching device comprises with described map protocol apparatus:
Cache partitions module, is used to cache interface function that initiation parameter is provided, and according to buffer memory type, level of zoom, coordinate offset amount is connected to the region cache sub-module in different cache module groups by cache interface;
Cache module group, be connected with described cache partitions module, for unified cache access interface is provided, use Telnet agreement as basic agreement, utilize internal memory as buffer memory, by supporting 32/64 bit manipulation system maximum can utilize internal memory not limited by physical memory, this module comprises a plurality of regions cache sub-module;
Timed backup module, is connected with described cache module group, for according to timed task, regularly the data cached persistence of a plurality of regions cache sub-module in cache module group is saved in database;
Data restoring module, is connected with described cache module group, for Backup Data being reverted in a plurality of regions cache sub-module of cache module group.
Another object of the embodiment of the present invention is to propose a kind of map-indication method, and described method comprises:
The NIO framework of supporting according to XML file configuration, has realized Socket and HTTP according to described framework;
Reception, from the network request of client, sends response data to client, and the data of transmission are added to decoding;
The data that reception is come from Internet Transmission, and described data are carried out to protocol analysis, business logic processing, generation key assignments and access cache interface, after finishing service logical process, the data of returning are carried out to agreement assembling;
According to the access of cache interface, the region buffer memory of cache partitions Divide File is conducted interviews;
Wherein, describedly according to the access of cache interface, the region buffer memory of cache partitions Divide File is conducted interviews and is comprised:
Allocating cache partitioned file, the mode by buffer memory key assignments with scope is configured in partitioned file;
Receive cache interface request, according to cache partitions configuration, access corresponding caching server, obtain data;
Start timed task, the data in buffer memory are backuped in database, then by database timed backup;
Restoring data is in the caching server list of appointment in batches;
Access third party interface, generate data cached, according to cache partitions configuration, by deposit data in corresponding caching server.
Another object of the embodiment of the present invention is to propose a kind of map protocol apparatus, and described map protocol apparatus comprises:
Protocol analysis module, for the network data receiving is carried out to protocol analysis according to predetermined format, and sends to business logic processing module by the data after resolving; Wherein said predetermined format is: " packet content of data packet length+protocol number+agreement association attributes+request ";
Agreement Knockdown block, for assembling the response data from business logic processing module, assembles described response data and protocol header, and sends the protocol package after assembling; Wherein said assembling form is: " packet content of data packet length+protocol number+agreement association attributes+response ";
Business logic processing module, is connected with agreement Knockdown block, for the data after resolving are distributed to corresponding protocol logic processing capacity;
Key assignments Knockdown block, is connected with described business logic processing module, for when business logic processing resume module data need to be obtained non-real-time data, generates corresponding key assignments, the parameter by this key assignments as access cache; The form of the corresponding key assignments of described generation is divided into two kinds: a kind of is " key assignments+agreement association attributes ", and another kind is " key assignments+level of zoom+coordinate offset amount ";
Cache interface module, be connected with described key assignments Knockdown block, for the handle of quoting as access distributed caching device, the initialization of described handle generates according to the configuration of reading cache partitions module, in described cache interface module, comprise one group of buffer memory and quote handle, each is quoted handle and is connected with the region cache sub-module in cache module group;
Log pattern, is connected with all modules in described map protocol apparatus, and for record request daily record, logicality is processed daily record and buffer memory access log, facilitates map protocol apparatus described in trace debug;
Another object of the embodiment of the present invention is to propose a kind of map protocol method, and described method comprises:
User's request msg is resolved with the structure of custom protocol;
Protocol number in custom protocol after resolving is carried out to agreement division, and distribute in corresponding map processing logic method, then carry out corresponding logical process according to concrete request msg;
Generate buffer memory key assignments, obtain cache set interface handle, call this handle acquiring cache interface method, described buffer memory key assignments is imported into simultaneously, analyze described buffer memory key assignments whether in effective range;
As returned to corresponding cache interface object in effective range, data cached by described cache interface object acquisition;
If described buffer memory key assignments is not in effective range or obtain data cached failure, accesses third party's data-interface and obtain data;
The data of returning are assembled and returned with the structure of custom protocol.
Beneficial effect of the present invention: the present invention, by realizing existing NIO framework, has accelerated network transfer speeds and solved network concurrent problem, for system provides scalability; By realizing custom protocol, the packet of having simplified request/response has more been accelerated the speed of request response; Make full use of the characteristic of buffer memory, data store organisation is to take buffer memory as main, and all data are all put in distributed caching, thereby has accelerated the response time of the request of processing.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated, for convenience of explanation, only show the part relevant to the embodiment of the present invention.Should be appreciated that the specific embodiment that this place is described, only for explaining the present invention, not in order to limit the present invention.
The present invention has carried out design and optimization again to the mixed-media network modules mixed-media of traditional map application service end system, logic processing module, data memory module.By realizing existing NIO framework, accelerate network transfer speeds and solved network concurrent problem, support simple expansion and configuration just can realize adaptive existing outstanding NIO framework, for system provides scalability simultaneously; By realizing custom protocol, simplified the packet of request/response, remove the redundancy of attribute that other agreement is brought, played the use of doing to packet fat-reducing, standard map datum request protocol specification, has more accelerated the speed that request responds; By adjusting data store organisation, use high speed distributed cache server group, the parameter of data is according to the map generated to corresponding key assignments, according to this key assignments, divide cache partitions, Value Data is stored in different caching servers respectively, to accelerate to obtain the speed of map datum, by buffer memory timed backup and reduction mechanism, realize data cached persistence simultaneously, effectively solved the problems such as data cached loss, make full use of the characteristic of buffer memory, thereby accelerated the response time of the request of processing.Data store organisation after adjustment is to take buffer memory as main, and all data are all put in distributed caching.
Fig. 1, Fig. 2 are a kind of map display server of embodiment of the present invention system construction drawings, and described server comprises:
Network transmission device, map protocol apparatus, distributed caching device, described map protocol apparatus is connected with distributed caching device with network transmission device respectively, wherein,
Network transmission device, adds decoding for NIO framework adaptation, data receiver and transmission, data;
Be the system construction drawing of network transmission device as described in Figure 3, described network transmission device comprises:
NIO framework adaptation module, for according to abstract class definition abstract method, by expanding the mode of this abstract class and configuration respective attributes file, has realized the adaptation of NIO framework;
Procotol support module, is connected with described NIO framework adaptation module, for supporting the procotol of mobile terminal; Wherein said procotol comprises the popular procotols of mobile terminal such as Socket, HTTP1.0/HTTP1.1
Data reception module, is connected with described procotol support module, the data that send for receiving network protocol support module;
Data transmission blocks, is connected with described procotol support module, for agreement being added to decoder module, passes the data come and sends to procotol support module;
Agreement adds decoder module, be connected with data reception module with described data transmission blocks, for sending to protocol analysis module after the decoding data that data reception module is transmitted, receive the data that agreement Knockdown block sends and raise the price after send to data transmission blocks.
Map protocol apparatus, is connected with described network transmission device, for the treatment of the distributing of the parsing of agreement and assembling, agreement, protocol logic is processed, key assignments generates;
Be the system construction drawing of map protocol apparatus as described in Figure 4, described map protocol apparatus comprises:
Protocol analysis module, adding decoder module phase with described agreement is connected with log pattern, for resolving the agreement of network transmission device, add the data that decoder module sends, according to predetermined format, carry out protocol analysis, and the data after resolving are sent to business logic processing module; Wherein said predetermined format is: " packet content of data packet length+protocol number+agreement association attributes+request ";
Agreement Knockdown block, adding decoder module with described agreement is connected with log pattern, for assembling the response data from business logic processing module, described response data and protocol header are assembled, and the agreement that the protocol package after assembling sends to network transmission device is added to decoder module; Wherein said assembling form is: " packet content of data packet length+protocol number+agreement association attributes+response ";
Business logic processing module, is connected with described protocol analysis module, agreement Knockdown block, for the data after protocol analysis module parses being distributed to corresponding protocol logic processing capacity; Its protocol logic is processed concrete function and is comprised:
(1) get map
(2) get real-time road cartographic information
(3) obtain sectional drawing
(4) send map multimedia message
(5) map error correction
(6) search information
(7) search third party data message
(8) architecture
(9) by the actual longitude and latitude of GPS module, obtain side-play amount
(10) drive route inquiry
(11) keyword query public bus network title
(12) according to bus routes name query public bus network information
(13) according to longitude and latitude and city codes inquiry big city Public Transport Transfer
(14) according to current centre coordinate, obtain under different proportion the side-play amount with respect to center longitude
(15) heartbeat packet
(16) address resolution service
(17) obtain geographical position longitude and latitude, city title etc.;
Key assignments Knockdown block, is connected with described business logic processing module, for when business logic processing resume module data need to be obtained non-real-time data, generates corresponding key assignments, the parameter by this key assignments as access cache; The form of the corresponding key assignments of described generation is divided into two kinds: a kind of is that " key assignments+agreement association attributes ", another kind are " key assignments+level of zoom+coordinate offset amounts ".
Cache interface module, be connected with described key assignments Knockdown block, for the handle of quoting as access distributed caching device, the initialization of described handle generates according to the configuration of reading cache partitions module, in described cache interface module, comprise one group of buffer memory and quote handle, each is quoted handle and is connected with the region cache sub-module in cache module group;
Log pattern, is connected with all modules in described map protocol apparatus, and for record request daily record, logicality is processed daily record and buffer memory access log, facilitates map protocol apparatus described in trace debug;
Distributed caching device, is connected with described map protocol apparatus, is the system construction drawing of distributed caching device as described in Figure 5, and described distributed caching device comprises:
Cache partitions module, is connected with described cache interface module, is used to cache interface function that initiation parameter is provided, and according to buffer memory type, level of zoom, coordinate offset amount is connected to the region cache sub-module in different cache module groups by cache interface;
Cache module group, be connected with described cache partitions module, for unified cache access interface is provided, use Telnet agreement as basic agreement, utilize internal memory as buffer memory, by supporting 32/64 bit manipulation system maximum can utilize internal memory not limited by physical memory, in this module, also comprise a plurality of regions cache sub-module;
Timed backup module, is connected with described cache module group, and this module is automatically to trigger, and for according to timed task, regularly the data cached persistence of a plurality of regions cache sub-module in cache module group is saved in database;
Data restoring module, is connected with described cache module group, and this module is manual triggers, for Backup Data being reverted in a plurality of regions cache sub-module of cache module group.
The embodiment of the present invention has been carried out design and optimization again to the mixed-media network modules mixed-media of traditional map application service end system, logic processing module, data memory module.By realizing existing NIO framework, accelerate network transfer speeds and solved network concurrent problem, support simple expansion and configuration just can realize adaptive existing outstanding NIO framework, for system provides scalability simultaneously; By realizing custom protocol, simplified the packet of request/response, remove the redundancy of attribute that other agreement is brought, played the use of doing to packet fat-reducing, standard map datum request protocol specification, has more accelerated the speed that request responds; By adjusting data store organisation, use high speed distributed cache server group, the parameter of data is according to the map generated to corresponding key assignments, according to this key assignments, divide cache partitions, Value Data is stored in different caching servers respectively, to accelerate to obtain the speed of map datum, by buffer memory timed backup and reduction mechanism, realize data cached persistence simultaneously, effectively solved the problems such as data cached loss, make full use of the characteristic of buffer memory, thereby accelerated the response time of the request of processing.Data store organisation after adjustment is to take buffer memory as main, and all data are all put in distributed caching.
Be below the process step of a kind of map-indication method of the embodiment of the present invention:
The NIO framework that step 1. is supported according to XML file configuration, has realized Socket and HTTP according to described framework; Reception, from the network request of client, sends response data to client, and the data of transmission are added to decoding.
Step 2. receives the data of coming from Internet Transmission, and described data are carried out to protocol analysis, business logic processing, generation key assignments and access cache interface, after finishing service logical process, the data of returning is carried out to agreement assembling.
Step 3. conducts interviews to the region buffer memory of cache partitions Divide File according to the access of cache interface.
Be below the process step of a kind of network transfer method of the embodiment of the present invention:
Step 1, the NIO framework of supporting according to XML file configuration.
Step 2, receives user's request, and according to the port of user's access, distinguishing is HTTP or Socket.
Step 3, the corresponding callback method according to different agreement call request data imports described request data into corresponding callback method in the mode of parameter simultaneously, calling data response method, and send the response data that described data response method is passed back.
Step 4, utilizes filter mechanism to add decoding to described request data and described response data.
The embodiment of the present invention, by realizing existing NIO framework, has been accelerated network transfer speeds and has been solved network concurrent problem, supports simple expansion and configuration just can realize adaptive existing outstanding NIO framework, for system provides scalability simultaneously.
Be below the process step of embodiment of the present invention map protocol method:
Step 1. is resolved user's request msg with the structure of custom protocol.
The form of wherein said custom protocol is: " packet content of data packet length+protocol number+agreement association attributes+request ";
Protocol number in custom protocol after step 2. pair parsing carries out agreement division, and distributes in corresponding map processing logic method, then carries out corresponding logical process according to concrete request msg.
Step 3. generates buffer memory key assignments, obtains cache set interface handle, calls this handle acquiring cache interface method, described buffer memory key assignments is imported into simultaneously, analyzes described buffer memory key assignments whether in effective range,
As returned to corresponding cache interface object in effective range, data cached by described cache interface object acquisition;
If described buffer memory key assignments is not in effective range or obtain data cached failure, accesses third party's data-interface and obtain data.
Wherein buffer memory key assignments refers in effective range needs the data of access in the module of cache partitions.
Step 4. assembles with the structure of custom protocol the data of returning return.
The embodiment of the present invention, by realizing custom protocol, has been simplified the packet of request/response, removes the redundancy of attribute that other agreement is brought, and has played the use of doing to packet fat-reducing, and standard map datum request protocol specification has more been accelerated the speed that request responds.
Be below the process step of embodiment of the present invention distributed caching method:
Step 1. allocating cache partitioned file, the mode by buffer memory key assignments with scope is configured in partitioned file, such as: one group of buffer memory range of key values corresponds to a caching server etc.
Step 2. receives cache interface request, according to cache partitions configuration, accesses corresponding caching server, obtains data.
Step 3. starts timed task, the data in buffer memory is backuped in database, then by database timed backup.
Step 4. batch restoring data is in the caching server list of appointment.
Step 5. access third party interface, generate data cached, according to cache partitions configuration, by deposit data in corresponding caching server.
The embodiment of the present invention is by adjusting data store organisation, use high speed distributed cache server group, the parameter of data is according to the map generated to corresponding key assignments, according to this key assignments, divide cache partitions, Value Data is stored in different caching servers respectively, to accelerate to obtain the speed of map datum, simultaneously by buffer memory timed backup and reduction mechanism, realized data cached persistence, the problems such as data cached loss have effectively been solved, make full use of the characteristic of buffer memory, thereby accelerated the response time of the request of processing.Data store organisation after adjustment is to take buffer memory as main, and all data are all put in distributed caching.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.