Home  >  Article  >  A brief discussion on back-end technology trends in 2018

A brief discussion on back-end technology trends in 2018

小云云
小云云Original
2018-01-25 14:06:502465browse

In this article, we will mainly talk to you about the trends of back-end technology in 2018, hoping to help you have a clearer idea about back-end technology.

Asynchronous Mode

Go language is becoming more and more popular, and many large Internet companies are turning to GO for their backends. Dubbo, a well-known service-oriented framework in the Java circle, also announced its transformation to asynchronous mode. This is a major trend, and the asynchronous model has been verified and recognized by the market.

When it comes to choosing a web server, most people began to choose asynchronous non-blocking Nginx instead of synchronous blocking Apache a few years ago. It is because of asynchronous programs like Nginx that it has better adaptability and stronger concurrency capabilities. Now in terms of back-end business development programming, teams with strong technical capabilities have begun to switch the technology stack from synchronous mode to asynchronous mode.

The synchronous blocking mode has many defects, such as weak concurrency, poor adaptability, and slow requests, resulting in service unavailability. For example: in the scenario of calling third-party API in the background interface, the synchronization mode has extremely poor effect. In the past, fewer and fewer people used the synchronous blocking mode frameworks developed using Java, PHP, C++, Python, and Ruby languages.

Node.js

Although Node.js is also very popular and popular, it is still rare to see companies using Node.js as the main programming language for the company's backend. C++, Java, PHP, and Python languages ​​also have some similar solutions, including Swoole-1.0, which is also based on an asynchronous callback mode similar to Node.js.

The essential reason is that the technical solution of asynchronous callback and some optimization solutions made on it, including Promise, Future, Yield/Generator, Async/Await, etc., have changed the style and habits of program development. If you want to use these technologies, engineers need to additionally learn how to use these keywords and functions.

Using these technical solutions is not compatible with existing programs. It can be said that R&D costs are huge and it is difficult to make a smooth transition. Influenced the popularity of asynchronous callback technology stack. This programming model is difficult for everyone to accept.

Coroutine

The coroutine mode takes into account the maintainability of synchronous blocking and the high concurrency capability of asynchronous non-blocking. It will become the mainstream technical solution in the field of back-end development in the future.

The most important thing is that the coroutine mode only requires a few adjustments to the existing project code to run, and is even fully compatible with old projects. Only the framework layer is required for compatibility. This allows for a smooth transition for the team.

Using the coroutine mode, developers do not need to learn additional keywords and function usage at all. The coding style is exactly the same as in synchronous mode.

Among various coroutine technologies, GO is the most dazzling one. Coroutines, channels, static languages, performance, rich compilation, rich standard libraries, complete ecosystem, Google, etc. There are too many advantages. GO language, I personally think is the most worth learning among all current programming languages.

Swoole 2.x Let PHP, a veteran backend programming language with a history of more than 20 years, also have coroutine capabilities. Compared with technologies like Go, the technology stack of PHP + Swoole is more suitable for rapid development, rapid iteration, and business-driven scenarios. After all, dynamic languages ​​are more flexible and more efficient in development than static languages. And Go is more suitable for writing system-level software and core business.

In 2018, I refactored the swoole framework, a very old project. The bottom layer supports the Swoole 2.x coroutine mode. The main reason is that there are many projects within the wheel company based on this framework, especially the service layer, which all uses the swoole framework. We hope that the business code will not change a single line and can be switched to coroutine mode with one click. Theoretically, other synchronous blocking PHP frameworks, such as Laravel and Yii, can only modify the underlying compatible Swoole 2.x coroutine to achieve seamless switching of coroutine mode in the project code.

After using coroutines, the performance, concurrency, and stability of the entire system have been greatly improved. In the past, the problem that a slow request often caused the entire server to get stuck online no longer exists.

PHP & Swoole

Although Swoole 2.0 is only less than two years old, compared to the 10 years of hard work of the Go language, there is still a long way to go. But compared to static languages ​​like GO, PHP + Swoole still has many advantages. PHP is simpler and easier to use. PHP is a dynamic language and is more flexible to use.

Of course, if it is a new project, it is recommended to use Swoft, a framework specially designed for Swoole 2.x. It has less historical baggage and therefore has better stability.

Now with Swoole 2.0 coroutines, we are still confident in the future of PHP.

Related recommendations:

Seven things that growing programmers need to do

The growth route of PHP programmers

A brief discussion on the future of PHP programmers


Statement:
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