State-owned, idle fish structure team leader. The exploration and practice of xiuyu on the Flutter&FaaS integration project in the past year was Shared at the 2019 Archsummit which ended on July 13.
Challenges of traditional Native+Web+ server mixed development
With the development of wireless, IoT and 5G, mobile r&d is becoming more and more multi-faceted. The traditional development method based on Native+Web+ server has low research and development efficiency, which obviously cannot meet the development needs.
We hope to explore an efficient development framework for independent apps on xianyu’s scale. The main idea is to solve the multi-terminal problems around Flutter, and make the Flutter and FaaS open without service capacity, so as to form the integrated research and development capability of the cloud and support the development needs of a multi-terminal cloud. In some scenarios have been effective, hope to share the process of thinking, to communicate with everyone.
Comparison and selection of Flutter and RN
The idle fish chose Flutter mainly for the consideration of high performance. Flutter’s high performance mainly comes from two reasons:
- Dart’s AOT compilation capability.
- The self-built rendering engine does not need to be converted to Native controls, thus avoiding problems such as thread jumping.
Without a silver bullet solution, Flutter and RN have their merits. There are many factors in how to choose. The key lies in how to choose. For example:
- Is the current team mainly used to end JS stack or Native? If JS is the main thing, it’s a little bit more comfortable to write RN. If Android or iOS were dominant, it would be more comfortable to write Flutter because the tools and experience of the Flutter are more similar to those of Native.
- Which is more important, dynamic or the performance of complex interactions? Dynamic important RN appropriate, performance experience important Flutter will not be disappointed. Although Flutter has some dynamic solutions, such as JS transfer to the Flutter engine, Dart code CodePush, and component-oriented server assembly, these dynamic solutions are not as good as RN’s solution from the JS layer.
- Do you need a IoT layout? Flutter has layout on embedded design, and performance is better.
Dart is the first optional language for the FaaS layer
Cloud technology stack through, is a good solution to reduce collaboration. Previous integration schemes of front-end + node. js should be familiar to everyone. However, if the Flutter is used on the end, then the cloud Dart is the first choice.
The essence of FaaS is that it runs in the cloud. Is Dart appropriate for cloud /Server?
The Dart language predates Flutter, and Dart was originally designed to be used on Web and Server. Dart has some features of the server-side language:
- Strongly typed, predictable
- Asynchrony and concurrency
- High-performance JIT
Dart is first used as a common Server to replace the traditional JavaServer, and then the Dart container is embedded in the FaaS container. Building the Dart Server capability is the first step and the main effort.
Construction idea of DartServer for idle fish:
- Inspired by the Flutter’s HotReload, the HotReload was transplanted to the Server side.
- Make use of the Isolate, and assign each developer one Isolate in the development environment to solve the previous environmental conflicts.
- Dart itself is a single-thread asynchronous model, and the concurrency capability needs to be supported with the Isolate.
- With the feature of Dart’s Zone, it is convenient to Trace the call link and record the Trace log.
- With the C++ Extension capability supported by Dart, you can access C++ -enabled middleware packages in Dart. In addition, Server Mesh is also an important idea for decoupling service invocations between heterogeneous languages.
Think deeper about integration
The above mentioned contents realize the unification of the technology stack of Flutter&Dart FaaS, but the unification of the technology stack is far from enough. The students of duan and cloud are still not truly complementary and integrated. The reason is that there are more in-depth problems to be considered:
- How to maximize the closed loop dividend of integrated business? Integration is not only the improvement of efficiency, but also enables a student to Cover a cloud-to-end business and make the business closed loop.
- How to eliminate cloud technology barriers? Only through the technology stack, the end personnel still can’t write cloud, because the reason is that they don’t understand the thinking mode of cloud, and they need to truly eliminate the technical barriers of cloud.
- How do you reduce the amount of work (1+1<2)? It doesn’t make much sense to burden one person with the workload after integration, but to reduce the total workload under integration.
- How to promote the remolding of production relations? Relations of production need to adapt to the new productive forces.
To solve these problems, the solution of xianyu is as follows:
- Business closed loop brings better growth space for business development students, who can think about business in a complete and focused way. This is the core of human motivation.
- Business closed loop is the direction of business process precipitation
- In the past, the architectures were separated by cloud and end, but after the integration, there was more space for architectures to sink, which brought the possibility of total workload 1+1<2
- Field sinkage and tool support are the guarantees of integration
Effect of case
Case one, the embodiment of integration in resource balance. In a recent project, cloud integration reduced the project time from 2 months to 20 days.
Case two, integration in the business of closed – loop embodiment. A development student in charge of growth, focusing on the growth of the business, in the right circumstances for the right people to deliver the right content, so as to bring user growth and active effect. In the way of integration, cloud and terminal aspects can be unified, and business research and development is no longer limited by cloud and terminal.
Integration is the direction of building an efficient research and development framework. Not all scenes need to be developed in an integrated way, but the integrated technical components such as Flutter and FaaS can be used independently, which will also improve the efficiency and be compatible with the original development mode. Building from the perspective of integration can make the overall architectural system more consistent, and also have the opportunity to make an integrated architectural precipitation.
In the future, xianyu hopes to make more attempts and further exploration on integration, including integration tools, integration business platform, data-oriented intelligence and other directions.
Author: idle fish technology – state owned
Read the original
This article is the original content of yunqi community, shall not be reproduced without permission.