Born in 2014, the "microservice architecture", the idea of which has been elaborated by Martin Fowler, has been continuously valued in recent years, and the theory and related practices have been continuously developed. At present, the architecture must talk about microservice architecture.
With the rapid development of microservice architecture, various development languages and types of microservice development frameworks have appeared one after another. At the PHPCon conference held this afternoon, Liang Chen from the core development team of the open source microservices framework TARS shared with developers The role of TARS-PHP in the construction of the microservices ecosystem of TARS. Liang Chen is also the main person in charge of the TARS-PHP project. The following is the collation of this speech.
Hello everyone, in the next 45 minutes, I want to talk to you about the advantages of TARS as a microservice platform itself, and I want to let you see that the TARS-PHP core development team has continuously evolved TARS- PHP, the effort to integrate it into the PHP ecosystem, and see what this means for the entire TARS microservices ecosystem.
From the evolution of the industry architecture in recent years, microservices have gradually become a trend . It can be seen from this figure that in different industries, the time interval for publishing services is different. The Internet industry has the highest proportion of weekly releases, but other industries are also gradually catching up.
We can see the specific release data, 63% of enterprises release on average once a month. How to transfer the system to the microservice architecture ? Now there are many choices. Nearly 10% of people choose a native framework like Dubbo, nearly 50% of people choose a cloud native architecture, and about 30% of them are based on architectures such as Weblogic WEBSPHERE. Of these, 51% are considering transformation and 15% have implemented it.
From these data, we can see that microservice architecture is gradually becoming mainstream.
With the rapid development of microservices architecture, various development languages and types of microservices development frameworks have appeared one after another. We have analyzed the current use of microservices frameworks and can see that there are four main models :
- No service governance: gRPC, brpc as representatives
- Single language with service governance: Dubbo, Spring Cloud as representatives, mainly applicable to the Java language
- Multilingual with service governance category: TARS
- Service Mesh: SideCar model, no mature enough
Among them, TARS supports service governance capabilities on the basis of a communication framework and supports multiple programming languages at the same time, which is a relatively alternative choice . With that said, we can take a look at what specific governance capabilities it supports. Before that, let's understand what a microservice architecture looks like.
From the perspective of the overall microservice architecture, it is mainly divided into: access layer, gateway layer, business service layer, support service layer and infrastructure layer. In addition, it is very important and easily overlooked: microservice development framework, continuous delivery pipeline, end-to-end tool chain, engineering practices and specifications, these parts constitute the entire microservice architecture system, they are all in microservice Plays a very important role in the architecture.
TARS as a whole can be divided into operations, platforms, communication frameworks, public components, and unified protocols .
To put it simply, on the operation platform, TARS can support the management and operation of different language services, and also supports the creation and release of page-level services; while on public components, TARS provides a lot of powerful public components to take charge of different functions , Including log components, monitoring components, main control components and configuration components, etc. In terms of unified protocols, the native binary protocol of TARS is very suitable for high-performance scenarios. First of all, this protocol language has nothing to do with its own interface description and tools. Transcoding can greatly improve development efficiency
Focusing on TARS-PHP, as a solution for Tars in PHP language, the following four aspects are considered when designing:
- Complete functions : benchmark existing C ++, Java and NodeJS system functions
- Flexible : On flexible, who is competing with PHP?
- Lightweight : With the lightest design, click to stop, plug and play
- Efficient : Plug in the wings of the Swoole coroutine and have to fly
The whole framework is mainly divided into four parts:
- TARS-CLIEN
- TARS-SERVER
- TARS-EXT extension
- Code generation tool
In the past year, TARS-PHP has mainly made efforts to enrich existing functions, build a more open system, introduce the efficiency of DevOps, and better serve the community
From the perspective of TARS-SERVER function, TARS-PHP has added WebSocket Server and PB SERVER, so that now a service template can achieve up to five different services .
By using WebSocket Server, users can effectively expand the Swoole function, which supports multiple ports, custom commands, and very flexible FD storage.
PB Server builds a gRPC service, which is deployed on the TARS platform, participates in the addressing of the TARS platform, and is managed by the TARS platform. This service uses gRPC on Http / 2 as the network communication protocol and Protobuf as the encoding protocol, and can work with other PB Clients
In terms of development efficiency , we have also optimized the PB Client. Developers can also use the code we provide to automate production tools to save development time.
In terms of better integration of TARS-PHP with the platform, we have implemented proprietary feature monitoring for PHP services , which can monitor data such as the number of Swoole workers, the number of network states such as TIME_WAIT, and the memory occupied by each worker in Swoole. To let developers know more about their services.
In order to build the open system of TARS-PHP , we introduced Client & Server filters, which can make it easier for developers to add their own code before and after the request. At the same time, we have also opened the ability to write to the Context in the TARS protocol, making distributed tracing at your fingertips.
In order to allow PHP developers to more use of TARS, while reducing their migration costs, TARS-PHP now also been integrated with Laravel, ThinkPHP, Yii2, SWOFT and Phalcon, follow-up will focus on access Hyperf and easyswoole and other industry Excellent framework . By accessing TARS , it is equivalent to enabling the service packaging, cloud configuration and HTTP / TARS dual protocols, while maintaining the original development framework.
In terms of DevOps, TARS provides the official Docker image, allowing developers to set up a development environment with one click. In terms of continuous integration, we also provide an automatic build solution based on the Jenkins and TARS platform APIs, allowing you to submit your code to test to deployment and become a one-stop shop.
In order to allow developers to use TARS more quickly, we have also released a variety of server-type barrage services using HTTP, TCP, and PB using TARS . Storage also involves Redis and MySQL, which can make it easier for developers. Run TARS in your own project.
The road of TARS-PHP's open source has just begun. In order to solve the documentation problem , we also continue to improve the existing Gitbook to reduce the barriers for developers to use.
In the one year or so of open source of TARS-PHP, we have more than 10 projects and derivative projects, more than 200 GitHub repo commits, 800+ WeChat and QQ group developer community, and 40,000 downloads of Packagelist +. Hope everyone can join the construction of TARS-PHP.
Attached:
TarsPHP project source address: https://github.com/TarsPHP/TarsPHP
(Click [read the original text] to access)
All versions of TARS source address: https://github.com/TarsCloud
(If you like, remember to give the project a star ~!)
TARS-PHP QQ Communication Group: 769531734