国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
[[443126]]" >[[443126]]
Let me say a few words first
Connecting the past and the future
Choice of programming language
Summary
Dubbo’s victory in the RPC framework
Ending the struggle with thread pools
Paving the way for Dubbo Mesh
Home Backend Development Python Tutorial Why is Dubbo rewritten in Go?

Why is Dubbo rewritten in Go?

Apr 10, 2023 pm 12:51 PM
java go dubbo

Let me say a few words first

I often think about a lot of technical "why questions" when walking , sometimes I will think about a problem for a long time, and it is not finished until I can convince myself of every point of the problem. So I want to record these thoughts and form an article, which can be used as a new series. You may not be able to see the code in these articles, but you can get a glimpse of some problems that are easily overlooked, as well as the deeper "why" of the problem.

Today brings the first article, why does Dubbo need to be rewritten in Go?

Dubbo, which was born in Alibaba and was open sourced in 2011, has gone through 10 years. In 2019, it was rewritten in Go and open sourced. Now two years later, it has developed from the original V1.0.0 version to V3.0.0, with a star count of 3.8K as of now.

A colleague once asked me why an "old" project like Dubbo needs to be rewritten in Go. Does it have any practical significance?

Let me talk about some of my opinions today.

Connecting the past and the future

I think to answer this question well, we have to start with the original intention of Dubbo-go. It introduces itself like this on the github homepage:

The official Chinese translation is

Apache Dubbo Go language implementation, building a bridge between Java and Golang, and interconnecting with the gRPC/Dubbo ecosystem Interoperability leads the Java ecosystem to enjoy the technological dividends of the cloud native era.

Let me translate it in layman terms: In a company or department, some people use the Java version of Dubbo, and some people use Go. The two need to communicate, so Dubbo-Go was created to solve communication problems.

So the first question is, why does a company use Java and then Go?

Choice of programming language

For the choice of programming language, in business In the company, I think the most important thing to consider is efficiency, and other points are secondary. Because the main purpose of a commercial company is to make profits, no matter what language it is, as long as it can get equal benefits at the lowest cost, it is a good language.

Efficiency includes several aspects:

  • Development efficiency. The development efficiency is high, the project can be launched as soon as possible, occupy the market, and can also save labor costs
  • operation efficiency. It has high operating efficiency and can save server costs

Looking at the choices of many domestic commercial companies, such as Alibaba.

In the early days of Alibaba, PHP was used. The main consideration in choosing PHP was development efficiency. However, with the development of business, PHP's performance could not be supported, and it was necessary to change to a language with high operating efficiency.

With high operating efficiency, C/C naturally comes to mind, but the development efficiency of these two languages ??is low. It is necessary to find a balance between development efficiency and operating efficiency, so Alibaba chose Java.

When Alibaba officially answered on Zhihu why they chose Java, they mainly considered the following: performance, simplicity and ease of learning, rich ecology, and active community

Put performance first and make it simple and easy to learn , rich ecology, and active community are actually referred to as development efficiency. It is precisely with these advantages that development efficiency is high.

When Alibaba chose Java, it developed a large number of Java middleware and cultivated a large number of Java talents. Therefore, other companies also referred to Alibaba when selecting technology, resulting in more and more The company chose Java.

The same is true for choosing Go. Some young companies may use scripting languages ????such as PHP and Python in the early stage. After they develop and grow, they have to face the same problem as Alibaba: performance issues.

Go was released in 2012, and everyone had another choice. Go has high performance and is very simple and easy to use. New companies like ByteDance mainly use Go.

So on the whole, it is reasonable to choose Java or Go, and it is reasonable to exist.

Why do some companies choose Java but want to use Go?

  • Compared with Java, Go language has faster startup, faster compilation speed, smaller memory footprint, and is good at high concurrency (coordination) (Processing) characteristics, so companies that already have Java will also consider Go, but currently such companies only account for a small proportion.
  • Some companies do not have a mandatory technology stack, so new departments and new businesses can get rid of the constraints and choose the new language Go for development.

Summary

In summary, it is reasonable to choose Java or Go. It is also reasonable to choose both within a company. Although the proportion is not large, it is still reasonable. There is a need for Java and Go communication.

Dubbo’s victory in the RPC framework

