current location:Home > Technical Articles > Database > Redis

  • Redis cluster instance analysis
    Redis cluster instance analysis
    1. WhyK8s1. Resource isolation. The current RedisCluster is deployed on a physical machine cluster. In order to improve resource utilization and save costs, Redis clusters of multiple business lines are mixed. Because there is no CPU resource isolation, it often happens that the CPU usage of a Redis node is too high, causing other Redis cluster nodes to compete for CPU resources, causing delay jitter. Because different clusters are mixed, such problems are difficult to locate quickly and affect operation and maintenance efficiency. K8s containerized deployment can specify CPUrequest and CPUlimit, which improves resource utilization and avoids resource contention. 2. Automated deployment The current deployment process of RedisCluster on physical machines is very cumbersome.
    Redis 1966 2023-06-04 08:21:01
  • How to configure sequence and deserialization of RedisTemplate in Redis
    How to configure sequence and deserialization of RedisTemplate in Redis
    RedisTemplate configuration sequence and deserialization For redis operations, springboot has a good encapsulation, that is springdataredis. A highly encapsulated RedisTemplate class is provided to perform a series of redis operations, and the connection pool is automatically managed; at the same time, the transaction encapsulation operation is handed over to the container for processing. For the "serialization and deserialization" of data, multiple strategies (RedisSerializer) are provided. The default is to use JdkSerializationRedisSerializer, as well as StringRedisSerializer and JacksonJsonR.
    Redis 1828 2023-06-03 21:25:08
  • What are the methods of using Redis integer collection?
    What are the methods of using Redis integer collection?
    1. Overview of Sets For sets, I believe everyone is familiar with STL's set. Its underlying implementation is a red-black tree. Regardless of insertion, deletion, or search, the time complexity is O(logn). Of course, if a hash table is used to implement a collection, insertion, deletion, and search can all reach O(1). So why does the collection use red-black trees and not hash tables? I think the biggest possibility is based on the characteristics of the set itself. The set has its own unique operations: intersection, union, and difference. These three operations are all O(n) for hash tables. Based on this, it is more appropriate to use an ordered red-black tree than an unordered hash table. 2. Redis integer set (intset) The integer set we are going to talk about today, also called intset, is Redis
    Redis 1189 2023-06-03 21:18:54
  • What is the command to check the redis version in Linux?
    What is the command to check the redis version in Linux?
    Two commands to check the redis version on Linux 1, redis-server–version and redis-server-v2, redis-cli–version and redis-cli-v
    Redis 3546 2023-06-03 20:58:01
  • How does redis realize real-time page updates and automatic online updates?
    How does redis realize real-time page updates and automatic online updates?
    Requirement description: Some pages need to be configured with advertisements or event promotion images. Advertisements or activities need to be able to go online and offline at any time, automatically go offline after expiration, and automatically go online when the time comes. For example: the current time is 2019-2-2216:16:13. You need to configure the reward collection activity on the payment completion page. The activity must be online on time at 2019-3-1000:00:00 and end at 2019-3-3023:59:59. Activity. So the desired effect is that after configuring the activity at any time before the activity goes online, the page will automatically go online when the time comes. There may also be multiple other activities or advertisements. The number of advertisements on each page is variable, and the online and offline times may be different for different pages. Other pages also need to implement such functions, and the activities between pages are not necessarily the same. demand points
    Redis 1505 2023-06-03 20:56:17
  • Redis cache example code analysis
    Redis cache example code analysis
    1. Introduction 1. Scenario Since the data dictionary does not change very frequently, and the system accesses the data dictionary more frequently, it is necessary for us to store the data in the data dictionary in the cache to reduce database pressure and improve access speed. Here, we use Redis as the distributed cache middleware of the system. 2. RedisTemplate In the SpringBoot project, SpringDataRedis is integrated by default. SpringDataRedis provides a very convenient operation template for Redis, RedisTemplate, and can automatically manage the connection pool. 2. Introduce Redis1 and integrate the Redisservice-base module into the project.
    Redis 1661 2023-06-03 20:37:56
  • How to solve Redis buffer overflow
    How to solve Redis buffer overflow
    Buffer is a part of memory space. In other words, a certain amount of storage space is reserved in the memory space. These storage spaces are used to buffer input or output data. This reserved space is called a buffer. 1. Impact of Redis buffer overflow In Redis, there are three main scenarios where the concept of buffer is used. When communicating between the client and the server, it is used to temporarily store the command data sent by the client, or the data results returned by the server to the client. When synchronizing data between the master and slave nodes, Redis uses the buffer to temporarily store When the write commands and data received by the master node are persisted in AOF by Redis, Redis also uses the concept of buffer to avoid frequent disk writes.
    Redis 1340 2023-06-03 20:13:41
  • How to correctly set the configuration parameters of mongodb and redis development environment and production environment
    How to correctly set the configuration parameters of mongodb and redis development environment and production environment
    When we write code, we usually develop it on our own computer first, and then deploy the code to the server. If a piece of code involves reading and writing a database, or accessing some other online service interfaces, then during development, in order not to affect the online environment, we usually separate the database in the test environment and the database in the online environment. For example, our program needs to access MongoDB and Redis, so in the code, we may write like this: importpymongoimportredishandler=pymongo.MongoClient('mongodb://username:password@127.0.0.
    Redis 1674 2023-06-03 20:04:15
  • How to analyze Redis knowledge points
    How to analyze Redis knowledge points
    It is a data structure rather than a type. Many articles will say that redis supports 5 commonly used data types. This is actually a big ambiguity. All binary data stored in redis is actually a byte array (byte[]). These byte data have no data type. They can only be turned into a string, integer or object after decoding them in a reasonable format. , only then does it have a data type. This must be remembered. So anything that can be converted into a byte array (byte[]) can be stored in redis. No matter if it is a string, number, object, picture, sound, video, or file, just change it into a byte array. Therefore, String in redis does not refer to a string, it actually means
    Redis 1281 2023-06-03 20:02:11
  • What is the installation method of Redis6 under Centos7?
    What is the installation method of Redis6 under Centos7?
    Installation environment: centos7.9, redis6.0.8 nanny-level installation tutorial 1. Download the Redis compressed package from the Internet wgethttp://download.redis.io/releases/redis-6.0.8.tar.gz2. Unzip tar-xfredis-6.0 .8.tar.gz3. Enter the decompressed folder cdredis-6.0.84 and compile redismake#compile redis. If you find that the final compilation fails, check the gcc version and execute the following commands in order to upgrade the gcc version yum-yinstallcentos-release-
    Redis 2306 2023-06-03 19:19:25
  • Springboot integrated redis instance analysis
    Springboot integrated redis instance analysis
    Import the redispom file org.springframework.bootspring-boot-starter-data-redis and write the redis configuration spring:redis:password:port:6379host:localhostdatabase:0jedis:pool:##The maximum number of connections in the connection pool (use a negative value to indicate no limit) #spring.redis.pool.max-active=8max-active:8##The maximum blocking waiting time of the connection pool (use a negative value to indicate no limit) #spring.redis.pool.
    Redis 1063 2023-06-03 19:07:02
  • How Redis distributed lock prevents cache breakdown
    How Redis distributed lock prevents cache breakdown
    The difference between cache penetration and cache penetration is that cache penetration refers to hot data that is not in the cache but exists in the database. For example: hot news on the homepage, hot data with a very large number of concurrent visits, if the cache expires and becomes invalid, the server will query the DB. At this time, if a large number of concurrent queries are made to the DB, the DB may be overwhelmed instantly. I drew a simple diagram, as shown below: Solution: DB query plus distributed lock. Before solving the problem without locking, let's take a look at the code and operation status of the unprocessed code. The product details query code based on the product ID clears the Redis cache, and opens 5 threads for concurrent access testing. The test code is as follows: We expect that the DB will only be queried once, and the next 4 queries will be fetched from the Redis cache, but the result is:
    Redis 1797 2023-06-03 19:04:37
  • How to use redis+python as a message queue
    How to use redis+python as a message queue
    1. Use the List type of redis combined with lpush and brpop to implement the introduction. First, the List of redis is equivalent to a queue, which can implement the first-in-first-out rule. brpop is used because when there is nothing in the queue, it will block until there is something in the queue that can be popped. Element or wait timeout simulation problem: too many accesses, the server processing speed is too slow, if the server feedback every time the user waits, the time is too long, the http connection times out, and a server error occurs. Simulation implementation process: There is a client that continuously puts things (data) into the queue, using multi-threading to simulate a large number of user access situations. There is a server that continuously takes out prints from the queue, and sets the redis sleep time of 2 seconds for each print time. Lis
    Redis 2080 2023-06-03 18:24:01
  • How to implement redis distributed lock in python
    How to implement redis distributed lock in python
    1importtime2importredis3fromredis.exceptionsimportWatchError456classRedisUtil():7def__init__(self):8self.redis=redis.Redis(host="redis account url",9port=6379,10password="your redis password",11decode_responses=True)12self.online_set_name="pa
    Redis 1697 2023-06-03 18:22:36
  • How SpringBoot uses AOP+Redis to prevent repeated submission of forms
    How SpringBoot uses AOP+Redis to prevent repeated submission of forms
    Configure Redis1. Add Redis dependency org.springframework.bootspring-boot-starter-data-redis2. Add redis configuration information redis:host:127.0.0.1port:6379database:0password: #Connection timeout timeout:10s Configure AOP1. Custom annotations /***Annotations to prevent repeated submission of forms*/@Target(ElementType.METHOD)//The annotation targets the method @Retention(RetentionPolicy.RUNTI
    Redis 1277 2023-06-03 18:10:04

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28