Dynamic Microservices - Alibaba’s Nacos Embraces the Spring Ecosystem
This article is part of the Alibaba Open Source series.
Nacos is an opensource and easy-to-use platform designed by the Alibaba tech team for dynamic service discovery, configuration and service management. It helps you build cloud native applications and microservices platform easily.
Service is a first-class citizen in Nacos. Nacos supports almost all type of services such as Dubbo/gRPC service, Spring Cloud RESTFul service and Kubernetes service.
Nacos now allows Spring developers to perform service discovery, configuration management, and service control for their microservices in the production environment, so that developers could enable dynamic configuration service for their Spring Framework applications easily by adding some simple annotations.
Alibaba’s open source project Nacos recently released V0.2.0. This version supports the full technology stack of the Spring ecosystem, including Spring Framework, Spring Boot, and Spring Cloud.
In order to allow more Spring developers to perform service discovery, configuration management, and service control for their microservices in the production environment, Nacos is downwardly compatible with most of the earlier Spring versions, including Spring Framework 3.2.18+, Spring Boot 1.4.1+ and 2.0.3+, and Spring Cloud E and F.
Nacos in Spring Framework
Compared with Consul, Eureka, and Spring Cloud Config, Nacos is designed to be more extensible in Cloud environment adaptability, multi-configuration management, system recovery, service control, maintainability, and capacity. To help developers to migrate easily from the old Spring Framework to Spring Cloud Microservice Framework, the latest version of Nacos directly supports Spring Framework. With Nacos, you can enable dynamic configuration service for your Spring Framework applications easily by adding some simple annotations.
Trend toward Microservice Architecture
Almost 30% of the companies around the world start to adopt the microservice approach in production, and 91% either have microservices or have plans for them, according to Global Microservices Trends: A Survey of Development Professionals released by Dimensional Research in April 2018.
A report released by Gartner in 2017 also shows the microservice trend.
How to Design Microservices
As shown in How to Design Microservices for Agile Architecture released by Gartner in 2017, the first decision to make when designing a microservice architecture is to find a product with strong distributed configuration and service discovery capabilities, with which you can decouple services from the environment and the depolyment process. You will also need to select a service discovery solution so that the decoupled services can be found and reused easily.
“…Distributed configuration allows arbitrary configuration data to be defined external to the service implementation and deployment configuration data. This decouples the service from its environment, improving portability and automation. The configuration information could include topic names, queue names, database names and other environmental data that needs to be accessible to service instances at runtime …”
“…A service registry provides an API that allows a provider service instance to register its availability (and a heartbeat mechanism to verify availability). The registry also allows consumers to discover and connect to service endpoints based on a predetermined identifier for the service. This resolution of the identifier into a service endpoint can be managed on the client side or the service side (see Figure 3), but both models keep the link as late-bound as possible and allow the life cycles of consumer and provider instances to be decoupled…”
Cloud Native Support
Nacos was recently open-sourced by Alibaba to help developers build, deliver and manage their Cloud Native microservices more efficiently with its easy-to-use services such as
dynamic service discovery,
service configuration management, and
shared services management.
As an implementation of distributed systems, microservice architecture can be risky in production because of its complexity. Take Spring Cloud as an example: To realize dynamic configuration management and service discovery, you must know Eureka, Spring Cloud Config, Git, and RabbitMQ, and ensure that they meet the SLA of high availability in production. Furthermore, you have to consider how to deploy the whole system on Cloud.
With service discovery, dynamic configuration, service health check all integrated into one, Nacos significantly reduces the cost of learning and using microservices for small and medium-sized startups. Before it was open sourced, Nacos had served for Alibaba’s businesses for 10 years. Nacos was production-oriented at the very beginning, and so it is today.
Centralized Microservice Management
To help developers further reduce the cost of microservice management, Nacos is strengthening its capabilities in service list, service status, and service governance, and configuration management. The first version of Nacos console will support:
- Service list and status display
- Service metadata storage and editing
- Service flow weight adjustment
- Service offline/online
- Configuration management
- Configuration version control and rollback
- Configuration editor of .xml,.yaml, and .json
- Configuration import/export
Nacos community is planning to provide UI console support for Nacos V 0.3.0. Currently, we are voting for its UI theme and style. To vote for your favorite style, click Nacos console UI theme&style.
To join Nacos community, visit Nacos Gitter.
High Availability Deployment
Starting from V0.2.0, Nacos supports highly available cluster mode, making it further production ready.
In Alibaba’s cluster performance test with 3 Dockers (4 Core, 8G, 1,000M, SSD) and 2 MySQL nodes, Nacos supports 100,000 configurations/services, 15,000 long connections, with a configuration read QPS of 15,000, and service read QPS of 10,000. The write ability is consistent with that of RDS (MySQL). Aliabab’s practice shows Nacos can well support the extension of cluster nodes and meet the growing need of microservices for most enterprises.
Nacos community is planning to build an open benchmark tool and will continue to enhance its performance. For details, see Nacos Issue.
For how to deploy Nacos high availability cluster, see Nacos Documentation.
To use Nacos to build your own Spring Cloud microservice architecture, all you need is to add a starter dependency:
For details, see:
For more examples, see nacos-examples.
Welcome to Nacos Community!
DISS is cheap, show me your hand
More than 5 PMCs and 10 Committers joined Nacos community in the first year, and Nacos looks forward to more contributors.
You can contribute by:
- Using Nacos in your production or future products
- Helping in UI\Visual\Front-end design of Nacos console
- Adding projects and tools for Nacos to integrate with Spring Cloud、Kubernetes、Service Mesh
- Providing Multi-language client support
- Submitting proposals, PRs, and bug fixes
- Writing docs
- Sharing your stories about Nacos
We are looking for:
- Passionate Problem Solvers
- Detail-oriented Coders
- Community Activists
- Voluntary Contributors
- 0-KPI Believers