Community Blog Code It Once, Run It Everywhere: Next-Generation in Cloud-Terminal Integration

Code It Once, Run It Everywhere: Next-Generation in Cloud-Terminal Integration

Read how you can achieve the next-generation of cloud-terminal integration at your company with the "Code it once, run it everywhere" method.

By Sun Qi (Kongmeng) at Alibaba.


In many of the current research and development and operations and maintenance models used at businesses in the mobile Internet space, all the different cloud services in a hybrid cloud system seem to be invariably separated from the mobile terminals end. Though there does exist full-stack solutions out there, there are only a few cases of these actually working out, and the industry as a whole lacks innovative solutions for cloud-terminal integration.

So, given this trend, there's a few questions we ought to be asking ourselves: How can we implement one quick-and-easy research and development project to support the fast business implementation across the cloud and the mobile terminals running Android and iOS? Or, alternatively, are there new research and development or operations and maintenance models that will give programmers the ability to focus on programming, and not have these two things be isolated form each other?

Well, our answer is simple: "Code it once, run it everywhere." Already, we've have shown that this approach to work with our second-hand buy-sell app Xianyu. Using this method reduced the time we needed for one particular development project from 60 to 40 days, which is a 33% increase in efficiency.

So, in this article, Sun Qi, senior technical expert at Alibaba, will provide some analysis of how this method has served us well at Alibaba, and how it can change things at your business, too.

Where We Came From: The Evolution of Business R&D Models

Efficiency is the core driver of the evolution of business research and development and operations and maintenance models.

In the PC Internet era, the frontends and backends of individual applications were some of the initial research and development models of modern IT. During the early days of the desktop version of Taobao, for instance, developers wrote velocity templates, and JSP and ASP pages before that. These were essentially centralized train-like research and development models.


But, as the complexity of business development rapidly increased, the train-like delivery model greatly restrained business development. So, to remedy this, service-oriented splitting was introduced. And, in 2009, Taobao's multicolor stone project was based on this approach. At this time, microservices became a software architecture. This was made possible by a change in research and development models from centralized models to distributed models.

And, while businesses were upgrading their system to these more updated distributed research and development models, the frontend-backend separation research and development model was also starting to emerge on the horizon. From Ajax to the dedicated frontend, the closed business loop was completed independently, which improved the overall division of labor and increased efficiency at the same time. However, for frontend personnel, server-side operations and maintenance has been a difficult technical hurdle to overcome. And, this problem hasn't received a very satisfactory solution even in Alibaba's Java-based middleware ecosystem just quite yet.

Now, fast-forward to the mobile Internet era, Internet clients have evolved in the same way. For example, Alibaba Group uses Atlas to implement terminal distributed research and development models. However, compared with the separation of the frontend and backend in the PC era, the mobile era has recommissioned the Ajax model. Therefore, the terminal personnel are only responsible for the terminal rather than implementing a closed business loop. At the same time, mobile Internet has brought its own challenges, such as the problem of operating across Android and iOS platforms. This was the context that gave rise to React Native, Weex, and other similar products.

Core Challenges of Cloud-terminal Integrated Lightweight R&D Models

If we want to have client personnel go a step further and achieve closed-loop business implementation while preventing the Backend for Frontend (BFF) layer from confronting the client personnel with the group's Java technology middleware in research and development, operations and maintenance, and cross-language work, this is what we need to do:

  • Shield business research and development from code runtime environments.
  • Develop the capabilities that will work across clouds, terminals, and platforms.

In my opinion, the success of the Java language is due to its "compile once, run it everywhere" feature, which shields some runtime environments at the java virtual machine (JVM) level. The core challenge is finding a way to provide a language-independent transparent code runtime environment to research and development, so that everything except the business code is managed by the technology platform.

For many years, mobile Internet research and development models kept clouds and terminals separate. The industry at large is exploring full-stack solutions, but there have been no successful cases so far. The problem is that the technical barriers are too high. Therefore, developers have to do the hard work, and there has been no essential change in the complexity of business implementation. Things that originally had to be done by three people now can be accomplished by one person, but there is still a lack of effective cross-platform capabilities, especially those that would intersect the cloud and terminal platforms.

Essentially, you could summarize the evolution of research and development models as having lowered technical barriers and increased cross-platform capabilities. But there's still much more room to grow and improve.

"Code It Once, Run It Everywhere"

Allowing developers to focus only on business logic coding is the next stage in the evolution of research and development models. In this stage, technologies such as cloud native gave us a great deal of help. By decoupling the infrastructure through container technology, container-based orchestration reduces the complexity of operations and maintenance. In addition, service mesh is used to decouple applications from the middleware system. This provides immutable infrastructure that features improved consistency and reliability while reducing complexity. By exercising the serverless idea, technological evolution provides new opportunities for upgrading research and development models.

