Talk Golang, as well as some detours I go

At some almost see the problem, quite interesting. Which language is best to tear, which is almost the best lead engineer war topic. I just want to talk about today is how I look at Go, and I go to some detour.

I learned that in 2010 Go language at school. Go language was still a mess, STW GC is the best we ridicule Go language targets. As long as the black one, Go Pink Yede basically speechless.

I was going to reserve a language with concurrent programming model. Because I think the case of CPU clock speed is no longer growing in the future, with a concurrent programming language model is definitely the future mainstream memory type is shared language strong competitor.

Candidate list is as follows:

Erlang, Golang, Scala with Akka.

My first Scala is ruled out, because the realization of Akka, I think is not good, but at that time heavyweight Scala does not apply in nature (although the open source Spark in 2010, but really caught on to go to the post-2012). the second is the Erlang and Go.

I was very obsessed with Erlang, because Erlang is the only one to achieve a soft real-time scheduler programming language. This means that this thing can be directly used to write (of course, at the beginning of the birth of Erlang is for this goal exists) telephone exchange, and If you want to write Go telephone exchange, is likely to name the name of the phone, met STW GC, then you can not hear the phone talking about the opposite of what (which is why WhatsApp later use Erlang, 50 engineers write supporting 900 million users of the system).

Moreover, the system Erlang implementation, so that the availability of 9 9. What is this concept? This means that the annual downtime not more than 31.56 milliseconds. Almost does not shut down. Aliyun can only say that their reliability 6 a 9, AWS availability of only 99.95%. means that a year down about 4.5 hours.

Erlang another design is a nice place, runtime itself is not so much a virtual machine, the operating system as it is, is a runtime container. To know BEAM (name Erlang virtual machine) in 1992 was achieved. The Docker 2013 years to appear. this is how the concept of advance.

So I hesitate to learn Erlang, but I just looked at Golang grammar, wrote several demo, waiting to see the next.

Time came in 2012, I went to 360 search practice. I was assigned a task to write a monitoring program, real-time collection and display state connections, etc. nginx and do data visualization number of machines for operation and maintenance engineers scheduling machine reference. Very and more, and to real-time display, which can be considered a difficulty. I immediately thought of writing a Erlang, this is simply tailor-made for the Erlang scene.

I finished, and successfully implements the function. The feedback received at this time it is to write great, but the company did not use Erlang engineers, no way to maintain, so I was at the suggestion of using Node.js and Redis websocket the subscription mechanism to achieve a pseudo-real-time monitoring system ... this is my first and last time in Erlang to write enterprise applications.

Yes, Erlang lost in here, the inventor of Erlang Joe Armstrong has an article. At The-Wrong-problem-Solving the beginning of the first sentence said such a sentence:

We're right and the rest of the world is wrong. We (that is Erlang folks) are solving the right problem, the rest of the world (non Erlang people) are solving the wrong problem.

Now look, this sentence is simply too much in two, and the effect is wrong, not me, is the world.

Why did not Erlang can not continue to upgrade the CPU clock speed, and such a good ecological surge in the number of cores fire up. The problem is actually big brother already he said. Erlang is not the only example of a go down. Richard P. Gabriel (one of the inventors of Common Lisp) in this article the Rise of Worse is Better nicely explained why no one would use Lisp, this principle also applies to Erlang body.

Simply put, that is, Erlang great, the perfect solution to the problem led to the design of hard to learn difficult to use. Highbrow. Those simple and easy garbage can pop up.

Very reasonable, and the reason is simple enough. That's why we do not read books, but like to listen to listen to the Himalayas, like going to know almost, like going to the Nuggets, like these things to be chewed again, that learned knowledge because for all of us, reading is too difficult, too painful.

But at that time I was young, ah, I feel that easy to handle, this time I choose the simplest, so I learned to follow suit Lua (openresty). This is actually very simple, I was watching the teacher left ear mouse thing I read LUA simple tutorial to get started I really pit toilet at the time of the learned, between less than 1 hour (JavaScript experience students will have faster) and then wrote a number of stand-alone support 100,000 concurrent + application level (such as pandas live TV the right side of the gift list, such as the Nuggets global data cache, etc.).

But Golang also have similar solutions. Fasthttp as a representative of Go-performance WEB framework, can easily support 100,000 concurrent level.

Time waits for no man. Golang in 10 years, it has become a monster. Not only STW GC solve the problem (of course, not as soft as smooth real-time GC), and had kubernetes such a terrible killer. Maybe some students do not understand the terrible kubernetes the future, we write the program is likely to neither run directly on a physical machine, nor is it to run on Xen, VMWare and other virtual machines, but will run on Docker, scheduled by kubernetes. even the choice the rights are not (do not believe the students can ask the manufacturers of the students, they have their own root access deployment target Mody).

See here, is not very familiar with? Erlang early have achieved all this, even more granular scheduling, Erlang was built to process (similar goroutine) level scheduling. And Golang of goroutine can not cross Docker scheduling it? (Although access the next communication network simulation can achieve something similar). Erlang put forward the concept of Let it Crash. now look kubernetes crazy restart your docker pod, you are not familiar?

openresty also said that when it was my first (white school site), beginning openresty birth, can easily support level WEB framework 100,000 concurrent access to only a handful. But now Golang also it even better (a few months back nginx so big a burden).

Read here, you might ask, so you seek death, every time almost all wrong, and how can I enjoyed? I can only say, I introductory programming language is PHP, this stuff than Golang also New Jersey Style. I can find is PHP job. and I continue to seek death in other languages. ...... ha ha ha ha ...... it really is sad.

There are students with PHP might ask, then learn swoole suit you? My suggestion is. Are adults, do not choose to do, all you want, whether it is swoole, fasthttp, netty, something you should see. I learned Erlang also I did not feel that they suffer. this does not, but also where the water article yet.

Guess you like

Origin juejin.im/post/5d7a1fba51882520d46ac0ed