5G era|Xianyu's exploration and practice road in Flutter&FaaS cloud integrated architecture

Manuscript source: Alibaba Cloud Developer Community

 

https://ucc.alicdn.com/pic/developer-ecology/85ab0b2c8e044a53bc1fd4bbf67dac52.png

Introduction:

With the development of wireless, IoT , and the advent of 5G , mobile R&D is becoming more multi-terminal. The traditional development method based on Native + Web + server is inefficient in research and development, and obviously can no longer meet the needs of development. This article will introduce Xianyu 's exploration and practice in the Flutter&FaaS integrated project in the past year .

Challenges of traditional Native+Web+ server-side hybrid development

We hope to explore an efficient R&D framework for an independent APP of the size of Xianyu . The main idea is to solve multi-terminal problems around Flutter , and connect Flutter with FaaS and other non-service capacity capabilities, forming a cloud-integrated R&D capability to support the development needs of one cloud and multiple terminals.

In some scenes, the results have been achieved, and the thinking in the process will be communicated with everyone.

https://ucc.alicdn.com/pic/developer-ecology/1857cf1c2ab140298769f3098fa6652c.png

Comparison and selection of cross-end solutions Flutter and RN

Xianyu chose Flutter mainly for high performance considerations. The high performance of Flutter mainly comes from 2 reasons:

  • Dart 's AOT compilation capabilities.
  • Self-built rendering engine, no need to switch to Native control, avoid thread jumping and other problems.

https://ucc.alicdn.com/pic/developer-ecology/21dda5afcd3a4466abda24b91fdd4dde.png

More comparisons:

https://ucc.alicdn.com/pic/developer-ecology/550d54912eca45fe9c66f888c4912374.png

There is no silver bullet solution, Flutter and RN have their own advantages. There are many factors in how to choose, and the key depends on how to choose, for example:

  • Is the current team based on the front-end JS stack or Native ? If JS is the master, writing RN will be more accustomed. If Android or iOS is the mainstay, writing Flutter will be more accustomed, because Flutter 's research and development tools and experience are more similar to Native .
  • Dynamic or complex interaction performance, which is more important? Dynamic is important, RN is appropriate, and performance experience is important. Flutter will not be disappointed. Although Flutter also has some dynamic solutions, such as JS switching to the Flutter engine, Dart code CodePush , componentized server-side assembly solutions, etc., these dynamic solutions are not as good as RN can solve from the JS layer.
  • Do you need a multi-terminal layout such as IoT ? Flutter has a layout in embedded design and has better performance.

Dart as the language of choice for the FaaS layer

Getting through the cloud technology stack is a good solution to reduce collaboration. In the past, the front-end + Node.js integration solution should be familiar to everyone. However, if Flutter is used on the end-side , then the cloud-side Dart is naturally the first choice.

 

The essence of FaaS is to run on the cloud. Is Dart suitable for use on the cloud /Server ?

Dart language predates Flutter . In the original design, Dart can be used for Web and Server . Dart has some server-side language features:

  • Strong type, predictability
  • GC asynchronous and concurrent
  • High-performance JIT
  • Profiler

Xianyu first tried to use Dart as a normal Server instead of the traditional Java  Server , and then embedded the Dart container into the FaaS container. Building Dart Server capabilities is the first step and the main workload.

Xianyu 's construction ideas in Dart  Server :

 

Development period:

  • Inspired by Flutter 's HotReload , HotReload is ported to the Server side.
  • Using Isolate , each developer is assigned an Isolate in the development environment to solve the problem of past environmental conflicts.

Runtime:

  • Dart itself is a single-threaded asynchronous model, and the concurrency capability needs to be supported by Isolate .
  • Using the characteristics of Dart 's Zone , you can easily trace the call link and record the Trace log.
  • Using the C++ Extension capabilities supported by Dart , you can access middleware packages that support C++ in Dart . In addition, Server Mesh is also an important idea for decoupling service calls between heterogeneous languages.

Deeper thinking of integration

The above content achieves the unification of the technology stack of Flutter & Dart FaaS , but the unification of the technology stack alone is not enough. The end and cloud students still cannot truly complement and integrate themselves. The reason is that there are more in-depth issues to consider:

  • How to maximize the integrated business closed-loop dividend? Integration is not only an improvement in efficiency, but also enables a student to cover a cloud-to-end business and close the business loop.
  • How to eliminate cloud technical barriers? Only the technology stack is opened up, the end staff will still not be able to write to the cloud, the reason is that they do not understand the cloud thinking mode, and need to truly eliminate the technical barriers of the cloud.
  • How to reduce the total amount of work (1+1<2 ) ? If the workload is reduced to one person after integration, it is of little significance, and the total workload under the integration needs to be reduced.
  • How to promote the reshaping of production relations? Production relations need to adapt to new productivity.

 

 

Faced with these problems, Xianyu's solution ideas:

  • Business closed loop brings better growth space for business development students, so that they can think about the business in a complete and focused manner. This is the core motivation of people.
  • Business closed loop is the direction of business process precipitation
  • Previous cloud architecture, end separate architecture, with more sink space after integration architecture, which brings the total workload 1 + 1 <2 possible
  • Field sinking and tool support are the guarantee of integration

Case effect

Case 1: The embodiment of integration in resource balance. In a recent project, cloud integration reduced the original two -month project time by 20 days.

 

Case 2: The embodiment of integration in business closed loop. A development classmate who is in charge of growth focuses on the growth of the business, and puts the right content to the right people under the right circumstances, so as to bring user growth and active effects. Under the integrated approach, the aspects of cloud and device can be unified, and business research and development is no longer restricted by cloud and device.

 

Said at the end

Integration is the direction of building an efficient R&D framework. Not all scenarios require integrated development, but integrated Flutter , FaaS and other technical components can be used independently, which will also bring efficiency improvements, and are in line with the original development model. compatible. Constructing from an integrated thinking can make the overall architecture system more consistent and also have the opportunity to build an integrated architecture. In the future, Xianyu hopes to make more attempts and in-depth explorations on integration, including integrated tools, integrated business platforms, and digital intelligence.

 

 

Guess you like

Origin blog.csdn.net/weixin_40050195/article/details/97268045