In the early days, the company usually used a single service. When the scale reaches a certain level and the single application cannot support business development, it will choose a microservice architecture. At this time You need a useful RPC framework.

Among the RPC frameworks that can adapt to the Java language, Dubbo is the earliest open source in China and was open sourced in 2011.

Competing products similar to it such as Spring Cloud were open sourced in 2014, Weibo's Motan was open sourced in 2017, cross-language gRPC was open sourced in 2015, and Thrift2 was open sourced in 2007.

Only Thrift is earlier than it, but Thrift is just an RPC framework, while Dubbo includes out-of-the-box service management capabilities, such as service registration and discovery, load balancing, fault tolerance, dynamic configuration, etc.

It can be said that the early Java RPC framework had no choice.

Even in an era when RPC frameworks are flourishing, with so many companies using it and Alibaba’s endorsement, Dubbo still has its place.

Summary

When a company chooses the Java programming language and Dubbo framework (there are still many choices), and later wants to try Go, or some new businesses or new departments want to try Go At that time, they faced a problem, how to communicate with Java's Dubbo in Go.

Since the Dubbo protocol is a private protocol, the cost of re-implementing it in Go is still quite high. So Dubbo-Go came into being. From this perspective, Dubbo-Go still has considerable value in the communication between Java and Go.

Ending the struggle with thread pools

If you use the Dubbo framework, you often need a Dubbo gateway. For more information about the Dubbo gateway, you can refer to my article: "The Evolution of Microservice Gateways".

In this article, I introduce in detail the background, difficulties, selection, design, evolution and pitfall experience of a Dubbo gateway. I spent a lot of time introducing "what I did with the thread pool. "Struggle", in Java, threads are very precious, but if the Dubbo gateway is called synchronously, one request must occupy one thread, which results in concurrency failure, and when the thread pool is full, it will affect other requests.

So the solution is to either isolate the thread pool or change it to asynchronous calling. The isolated thread pool only solves the problem of requests not affecting each other, but the concurrency is still not improved. Changing to asynchronous calling can perfectly solve the problem, but the coding is too complicated.

Go's coroutine can just solve this problem. Go's coroutine is very lightweight and has higher scheduling efficiency, so we can write a very efficient gateway with simple code.

For example, you can intuitively feel that the performance of Nginx is obvious to all, but if you use Java to implement it, you don’t know how many machines you need to stack to achieve the performance of Nginx. However, Baidu uses Go to write the reverse proxy. Using BFE to replace Nginx shows how exaggerated its performance is.

For the introduction and principles of coroutines, you can refer to my article: "Writing Golang for a year, let’s talk about processes, threads and coroutines".

Summary

So on Dubbo gateway, Dubbo-Go also provides a new solution. Tuya Smart already has Dubbo-Go gateway for online use, and it has been open sourced as Dubbo- go-pixiu.

Paving the way for Dubbo Mesh

ServiceMesh has gradually become the next generation microservice architecture. Go is definitely a shining star language on Mesh, whether it is K8S, Docker and other cloud-native foundations. The facilities are all written in Go, and Go’s development speed and coroutine’s high concurrency capabilities make it the preferred language for Mesh.

Based on this, Dubbo's Meshization and Dubbo-Go have also paved the way for it. However, DubboMesh is still in a small-scale stage, and the complete implementation solution is not open source. From this point of view, if someone The company wants to take the road of DubboMesh, and Dubbo-Go may also be one of the points they need to consider.

Summary

Having said so much, it’s time to answer directly why Dubbo needs to be rewritten in Go. The answer to this question is still the official sentence: bridging the gap between Java and Golang. bridge. As for why we need to "build this bridge", please refer to the picture below:

The above is the detailed content of Why is Dubbo rewritten in Go?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the `enum` type in Java? What is the `enum` type in Java? Jul 02, 2025 am 01:31 AM

Enums in Java are special classes that represent fixed number of constant values. 1. Use the enum keyword definition; 2. Each enum value is a public static final instance of the enum type; 3. It can include fields, constructors and methods to add behavior to each constant; 4. It can be used in switch statements, supports direct comparison, and provides built-in methods such as name(), ordinal(), values() and valueOf(); 5. Enumeration can improve the type safety, readability and flexibility of the code, and is suitable for limited collection scenarios such as status codes, colors or week.

