CN105718592B - Data calling method and its system based on Redis - Google Patents
Data calling method and its system based on Redis Download PDFInfo
- Publication number
- CN105718592B CN105718592B CN201610056012.5A CN201610056012A CN105718592B CN 105718592 B CN105718592 B CN 105718592B CN 201610056012 A CN201610056012 A CN 201610056012A CN 105718592 B CN105718592 B CN 105718592B
- Authority
- CN
- China
- Prior art keywords
- data
- server
- redis
- operation layer
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to a kind of data calling method and its system based on Redis, wherein method includes: operation layer trigger data inquiry instruction or data modification instruction;If operation layer trigger data inquiry instruction, operation layer accesses Redis server, and query-relevant data;If the modification instruction of operation layer trigger data, operation layer access java server, the java server carries out identical data change to server database and Redis server respectively.Each industry layer of database server inquires user data requests, it is only necessary to read data from Redis server, to reduce the pressure of database, shorten the data response time in called data library, increase the data call speed of system.
Description
Technical field
The present invention relates to data processing fields, and in particular to data calling method and its system based on Redis.
Background technique
The caching technology of WEB website is substantially use: Business Logic+Memcache cache layer+data Layer, wherein
Memcache cache layer is temporal cache, and server can periodically empty the data in Memcache cache layer, or again
Data when activation system in Memcache cache layer can also empty.In the case of data request amount is big, once Memcache
Cache layer failure just needs each Business Logic that data Layer is directly gone to inquire data, this just directly results in database server pressure
Power is very big, or even can generate low-response and locked situation.In addition Memcache cache layer fails, and will generate and more ask
The case where asking and call database server, each group server stress of database server is caused to increase, generating low-response.
Utility model content
The object of the present invention is to provide a kind of data calling method and its system based on Redis shortens called data library
The data response time, alleviate database server and database pressure, to increase the data call speed of system.
The purpose of the present invention is be achieved through the following technical solutions:
A kind of data calling method based on Redis includes:
Operation layer trigger data inquiry instruction or data modification instruction;
If operation layer trigger data inquiry instruction, operation layer accesses Redis server, and query-relevant data;
If the modification instruction of operation layer trigger data, operation layer access java server, the java server is right respectively
Server database and Redis server carry out identical data change;
If the operation layer trigger data modification instruction, operation layer access java server includes: the operation layer touching
The instruction that hair client is sent is that data increase instruction, data delete instruction or data alteration command, is carried out to relevant data
Increase, delete or change, then operation layer access java server carries out relevant operation;
If operation layer trigger data increases instruction, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data increase, and the data of newly-built data or supplement are increased
It is stored into server database and Redis server.
If operation layer trigger data deletes instruction, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data deletion, will delete in server database and Redis server
Identical data.
If operation layer trigger data alteration command, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data change, will replace in server database and Redis server
Or the identical data of modification.
Further, the operation layer trigger data inquiry instruction or data modification instruction include: that the operation layer connects
After the instruction for receiving client, trigger data inquiry instruction or data modification instruction.
Further, if the operation layer trigger data inquiry instruction, operation layer accesses Redis server, and inquires
Related data includes: the instruction that the operation layer triggering client is sent is data query instruction, then operation layer access Redis clothes
Business device, inquires the related data in the Redis server.
Further, operation layer access java server carries out relevant operation and includes:
Trigger data increases instruction, and operation layer accesses java server, and the java server is respectively to server data
The increase that library and Redis server carry out identical data stores;
Trigger data deletes instruction, and operation layer accesses java server, and the java server is respectively to server data
Library and Redis server carry out the deletion of identical data;
Trigger data alteration command, operation layer access java server, and the java server is respectively to server data
The covering that library and Redis server carry out identical data is changed.
A kind of data calling system based on Redis, for executing data calling method as described above, comprising:
Business stratum server, for issuing data query instruction or data modification instruction;
Server database, for storing data;
Redis server stores identical data with the server database, for receiving the data query instruction
And make corresponding reaction;
Java server receives the data modification instruction, and identical as Redis server carry out to server database
Data change.
Further, the business stratum server includes PHP service server and/or .NET service server.
Further, the java server comprises the following modules:
Data augmenting module receives the data modification instruction, increases phase into server database and Redis server
Corresponding data;
Data change module, receive the data modification instruction, change phase into server database and Redis server
Corresponding data;
Data removing module receives the data modification instruction, deletes phase into server database and Redis server
Corresponding data.
The invention has the benefit that each operation layer of database server inquires user data requests, it is only necessary to from
Data are read in Redis server, to reduce the pressure of database, shortens the data response time in called data library, increases
The data call speed of adding system.It needs to increase newly, modify and Redis server and database can be carried out when deleting data
Double write operations, by the way that Redis server to be used as to the advance data library of substitution caching, it and Sqlserve, Mysql database are
And deposit, and data are consistent.If the failure of Redis server leads to loss of data, at this moment need database
In total data or partial data read out and re-write Redis server, realize the data of Redis and database
Consistency.
Detailed description of the invention
Below according to attached drawing, invention is further described in detail.
Fig. 1 is the structural block diagram of the data calling system described in the embodiment of the present invention based on Redis, the solid arrow in figure
For write-in data manipulation can be achieved, the dotted arrow in figure is that read data operation can be achieved.
Specific embodiment
A kind of data calling method based on Redis described in the embodiment of the present invention includes:
After the operation layer receives the instruction of client, trigger data inquiry instruction or data modification instruction, operation layer
Including PHP operation layer and .NET operation layer, website item is not limited to a kind of development language and architecture environment, therefore at one
It there are many operation layer of development language and can be deposited in large project, but the data source of these operation layers access is consistent, PHP industry
Business layer is identical as the function of .NET operation layer, there is operation that is newly-increased, deleting, modify, inquire.
User logs in platform publication instruction, and operation layer, which receives, to be instructed and trigger data inquiry instruction or data modification is selected to refer to
It enables, wherein data modification instruction includes that data increase instruction, data delete instruction or data alteration command.
If operation layer trigger data inquiry instruction, operation layer accesses Redis server, and inquires in Redis server
The data for needing to inquire.
If operation layer trigger data increases instruction, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data increase, and the data of newly-built data or supplement are increased
It is stored into server database and Redis server.
If operation layer trigger data deletes instruction, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data deletion, will delete in server database and Redis server
Identical data.
If operation layer trigger data deletes instruction, operation layer accesses java server, and the java server is right respectively
Server database and Redis server carry out identical data change, will replace in server database and Redis server
Or the identical data of modification.
As shown in Figure 1, a kind of data calling system based on Redis includes:
Business stratum server 1, the business stratum server 1 include PHP service server and/or .NET service server,
For issuing data query instruction or data alteration command;
Server database 4, for storing data;
Redis server 2 stores identical data with the server database 4, refers to for receiving the data query
It enables and makes corresponding reaction;
Java server 3 receives the data modification instruction, and carries out to server database 4 and Redis server 2
Identical data change.
The java server 3 comprises the following modules:
Data augmenting module receives the data sent of business stratum server and increases instruction, to server database 4 with
It is created in Redis server 2 and increases or supplement identical data;
Data change module, receive the data sent of business stratum server and increase instruction, to server database 4 with
The identical data of modifications or substitutions in Redis server 2;
Data removing module receives the data sent of business stratum server and increases instruction, to server database 4 with
Identical data are deleted in Redis server 2.
In work, instruction that operation layer largely triggers is data query instruction, each operation layer (.net operation layer or
Php operation layer) inquiry user data requests only from Redis server inquire data, due to Redis server and server count
It is synchronized according to the data in library are unified, therefore will not be directly from data base querying data, and number will not be obtained by java server
According to alleviate database pressure and java server pressure.Only when the instruction of operation layer triggering is data modification instruction
Afterwards, when being increased newly, being modified and deleted data, java server just can to Redis server and server database into
The double write operations of row, this double write operation process is completed in java server, to realize Redis server and server database
Data consistency, in the whole process Redis server can be counted as substitution caching with server database keep
Data synchronize consistent advance data library.The present invention makes the Member application group in java server by 9 original servers
4 servers are reduced to, every server occupies average connection number 16000 times by the original same time and is down to 3800 times.Number
10%-40% is also dropped to by 60%-90% before according to the peak period cpu utilization rate in library.
The present invention is not limited to above-mentioned preferred forms, anyone can show that other are various under the inspiration of the present invention
The product of form, however, make any variation in its shape or structure, it is all that there is skill identical or similar to the present application
Art scheme, is within the scope of the present invention.
Claims (7)
1. a kind of data calling method based on Redis characterized by comprising
Operation layer trigger data inquiry instruction or data modification instruction;
If operation layer trigger data inquiry instruction, operation layer accesses Redis server, and query-relevant data;
If the modification instruction of operation layer trigger data, operation layer access java server, the java server is respectively to service
Device database and Redis server carry out identical data change;
If the operation layer trigger data modification instruction, operation layer access java server includes: the operation layer triggering visitor
The instruction that family end is sent is that data increase instruction, data delete instruction or data alteration command, relevant data are increased,
It deletes or changes, then operation layer access java server carries out relevant operation;
If operation layer trigger data increases instruction, operation layer accesses java server, and the java server is respectively to service
Device database and Redis server carry out identical data increase, and the data of newly-built data or supplement are increased to clothes
It is stored in business device database and Redis server;
If operation layer trigger data deletes instruction, operation layer accesses java server, and the java server is respectively to service
Device database and Redis server carry out identical data deletion, identical by deleting in server database and Redis server
Data;
If operation layer trigger data alteration command, operation layer accesses java server, and the java server is respectively to service
Device database and Redis server carry out identical data change, will replace or repair in server database and Redis server
Change identical data.
2. the data calling method according to claim 1 based on Redis, which is characterized in that the operation layer triggers number
It include: trigger data inquiry instruction after the instruction that the operation layer receives client according to inquiry instruction or data modification instruction
Or data modification instruction.
3. the data calling method according to claim 1 based on Redis, which is characterized in that if the operation layer triggers
Data query instruction, then operation layer accesses Redis server, and query-relevant data includes: the operation layer triggering client
The instruction sent is data query instruction, then operation layer accesses Redis server, inquires the correlation in the Redis server
Data.
4. the data calling method according to claim 1 based on Redis, which is characterized in that the operation layer access
Java server carries out relevant operation
Trigger data increase instruction, operation layer access java server, the java server respectively to server database with
Redis server carries out the increase storage of identical data;
Trigger data delete instruction, operation layer access java server, the java server respectively to server database with
The deletion of Redis server progress identical data;
Trigger data alteration command, operation layer access java server, the java server respectively to server database with
Redis server carries out the covering change of identical data.
5. a kind of data calling system based on Redis, for executing the data call as described in any in Claims 1-4
Method characterized by comprising
Business stratum server, for issuing data query instruction or data modification instruction;
Server database, for storing data;
Redis server stores identical data with the server database, instructs and does for receiving the data query
Corresponding reaction out;
Java server receives the data modification instruction, and carries out identical number to server database and Redis server
According to change;
The data of the server database and the Redis server are unified synchronous, only when operation layer sets out data modification
After instruction, the java server just can carry out double write operations to the Redis server and the server database.
6. the data calling system according to claim 5 based on Redis, it is characterised in that: the business stratum server
Including PHP service server and/or .NET service server.
7. the data calling system according to claim 5 based on Redis, which is characterized in that the java server packet
It includes with lower module:
Data augmenting module receives the data modification instruction, increases into server database and Redis server corresponding
Data;
Data change module, receive the data modification instruction, change into server database and Redis server corresponding
Data;
Data removing module receives the data modification instruction, deletes into server database and Redis server corresponding
Data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610056012.5A CN105718592B (en) | 2016-01-27 | 2016-01-27 | Data calling method and its system based on Redis |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610056012.5A CN105718592B (en) | 2016-01-27 | 2016-01-27 | Data calling method and its system based on Redis |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105718592A CN105718592A (en) | 2016-06-29 |
CN105718592B true CN105718592B (en) | 2019-04-23 |
Family
ID=56155160
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610056012.5A Active CN105718592B (en) | 2016-01-27 | 2016-01-27 | Data calling method and its system based on Redis |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105718592B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110784368A (en) * | 2019-09-09 | 2020-02-11 | 无锡江南计算技术研究所 | Memcached-based data acquisition method and system |
CN112543111B (en) * | 2019-09-23 | 2023-07-04 | 北京轻享科技有限公司 | Service monitoring method, monitoring center and service monitoring system |
CN111026962B (en) * | 2019-12-03 | 2023-09-22 | 泰康保险集团股份有限公司 | Hierarchical relation query response time reduction method, server and user front end |
CN111026584A (en) * | 2019-12-23 | 2020-04-17 | 重庆紫光华山智安科技有限公司 | Device, method and equipment for solving key value database file damage |
CN112910980B (en) * | 2021-01-27 | 2022-11-15 | 中国银联股份有限公司 | Database access system and method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104965850A (en) * | 2015-04-29 | 2015-10-07 | 云南电网有限责任公司 | Database high-available implementation method based on open source technology |
CN104991853A (en) * | 2015-07-22 | 2015-10-21 | 北京京东尚科信息技术有限公司 | Method and apparatus for outputting early warning information |
CN104991818A (en) * | 2015-06-30 | 2015-10-21 | 北京奇虎科技有限公司 | Data processing method, server and system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130104772A1 (en) * | 2005-08-25 | 2013-05-02 | The University Of Wyoming Research Corporation D/B/A Western Research Institute | Methods for Changing Stability of Water and Oil Emulsions |
US20150019353A1 (en) * | 2012-02-06 | 2015-01-15 | Adstruc, Inc. | System for managing the utilization of a plurality of outdoor advertising units |
-
2016
- 2016-01-27 CN CN201610056012.5A patent/CN105718592B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104965850A (en) * | 2015-04-29 | 2015-10-07 | 云南电网有限责任公司 | Database high-available implementation method based on open source technology |
CN104991818A (en) * | 2015-06-30 | 2015-10-21 | 北京奇虎科技有限公司 | Data processing method, server and system |
CN104991853A (en) * | 2015-07-22 | 2015-10-21 | 北京京东尚科信息技术有限公司 | Method and apparatus for outputting early warning information |
Also Published As
Publication number | Publication date |
---|---|
CN105718592A (en) | 2016-06-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105718592B (en) | Data calling method and its system based on Redis | |
US11882054B2 (en) | Terminating data server nodes | |
US11157445B2 (en) | Indexing implementing method and system in file storage | |
CN104699541B (en) | Method, apparatus, data transfer components and the system of synchrodata | |
CN105447014B (en) | Metadata management method based on binlog and for providing the method and device of metadata | |
CN104050250B (en) | A kind of distributed key-value querying method and query engine system | |
CN102999522B (en) | A kind of date storage method and device | |
CN104731956A (en) | Method and system for synchronizing data and related database | |
CN104572689A (en) | Data synchronizing method, device and system | |
CN104317957B (en) | A kind of open platform of report form processing, system and report processing method | |
WO2021073510A1 (en) | Statistical method and device for database | |
CN105069149A (en) | Structured line data-oriented distributed parallel data importing method | |
CN105468720A (en) | Method for integrating distributed data processing systems, corresponding systems and data processing method | |
CN107423404B (en) | Flow instance data synchronous processing method and device | |
CN108491332A (en) | A kind of real-time buffering updating method and system based on Redis | |
WO2018035799A1 (en) | Data query method, application and database servers, middleware, and system | |
CN104657143A (en) | High-performance data caching method | |
US20200242118A1 (en) | Managing persistent database result sets | |
CN105608126A (en) | Method and apparatus for establishing secondary indexes for massive databases | |
CN106339408A (en) | Data synchronization method, data synchronization device and server | |
CN109144893A (en) | A kind of method and apparatus with Nonvolatile memory reservoir process interaction | |
CN112507020A (en) | Data synchronization method and device, computer equipment and storage medium | |
CN109582658A (en) | A kind of distributed file system realizes the method and device of data consistency | |
CN102982171A (en) | Database synchronization method | |
Cruz et al. | A scalable file based data store for forensic analysis |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB03 | Change of inventor or designer information |
Inventor after: Zhang Tongming Inventor after: Liu He Inventor before: Zhang Yuanda |
|
COR | Change of bibliographic data | ||
GR01 | Patent grant | ||
GR01 | Patent grant |