Exploration and Practices in Lightweight R&D and O&M Models for GAIA

The context described above gave birth to GAIA, which has been closely integrated with Xianyu and the aplatform interactive platform for the Taobao ecosystem. GAIA's cloud-terminal function-as-a-service (FaaS) technical capabilities have redefined the responsibilities and boundaries of research and development. This allows programmers to concentrate on their original programs and implement lightweight cloud-terminal integrated business research and development and operations and maintenance models in combination with cross-platform terminal capabilities.

Xianyu's new research and development model is shown below:



  • In Xianyu's business implementation, the cloud-terminal integrated research and development model reduced the original project duration of 60 days to 40 days, with an improved efficiency of 33%.
  • On a platform that supports the 88VIP interactive campaign, business traffic with hundreds of thousands of queries per second handled smoothly and reliably. This was Alibaba's first large-scale verification of the lightweight compound multi-container design model.

GAIA Design Concept

The containerized design model decouples infrastructure submergence and businesses, making the code runtime environment transparent to businesses.

Lightweight Compound Multi-container Design Model


Currently, our applications are still using the rich container model. However, the uneven responsibilities of containers result in isolation and close coupling between businesses and infrastructure.

Containers are key to GAIA. Their design model has been revolutionized, representing Alibaba's first large-scale test of this new approach.

  • The lightweight compound multi-container capability based on Kubernetes pods has redefined the boundaries between businesses and infrastructure by providing infrastructure in the form of a sidecar.
  • Container orchestration and scheduling are used to unify the lifecycles of resources, traffic, and containers, laying the foundation for on-demand use.
  • Based on configmap, configurations are decoupled from the environment, container images are made unchangeable, and routine, pre-release, and production images are unified to reduce complexity.
  • Based on the Init Container technology, functions are completely decoupled from the infrastructure, and functions and infrastructure are combined to build the running state through the container lifecycle initialization mechanism. This provides support for the independent operations and maintenance of business functions and infrastructure.
  • Infrastructure capabilities such as API service registration and discovery are submerged in the Kubernetes technical system.

By leveraging the design capabilities of these containers, business research and development personnel only need to write business logic code and present it through declarative APIs. In this way, they can quickly deploy cloud-terminal business implementation capabilities on mobile terminals, while containers such as mini programs encapsulate the runtime environments of isolated businesses. This is also true for Flutter. Developers can engage in container-oriented programming and use containers to isolate infrastructure and mask the differences between runtime environment platforms.


GAIA is an open platform. According to its container design specifications, Xianyu implements function containers according to the Dart language specifications. Meanwhile, the aplatform engine is successfully connected to the Java containers in GAIA. This solves the issue of platform-based applications, with more than 10,000 applications for the group, and provides a path for any application to implement a serverless solution based on GAIA.

Summary and Outlooks

At present, the integration of GAIA, Xianyu, and the aplatform interactive platform for the Taobao ecosystem is an exploration of great significance. The ability to "code it once, run it everywhere" allows programmers to focus on programming. Currently, cloud-terminal integration at the technical level remains in the early phases. In the future, we hope to see in-depth system exploration and construction.

The Irresistible Future Trend: Lightweight Business R&D and O&M Models

With the advent of 5G and the Internet of Everything, different terminal devices will need to support lightweight research and development and operations and maintenance models. Beginning with the pursuit of lower technical barriers and cross-platform capabilities that drive research and development model evolution, efficient business implementation capabilities are the way to go. The current division of terminals and collaboration models into the cloud, the mobile terminals of iOS and Android will inevitably be phased out.

Containerized and Unified API Service Programming

The containerization of cloud and terminal runtime environments is the necessary way to decouple businesses from infrastructure. Containerization will encapsulate isolated runtime environments and service interaction will be achieved through the unified APIs provided by containers. Cloud and terminal container technologies will converge, allowing the close interaction of the containers at both ends. Clouds and terminals will be deeply integrated in technical systems to achieve a closed-loop cloud-terminal technical system.

Unified Engineering Systems and Consistent Version Release and Upgrade for Clients and Servers

Currently, separated research and development models typically manifest as different code branches for each terminal. Lightweight cloud-terminal integrated business research and development models will unify business engineering systems for clouds and terminals. In a single project, we can define service interfaces to expose services in the cloud container and call services in the client container. At the same time, clouds and terminals will adopt a unified version release and operations and maintenance system. This will require the complete redefinition of the research and development model system.

Reorganization of Technical Departments

As people's needs change, the organizational and production relationships that support businesses must be upgraded accordingly.

Our Mission

We seek to revolutionize research and development models and restructure the research and development ecosystem.

We want to work together to build lightweight business research and development and operations and maintenance models that integrate clouds and terminals so that developers can achieve our system of "code it once, run it everywhere."

0 1 0
Share on


1 posts | 0 followers

You may also like



1 posts | 0 followers

Related Products