Ending Words From Learning Redis to Being Enlightened by Redis

Ending Words From Learning Redis to Being Enlightened by Redis #

It is already the end of the course, and it’s time to say goodbye.

Over the past four months, we have mastered various key technologies and core knowledge of Redis. At the end of the course, I would like to switch perspectives with you: if we have been learning Redis itself up until now, let’s see what we can learn from Redis today.

Before discussing this perspective, I would like to ask you a question: have you ever wondered what learning technology actually means?

Most people would think that it means understanding specific principles, engaging in practical applications, and learning from others’ experiences to solve problems in our actual work. For example, when learning Redis, we use it in business scenarios such as caching, distributed locks, and data clusters. This requires us to master key practical techniques, common problems, and their solutions, which is also the focus of our course.

However, I believe that this is only the first level of learning technology. Once our understanding and accumulation of technology reach a certain level, we should “pay tribute to technology”. Paying tribute means learning from technology to solve the problems we encounter in life. This is the second level.

The underlying principle behind this is actually very simple: every excellent technology is the result of the crystallization of some essential ideas, and learning from technology means learning from these excellent ideas.

I have always advocated a concept: an excellent computer system design itself contains a lot of philosophical wisdom. Therefore, let’s take another step forward and summarize some work methods from the design of Redis.

Learn from Redis’s Single Thread Mode and Focus on Important Matters #

The biggest advantage of Redis is its speed, which was set as the goal from the beginning of its design. Similarly, becoming an expert in a certain technology or a master in a specific field is usually a goal we set for ourselves. The key mechanism that helps Redis achieve its goal of being fast is its single thread architecture. The single thread architecture provides us with a good way of doing things: focus on one thing, do it with great concentration, and strive for excellence, which is the core element of achieving goals.

In Redis’ design, the main thread is responsible for processing requests and is designed to complete them as quickly as possible. For other things that may hinder this goal (such as generating snapshots, deleting, and AOF rewriting), Redis finds ways to handle them asynchronously or in the background. When I introduced version 6.0 to you, I also mentioned that Redis intentionally separated the processing of network read/write and packet parsing from the main thread, so that the main thread can be more “focused” on request processing.

I believe the “single thread” mindset is something that is worth pondering over. After setting goals, we can also adopt the “single thread mode” and concentrate our energy on the core objective, giving our best to accomplish it, while also organizing our time rationally and actively avoiding interfering factors.

When we immerse ourselves in one thing and strive for excellence, becoming an expert is not far away.

Of course, when we talk about achieving excellence in one thing, it doesn’t mean we should focus only on one knowledge point or one specific technology. It means we should strive for excellence in a specific technical domain.

For example, Redis is a key-value database, so we can set a goal for ourselves: becoming proficient in major key-value databases. Therefore, we need to master existing technologies solidly and continuously keep an eye on the latest technological developments. This leads to the second point in what we can learn from Redis: having scalability.

Learning Scalability from Redis Cluster #

When using Redis, we may encounter situations where the data volume increases and the load pressure grows. However, Redis can easily handle these situations thanks to its scalable cluster mechanism. As the data capacity increases, Redis can add instances to achieve capacity expansion; when the read pressure increases, Redis can add read replicas to share the load.

Redis keeps introducing new features, and new storage hardware is also rapidly developing. These advancements in technology may likely change the key mechanisms and usage methods of Redis. Therefore, if we want to cope with complex scenario changes, we should also possess scalability like a Redis cluster. After all, technology iterates so quickly, and various requirements are becoming more and more complex. If we only focus on learning existing technical knowledge or studying hard based on the current scenario, we may easily be left behind by the fast-paced era.

To become a true tech expert, we need to keep up with the pace of technological development and have the ability to solve various sudden problems.

How to develop scalability? It’s quite simple - record fresh things anytime and anywhere. Here, “fresh” does not necessarily mean the latest content but refers to the content you are unfamiliar with. The larger your scope of understanding becomes, the stronger your scalability will naturally be.

Speaking of this, I want to share a little habit of mine with you. I have a small notebook that I carry around with me. Whenever I read articles, attend technical conferences, or chat with others, if I learn something new, I quickly note it down. Later, I specifically find time to search for related information and occasionally review what I have written. This habit allows me to grasp the latest technology in a timely manner and easily cope with various changes.

As technology professionals, we usually prefer to be down-to-earth and do things well. However, don’t forget that while being down-to-earth, we also need to “look up at the stars”. Turn learning into a habit and transform from passive learning to proactive learning in order to enhance your scalability. This transformation can definitely make your technical abilities far surpass others.

Of course, there are many excellent design ideas from Redis that you can summarize on your own. I also want to discuss with you how we can truly apply the ideas we learned from Redis in practice.

In fact, the principle is quite simple: “Start by completing a task.” In the process of doing our best to accomplish something, we hone our focus and exercise our scalability.

Starting from accomplishing a task #

We often say, “A journey of a thousand miles begins with a single step.” In this sentence, I interpret “a single step” as accomplishing a task. We always have many things to do, but often, what truly improves us is completing those tasks.

For me, creating this course was a completely new experience. Throughout the process, from structuring the content, confirming specific details, to working late into the night to ensure timely updates, I felt a lot of pressure. However, looking back at the past six months now, I feel very gratified because I accomplished this task, and there were many additional gains.

In fact, the size of a task doesn’t matter when it comes to accomplishing it. It can be small, such as finishing two lessons, or it can be big, like spending three months reading the Redis source code.

The most important thing is that once we set a goal, we must strive to accomplish it. We will inevitably encounter various difficulties, such as having other work arrangements on short notice and not being able to find time, or encountering content that is difficult to understand and learn. But it’s like climbing a mountain – when we reach the halfway point, we are often the most tired.

Let me share my own little story with you.

When I was reading the source code of Redis data structures, I found it very difficult. Redis has many data types, and each data type has different underlying implementation structures. Some data structures are inherently complex in their design.

At that time, I almost decided to give up, but then I held my breath and said that I had to accomplish this task. After calming down, I further broke down the goal and aimed to master one data structure per week. First, I would understand the design principles of the structure and deduce it on a blank piece of paper. Then, I would read through the code of each structure and write the key parts myself. After all, when we read code, it’s easy to skip over certain parts without much thought. Only when we write it line by line ourselves can we think more carefully and understand more thoroughly.

After conquering the “data structure” challenge, I found that the rest became much easier. Even when encountering other difficulties, I was no longer afraid.

Because each time we accomplish a task, it enhances our confidence and improves our abilities. As we accomplish more and more tasks, we get closer and closer to the mountaintop. At that point, you will truly experience the feeling described by the phrase, “Looking down upon all other mountains from the top.”

Well, at this point, I really have to say goodbye. “Here we part ways; a lone journey of a thousand miles lies ahead.” These are the words Li Bai spoke when bidding farewell to a friend, expressing his sorrow. Communication and transportation were not as convenient in ancient times, so after parting, friends had to struggle on their own.

But we are different. Although the course has ended, this content will continue to exist, and you can review it from time to time. If you encounter any issues, please feel free to continue leaving me messages. Finally, I have prepared an end-of-course questionnaire for you. I hope you can take one minute to fill it out and share your thoughts and feedback on the course. By doing so, you will have a chance to win a “Redis Quick Command Oversized Mouse Pad” and a Geek Time course subscription worth 99 RMB. I look forward to hearing your candid opinions.