Introduction of Redis1--redis

Source: Internet
Author: User
Tags connection pooling

(1) The disadvantage of persistent database
In the process of development, the relational database we use is MySQL, Oracle, SQL Server, etc.
Data is usually linked to a database by a Web-provided database driver to make a search for additional deletions.

So where does the data for our daily database be stored? Let's take MySQL for example.
Open the Data folder in the folder directory where MySQL is located, as follows:


We can see that there are all the databases we've created, open one of them, and we'll look at the tables we created,
They exist in the form of files (format frm and IBD):


In other words, the data in the relational data we use every day is stored in the machine where we deploy the database.
OfHDDIn

In general, after the development of our website, on-line, the server read and write efficiency is the speed of the site important conditions,
Of course there is the bandwidth of the server, etc., but these things can be resolved by upgrading the hardware update.
In fact, the efficiency of the site is closely related to the thing is our------database.

The speed of database processing data is closely related to the speed of the website, and data query, processing, etc.
are related to the speed of database processing. One of the options for improving the database's ability to process data is
SQL statement Optimization technology, SQL statement write processing efficiency is high, the database processing power will go up,
and the data processing capacity of the website will be faster.

However, when the site processing and access is very large, the pressure on our database has become larger, the database
Connection pooling, the ability of the database to process data concurrently can be a challenge, once the database is subjected to its maximum
capacity, the data processing efficiency of the website will be greatly compromised. High concurrency processing, load balancing, and distributed databases are now used.
And these technologies cost both manpower and money.

If our site is not a very large site, and want to improve the efficiency of the site, reduce the number of read and write database, we will
Need to introduce caching techniques.

(2) Cache
A cache is a data backup stored in memory, and when the data is not fundamentally changed, we don't let the data query
Database, and go to the memory to fetch data, which greatly reduces the number of times the database reads and writes, and reads the data from memory
Faster than going to database queries, which in turn improves efficiency.

Use caching to mitigate the load on the database:
When developing a website, if some data will not change in a short time, and they will be frequently accessed, in order to
Increase the user's request speed and reduce the load on the website, put this data on a faster read media (or
This data can be obtained with less computational weight, which is called caching of the data.
The media can be file/database/memory. Memory is often used for database caching.

Two forms of caching:
Page caches are often used in CMS (content manage system) memory management systems.
Data caches are often used in page-specific data.

The cache is divided into two types:
Page caching (smarty static technology)


Data caching


(3) About Redis
One of the caching techniques we want to learn is----Redis:
REDIS is an acronym for Remote Dictionary Server (remotely data Services), a memory cache database developed by the Italian Antirez (Salvatore Sanfilippo), which is written in C language, Its data model is key-value.
It supports rich data structures (types), such as string/list/hash/set/sorted Set.

Can be persisted (while running, while the data to the hard disk backup one copy, to prevent the loss of power and other conditions, such as the recovery of power, Redis and then restore the hard disk data into memory), to ensure the security of data.

(4) Redis and memcache comparison
1.Redis not only supports simple k/v types of data, but also provides storage of data structures such as List,set,zset,hash.
2.Redis supports Master-slave (master-slave) mode application
The 3.Redis supports data persistence, which keeps the in-memory data on disk and can be loaded again for use when restarting.
The maximum limit for a single value of 4.Redis is that 1gb,memcached can save only 1MB of data.
Reprint Please specify Source: http://blog.csdn.net/acmman/article/details/53167917

Introduction of Redis1--redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.