The project code mentioned in this article has been open source on Github, Github source address is here!
Good day to make an announcement!
Good day
There is a good day in December, 20211202, read from left to right, then read from right to left you will find that it is actually symmetrical, this is the “romance” of programmers, programmers friends also specially chose today to get the certificate.
If you are familiar with the algorithm, you should find that this is the classic algorithm question: “palindrome string”, so the question comes, do you know when the next palindrome string date is? See you in the comments section
Since it’s a good day, we can’t waste it. We have to do something.
Recently my mind is very confused, and I am very busy with my work. I often doubt myself: is what I am doing worthwhile? Does my writing help the reader? Is it easy to understand? What should I write after?
Whenever I want to give up, I always see some friends send some private letters: Lei Xiaoshuai, your technical articles are too useful for me, easy to understand, clear thinking, I read too focused on the car, all missed my stop.
Some of the words may be in jest, but at least they helped and influenced some people, which was a great encouragement to me and gratified me!
If someone still cares, we can’t let them down. Looking back over the past year, AS a tech blogger, I have posted many technical articles:
- The Redis Interview
- Graphical Distribution & Middleware
- Concurrent Programming in Java
- Java Learning Path
- Java eight-part essays
- The Five-Minute Primer Series
- Wuhan Internet
- … A number of hydrological
The production of an article usually goes through the following steps: topic selection, conception, drawing and layout. With a little attention, it can take at least three nights.
How much value would such an article generate? Most people may be like this: I read it and write it well = I have learned it, but I actually forget it when I meet it at work or in an interview. The reason is that I have learned a lot of “points” but cannot connect them into “lines” and “surfaces”, so I cannot apply what I have learned to the project.
The best way is to “project actual combat”, to promote learning. A while ago, I also live in B station (ID: programmer Lei Xiaoshuai, welcome to pay attention to) several times, originally wanted to live with everyone to write a project, but the computer is too card, open live software, my IDE card is not good, had to give up.
Recently I thought about it and realized that there is no point in doing such a business project, just adding, deleting, changing and checking. The real difficulty in an enterprise is “understanding the business”, and the technical difficulties involved are all handled by the infrastructure or middleware team.
Well, in that case, shouldn’t we do what they do? Yes, I had an idea: build an RPC wheel myself.
Why do you need to learn to build wheels
Invest yourself
Some people ask: nowadays, all kinds of useful frameworks are open source, so you can just take them and use them. Isn’t it a waste of time to build one yourself?
It depends on how you look at it. If you look at it from a leadership perspective:
Leader: now the project delivery is so tight, you quickly find an open source project, copy a change, can run it.
Technical brother: I want to write my own framework, performance is definitely better than the open source one.
Leader: You have to deliver the project this Friday. Will you do it yourself? !
Leaders care about your ability to deliver projects quickly and generate value creation quickly.
If you look at it from your own perspective:
Brother with technical aspirations: I have implemented this framework
Leader: Does it work?
Brother with technical pursuit: BY writing this framework, I have learned a lot of knowledge, I have opened source, a lot of star
Leader: The project has been postponed. You don’t need to come tomorrow.
By building one of my own, I learned a lot of things I didn’t know before, and my own technology has been further improved.
Is it a waste of time to build your own wheel?
Don’t be the switch man
A lot of people come into a company and get stuck in a complex business scenario where they spend four days a week talking about the business and the other day writing code.
Think back, what code are we writing? Most of them are writing CRUD, if else for, tweaking open source JAR package interfaces.
- He thought he was writing high-concurrency, high-technology code, but he was a CRUD boy.
- I think I know all kinds of middleware, but I just learned how to call their interfaces. I’m a packet shifter.
I’m not trying to denigrate people who write business code, but I’m trying to get people to misunderstand me.
If you want to grow further in technology, you have to go beyond CRUD boy, switch man, and get to the bottom of the framework, knowing the source code and principles.
What can you learn by building a wheel?
Knock on the blackboard: First of all, I want to emphasize that the purpose of building wheels is not to use them in production, but to facilitate your learning by building wheels so that you can connect the dots.
This time I’m going to take you through an RPC framework from scratch, if you don’t already know what RPC is? I suggest you check it out first.
Currently, common RPC frameworks include:
- Ali Dubbo
- Google gRPC
- Apache Thrift
- Weibo Montan
- SpringCloud (similar)
- … Etc.
We will refer to Dubbo framework to write a mini version of RPC framework to achieve the most basic and core functions.
If you study hard, you can master the following techniques:
- The bottom network layer is based on NetTY. There is no problem after learning NetTY.
- Using custom annotations, you can understand the basic operation mechanism of annotations after learning;
- Service registration based on ZooKeeper, learn zK entry no problem;
- It uses reflection;
- Dynamic proxy technology will be used;
- How to define a xxX-spring-boot-starter, understand spring Boot automatic configuration mechanism;
- Learn how to customize configuration items and bind them to beans;
- Learn to listen for events in the Spring container;
- … , etc.
Have a little heart? !
Next step
This article should be regarded as an introduction and foreword, mainly to boost your confidence that there is definitely something to be learned.
In the next step, I will introduce the source code of RPC framework and the technical points involved in detail in several articles. I will also put the source code of the framework on Github for everyone to download and study, teach package meeting, and then interview with this out to brag B no problem at all.
The framework project code is now open source on Github:
Source code here! Github open source project, a RPC framework from scratch
If you are particularly interested, you can also open a live broadcast to explain it later. (ID of station B: Programmer Lei Xiaoshuai, welcome to pay attention to it in advance)
Ok, I am Lei xiaoshuai, the above is all the content of today, if you are interested in building a wheel, three support it, give some confidence ~
Knock on the blackboard: This is a series of articles, you are welcome to keep watching!