Briefly describe the difference between Redis and MySQL

Briefly describe the difference between Redis and MySQL

We know that MySQL is a persistent storage, stored in the disk, and retrieval will involve certain IO. In order to solve this bottleneck, cache appeared, such as the most commonly used memcached (mc for short). First, the user accesses mc. If there is no hit, he accesses mysql. Then, like memory and hard disk, the data is copied to part of mc.

Both redis and MC are caches, and both run in memory, which greatly improves the access speed of high-data-volume web access. However, mc only provides simple data structures, such as string storage; redis provides a large number of data structures, such as string, list, set, hashset, sorted set, etc., which makes it much more convenient for users. After all, it encapsulates a layer of practical functions and achieves the same effect. Of course, use redis and gradually abandon mc.

The relationship between memory and hard disk is that the hard disk stores the main data for persistent storage, while the memory is the data that is currently running. The CPU accesses the memory instead of the disk, which greatly improves the running speed. Of course, this is based on the principle of localized access of the program.

Reasoning about redis+mysql, it is a mapping of memory+disk relationship. MySQL is placed on disk and redis is placed in memory. In this way, the web application only accesses redis each time, and only accesses Mysql if the data is not found.

However, the usage of redis+mysql and memory+disk is better to be different.

The former is an in-memory database, and the data is stored in memory, so of course it is fast.

The latter is a relational database with powerful functions but slow data access.

Like memcache, mongoDB, Redis, all belong to the No sql series.

They are not of the same type and their application scenarios are also different. It depends on your needs.

Summarize

The above is all about the brief description of the differences between Redis and MySQL in this article. Interested friends can refer to: Analysis of the execution order of sql and MySQL statements, several important MySQL variables, and a brief analysis of the differences between FIND_IN_SET() and IN in Mysql. If there are any deficiencies, please leave a message to correct them. I hope this helps you all.

You may also be interested in:
  • Docker + Nodejs + Kafka + Redis + MySQL to build a simple seckill environment
  • PHP's Laravel framework combined with MySQL and Redis database deployment
  • How to migrate a database from MySQL to Redis
  • CentOS installation PHP5.5+Redis+XDebug+Nginx+MySQL full record
  • How to connect Python to MySQL, MongoDB, Redis, memcache and other databases

<<:  Example of how to deploy Spring Boot using Docker

>>:  Use dockercompose to build springboot-mysql-nginx application

Recommend

Color matching techniques and effect display for beauty and styling websites

Color is one of the most important elements for a...

Solution to the problem that the Vue page image does not display

When making a new version of the configuration in...

MYSQL's 10 classic optimization cases and scenarios

Table of contents 1. General steps for SQL optimi...

Pure CSS to achieve cool neon light effect (with demo)

I have recently been following the CSS Animation ...

Index Skip Scan in MySQL 8.0

Preface MySQL 8.0.13 began to support index skip ...

OpenLayers realizes the method of aggregate display of point feature layers

Table of contents 1. Introduction 2. Aggregation ...

Mysql 5.7.19 free installation version encountered pitfalls (collection)

1. Download the 64-bit zip file from the official...

Detailed tutorial on deploying Apollo custom environment with docker-compose

Table of contents What is the Apollo Configuratio...

Summary of solutions for MySQL not supporting group by

I downloaded and installed the latest version of ...

Modify file permissions (ownership) under Linux

Linux and Unix are multi-user operating systems, ...

CSS3 countdown effect

Achieve results Implementation Code html <div ...

Ubuntu 20.04 sets a static IP address (including different versions)

Because Ubuntu 20.04 manages the network through ...