Applying Semantic Structure with article, section, and aside in HTML Applying Semantic Structure with article, section, and aside in HTML Jul 05, 2025 am 02:03 AM

The rational use of semantic tags in HTML can improve page structure clarity, accessibility and SEO effects. 1. Used for independent content blocks, such as blog posts or comments, it must be self-contained; 2. Used for classification related content, usually including titles, and is suitable for different modules of the page; 3. Used for auxiliary information related to the main content but not core, such as sidebar recommendations or author profiles. In actual development, labels should be combined and other, avoid excessive nesting, keep the structure simple, and verify the rationality of the structure through developer tools.

Windows search bar not typing Windows search bar not typing Jul 02, 2025 am 10:55 AM

When the Windows search bar cannot enter text, common solutions are: 1. Restart the Explorer or computer, open the Task Manager to restart the "Windows Explorer" process, or restart the device directly; 2. Switch or uninstall the input method, try to use the English input method or Microsoft's own input method to eliminate third-party input method conflicts; 3. Run the system file check tool, execute the sfc/scannow command in the command prompt to repair the system files; 4. Reset or rebuild the search index, and rebuild it through the "Index Options" in the "Control Panel". Usually, we start with simple steps first, and most problems can be solved step by step.

Differences Between Callable and Runnable in Java Differences Between Callable and Runnable in Java Jul 04, 2025 am 02:50 AM

There are three main differences between Callable and Runnable in Java. First, the callable method can return the result, suitable for tasks that need to return values, such as Callable; while the run() method of Runnable has no return value, suitable for tasks that do not need to return, such as logging. Second, Callable allows to throw checked exceptions to facilitate error transmission; while Runnable must handle exceptions internally. Third, Runnable can be directly passed to Thread or ExecutorService, while Callable can only be submitted to ExecutorService and returns the Future object to

What is a method reference? What is a method reference? Jul 01, 2025 am 01:03 AM

Method reference is a concise syntax in Java, used to directly refer to methods without calling them, and is often used in functional programming scenarios such as stream operations or Lambda expressions. The core of it is to use the :: operator, such as System.out::println instead of item->System.out.println(item). There are four main types: 1. Reference static methods (such as Integer::valueOf); 2. Reference instance methods of specific objects (such as System.out::println); 3. Reference instance methods of any object (such as String::length); 4. Reference constructors (such as ArrayList:

Exploring Different Synchronization Mechanisms in Java Exploring Different Synchronization Mechanisms in Java Jul 04, 2025 am 02:53 AM

Javaprovidesmultiplesynchronizationtoolsforthreadsafety.1.synchronizedblocksensuremutualexclusionbylockingmethodsorspecificcodesections.2.ReentrantLockoffersadvancedcontrol,includingtryLockandfairnesspolicies.3.Conditionvariablesallowthreadstowaitfor

The requested operation requires elevation Windows The requested operation requires elevation Windows Jul 04, 2025 am 02:58 AM

When you encounter the prompt "This operation requires escalation of permissions", it means that you need administrator permissions to continue. Solutions include: 1. Right-click the "Run as Administrator" program or set the shortcut to always run as an administrator; 2. Check whether the current account is an administrator account, if not, switch or request administrator assistance; 3. Use administrator permissions to open a command prompt or PowerShell to execute relevant commands; 4. Bypass the restrictions by obtaining file ownership or modifying the registry when necessary, but such operations need to be cautious and fully understand the risks. Confirm permission identity and try the above methods usually solve the problem.

Handling Common Java Exceptions Effectively Handling Common Java Exceptions Effectively Jul 05, 2025 am 02:35 AM

The key to Java exception handling is to distinguish between checked and unchecked exceptions and use try-catch, finally and logging reasonably. 1. Checked exceptions such as IOException need to be forced to handle, which is suitable for expected external problems; 2. Unchecked exceptions such as NullPointerException are usually caused by program logic errors and are runtime errors; 3. When catching exceptions, they should be specific and clear to avoid general capture of Exception; 4. It is recommended to use try-with-resources to automatically close resources to reduce manual cleaning of code; 5. In exception handling, detailed information should be recorded in combination with log frameworks to facilitate later

See all articles