I found some information and looked at it. My learning experience is as follows: 1Mysql updates RedisMysql updates Redis and uses memcache to communicate with mysql. Every update operation using mysqludf triggers the update redis operation. When there is a high concurrency, mysql is under great pressure, and each table needs to be added, deleted, modified, and triggered, and the Redis server is not easy to replace (do not know if there is any way ). 2R
I found some information and looked at it. Learning Experience: 1. Mysql updates Redis and uses memcache to communicate with mysql. With mysql udf, every update operation triggers the redis update operation. When there is a high concurrency, mysql is under great pressure, and each table needs to be added, deleted, modified, and triggered, and the Redis server is not easy to replace (do not know if there is any way ). 2 R
I found some information and looked at it. The learning experience is as follows:
1. Mysql updates Redis
Mysql updates Redis by referring to memcache for communication with mysql. Every update operation using mysql udf triggers the redis update operation. When there is a high concurrency, mysql is under great pressure, and each table needs to be added, deleted, modified, and triggered, and the Redis server is not easy to replace (do not know if there is any way ).
2 Redis updates Mysql
The simplest is to read redis-> write mysql. But in high concurrency, This is not suitable. Therefore, we consider using message queue to update Mysql at regular intervals.
However, when the primary key in the data is auto-increment, the current idea is as follows:
First, Redis uses tempId as the key, id is empty, and data is overwritten to the cache through mysql udf, for example, clearing the cache temporary data.
Second, the redis key value uses the uuid field instead of the Id, and then synchronizes the redis cache id through the mysql udf.
Third, Redis reads the latest auto-incrementing key Id value from the Mysql table, and Redis transmits the id.
When using Redis to update Mysql, you must pay attention to the positioning of Redis in the system. When using it as a cache server, you must plan the data to be stored and how long it will take.