Can Alibaba and Didi’s Favorite Microservices Perfectly Integrate with Blockchain?
With the maturity of micro-service architecture technology in recent years, more and more well-known enterprises, including Alibaba, Didi and Vipshop, have turned to utilizing microservices for refactoring their systems. Even in the blockchain industry, a global hit in 2017, the micro-service architecture is also a go-to choice for refactoring blockchain systems.
Why are these famous companies beginning to renounce monolithic architecture by choosing to use microservices instead? How can the blockchain be integrated with microservices?
What is Monolithic Architecture?
Since the early stage of Web applications, the monolithic architecture has been the dominant architecture in software systems. So what is a monolithic architecture?
Suppose you intend to develop an e-commerce system that contains various functional modules such as orders, customers, and goods. After the development is completed, you package the whole project and then deploy them to a server, which responds all queries from users.
The architecture of a system like this, where all the functions are deployed on the same server, is a monolithic architecture.
Defects of Monolithic Architecture
Those who have maintained a large software system using a monolithic architecture know that when adding a new business function to the system, you have to download all modules code from the repository, deploy it in the IDE, and then develop and test it. Even though there exists part of the code you need in an implemented module, there is no way to call it directly and you have to make a copy and then modify to realize the new business functions.
These are reflections of tight module coupling, poor code reusability, and low scalability in a monolithic architecture. In small software systems, as the business logic is not too complex, it is often feasible to adopt a monolithic architecture as a development cost tradeoff.
However, in large software systems, maintenance and iteration are constant. Ensuring better maintenance of the system after the development is of great importance too, and micro-service is an architecture designed for the sake of reducing these maintenance costs.
Micro-Service Architecture Features
Microservices are a type of architecture. It divides a complex large-scale software system into different modules according to different business logics, where each module can be deployed independently and provide services.
If you have experience in developing a system using micro-service architecture, you will find that a typical feature of the micro-service architecture is business-driven.
In the early 1980s, after the emergence of the RPC (Remote Procedure Call) technology, developers began to use RPC to build large systems. In the process, developers realized that not all functions should be divided even though they are dividable technically. Therefore, it is more reasonable to divide functions under specific business purposes. This experience eventually evolved into one of the design principles in the micro-service architecture: business-driven functionality.
Another feature of the micro-service architecture is modular services. In a system developed with micro-service architecture, each individual business unit is developed as a separate module, and each module can be independently deployed in the server to provide corresponding business services. In the end, the services provided by all the modules are pulled together to form a complete business process and become a system.
Business-driven and modular services triumph over the limitations of the monolithic architecture system. Modules are independent from each other, and the communication between the modules is achieved via the interface, which effectively loosens the coupling of the code. When developing new business functions, you only need to download the required modules from the repository instead of all the code, which allows you to develop and test with great ease. In addition, new functions won’t have any impact on the original system. The scalability of the system can be effectively improved.
The Perfect Combination of NULS Blockchain and Microservices
Not only do the traditional Internet companies such as Alibaba and Didi have a preference for micro-service architecture, but the blockchain industry that has been booming since 2017, has also made strides using micro-service architecture.
NULS, a public blockchain project that officially launched its main-net in July 2018 and won a prestigious award from the Chinese Ministry of industry and Information Technology, adopts a modular concept in the design of NULS1.0 to implement a customizable blockchain infrastructure.
However, the design of NULS1.0 is not perfect, and there is still plenty of room to improve, including the following three major issues:
Testing and deployment must still be applied to the entire project;
The user interface is still an integral part of the repository;
Only one development language can be used to enhance the system and make modifications.
In order to resolve these issues and further optimize the overall design of NULS, the NULS core team and technical community (CCC) jointly designed a brand-new architecture based on microservices- NULS2.0.
NULS Module Repository: Your Blockchain-building “Lego” Set
After optimizing NULS based on this new micro-service architecture, NULS will use the modularity of microservices to build a module repository that will include all the basic modules needed to build a blockchain.
The successful construction of the module repository enables companies or institutions to customize their desired blockchain fast and easy: the same way that children build multiple toys with varied features using Lego sets. For example, if a financial institution that wants to use the NULS module repository to build a blockchain system, it can directly pick up the basic modules such as accounts, transactions, and blocks from the module repository via direct download. In addition to this simple step, any business can easily add any new functionality or specific need, by quickly developing new modules to meet specific business needs.
Another reason why NULS is the Lego of blockchain-building systems is that a developed module can be deployed independently and can provide services, so that each module can be reused by multiple blockchains. In the same way you build with Lego sets, a particluar Lego block — or module in this case can be used not only for trains, but also for cars, houses, animals, trees, etc. This makes the module more reusable and more flexible, and adds incredible value to developers who can contribute to and pull from the module repository.
Obviously, the development of the repository makes the overall development of blockchain faster, easier, and much simpler.
One challenge to consider is how to better ensure inter-module communication for systems using micro-service architecture. On this point, NULS also provides its own innovative and outstanding solution.
Inter-module communication is a task that each module must handle. To facilitate development and avoid repetitive work, a service base repository is added to each base module. This way the base module can easily inherit the generic methods described without having to rewrite the corresponding code.
In order to further reduce the workload of developers and facilitate the seamless connection between the external application and the platform, the NULS2.0 architecture offers basic application repositories adapted to various terminals. These repositories are pieces of code that provide complex details about how to manage network resources, i.e. design messages, protocol processing, etc., so that developers can focus on the issues their applications are aimed at resolving, without ever concerning themselves over how to integrate them into the platform. In time, these repositories can be transplanted to multiple development languages, attracting more outside developers to join the project, and thereby growing the repository even faster.
NULS is a global open-source and community-driven blockchain project for customizable services. The complete NULS2.0 micro-service architecture is mainly divided into three layers:
Layer 1: micro-service infrastructure layer
Layer 2: blockchain basic service layer
Layer 3: DAPP application layer
This design is beyond the common blockchain thinking and refactors NULS from a higher dimension. The NULS core team decided to refactor NULS 2.0 based on this architecture. With this design, NULS will be more than the underlying extremely efficient infrastructure of blockchain, it can be a distributed infrastructure that seamlessly integrates with any blockchain systems. It will become a platform for seamless communication between different systems, which will enable companies that build thier blockchains based on NULS to thrive faster, more efficiently, and sharply reduce their development costs and time.
NULS is becoming the most optimal, powerful and flexible platform in the blockchain industry — a true driving force of innovation. Thanks to NULS the future of adaptability and scalability in the blockchain space will be beyond imagination!