4

Hello, I am crooked.

While surfing on github the other day, I found two treasures.

I will not hide it, but I will share it with you.

These two treasures are about arthas and SOFARegistry, both of which are open source projects of Alibaba.

Everyone should be familiar with arthas, and know that it is a Java diagnostic tool created by Ali.

And what is SOFARegistry? I don't seem to have heard of it?

I haven't been in touch with this thing for a long time, but I probably know what it is. I think it is a wheel, but this wheel is quite powerful.

Don't worry, I'll give it to you later.

arthas

I don't remember how many times arthas appeared in my previous articles. Basically, it's all about the actual operation cases of its use or the officially provided hands-on Demo.

Its scope of use is still very wide:

So, what treasures did I find on its github?

It's hidden in the Labels of its issue:

Click on Labels and you will find a label called user-case:

The issues under this label are the first treasure I want to say:

https://github.com/alibaba/arthas/issues?page=1&q=label%3Auser-case

I'll take a screenshot of the content of the first page for you, you can see if there is a desire to click in and see what it is:

For example, let me show you this user-case of ICBC:

https://github.com/lyghzh/pub/blob/main/doc/%E5%B7%A5%E5%95%86%E9%93%B6%E8%A1%8C%E6%89%93%E9%80%A0%E5%9C%A8%E7%BA%BF%E8%AF%8A%E6%96%AD%E5%B9%B3%E5%8F%B0%E7%9A%84%E6%8E%A2%E7%B4%A2%E4%B8%8E%E5%AE%9E%E8%B7%B5.md

I actually always thought that people would think that running Arthas in production is actually a very dangerous thing.

It is a double-edged sword. If you use it well, get off work early, but if you use it poorly, you may have a production accident.

Therefore, the method of giving up food due to choking is adopted, and it is simply not used.

ICBC, as a bank, must have more considerations in this regard.

When it comes to their difficulties in landing, the first problem is "information security", which is their basic red line and the foundation of the bank:

So how does it use Arthas in production?

In this case, the answer to this question is given.

We have designed a set of lightweight architecture, allowing developers to use various online diagnostic capabilities conveniently and intuitively in the way of Web UI. So how do we do it?

Based on the function of Arthas, a web UI page is encapsulated again. The interface hidden behind this page can cut and modify the execution result, process it into json format data and return it to the platform for display.

In addition to introducing the overall architecture, the article also provides the effect of actual use.

For example, the control panel looks familiar:

It is a display page based on the native response of Arthas.

These data on the page are returned by Arthas:

There is also a decompile function:

But I didn't see anything related to hot loading in the article. I guess it must be blocked from the web page for such dangerous functions.

Under this issue, I also found another similar project mentioned by others:

This is a Java application diagnostic tool open sourced by Qunar:

If you don't extend it, you won't be able to learn.

Take this case again:

https://github.com/alibaba/arthas/issues/1892

Then he used Trace to trace the time-consuming method a little bit, and then repaired it little by little.

After four optimizations, the time-consuming of the call link of the same request has been reduced from the initial 343ms to 27ms. Do you think this is not fragrant?

Then, he gave the conclusion, which is the point of this optimization:

You can find that it's not really a big optimization, it's just some of the minutiae things we usually use.

Finally, he also wrote a "highly recommended": a ramble on motion tracking technology.

Well, this is also a website that I bookmarked a long time ago, so I don't hide it anymore. Also took it out and shared it:

https://blog.openresty.com.cn/cn/dynamic-tracing/

The articles in this blog are of very high quality. The owner of the blog is Zhang Yichun, the founder of the open source project OpenResty, as well as the founder and CEO of OpenResty Inc.

Let’s just say, the big guy endorses it and reads it with confidence.

Here I just randomly picked two cases from the first treasure, and you can dig the rest yourself.

SOFARegistry

What is SOFARegistry?

In fact, I understand that it is the wheel of a registry. Or more specifically, Eureka with Ali characteristics.

Here is its github address:

https://github.com/sofastack/sofa-registry

Did you see the sofastack in it?

SOFARegistry is just a chess piece, sofastack is the chessboard.

This is a stack, a technology stack, and an architectural solution in the financial sector.

There are many projects under it. You can see from the name of the main project, what xxxBoot, xxxRPC, xxxRegistry, we can build a complete project with these projects:

The treasure about SOFARegistry is also hidden in its Labels:

https://github.com/sofastack/sofa-registry/issues?q=is%3Aissue+is%3Aopen+label%3Aevent%2Fsource-code-analyze

This Label is called event/source-code-analyze, you don't see a few things, but it is full of source code analysis.

Moreover, it is an official event, and the content of the article will be reviewed by a special person to ensure the accuracy:

This time, a total of 9 source code parsing tasks have been released:

The difficulty of the task is high or low. There are different rewards according to the difficulty of the task:

The opportunity to be a Contributor of the community, or simply a Member, is quite attractive.

For example, let's take a look at this task about inverted data indexing:

https://github.com/sofastack/sofa-registry/issues/202

Its issues description also points out what needs to be written and which part of the code to look at.

The directions are clear.

The format of the final analysis article submission is md format:

We can download it directly for reading.

At that time, it will be a good entry point for students who want to deeply understand SOFARegistry.

Although SOFARegistry knows the wrong person, I still want to write this activity of SOFARegistry, so that more people know that they have such an activity.

Because I think this activity is very good. Source code analysis is a new way for me to participate in the construction of open source projects.

Finally, about these two treasures, tell me what is the truth?

It told me: pay more attention to its Labels when browsing open source projects, maybe there is something good hidden. Anyway, I used to pay little attention to Labels. I always thought that only the project maintainers cared about Labels.

Finally, the article was first published on the public account [why technology], and everyone is welcome to pay attention.


why技术
2.2k 声望6.8k 粉丝