当前位置:网站首页>How to migrate x86 architecture applications to arm architecture at low cost

How to migrate x86 architecture applications to arm architecture at low cost

2022-06-23 08:12:00 Rainbow open source

Only a short while ago , Whether it's on a server or a PC ,CPU The field of chips has always been Intel take the first place at the triennial palace examination , Flag X86_64 Architecture is widely adopted . But kingship does not last forever , In recent years Arm64 Architecture has sprung up , Huawei Kunpeng is on the server 920 High performance chip as a representative , The PC end is apple M1 Chips amaze the world .Arm64 Architecture chip shows off its market value with low power consumption and high performance , The torrent of localization substitution is also constantly Arm64 To the army 、 The government 、 Suppliers of state-owned enterprises . Seize the opportunity , Quickly embrace and adapt domestic chips , It is a new topic of software delivery in this era .

hug Arm64 The difficulty of

from X86_64 March towards Arm64 It's not easy , Changes to the instruction set , The radius of influence is very large .

The most direct impact , It was originally in X86_64 The business system that can run normally in the environment needs to be based on Arm64 Recompile to run . Even if the language used in development has the ability to cross Architecture , Recompiling itself is a very complicated job , Need to invest a lot of manpower cost and time cost .

Arm64 The development language ecology of is not so sound , This will increase the burden that developers should not care about . Many languages have their own operating environments that need to be recompiled , Not to mention the adaptation of many open source middleware .

The above is just the focus of developers .

In the field of software delivery , The software is delivered to the customer environment to run , Just the beginning . Business system management 、 monitor 、 iteration 、 Disaster recovery is a constant focus of the delivery team . Most delivery teams are in X86_64 Under the architecture , Have their own solutions . So the container 、Kubernetes、DevOps These advanced tools and methods , stay Arm64 How to reproduce under the framework ?

Solution

Rainbond You can use your own capabilities to smooth out the differences in chip architecture , Whether it's developers , Or delivery personnel , Can be based on Rainbond Find a hug Arm64 The solution .Rainbond Through different levels of ability to solve from X86_64 To Arm64 The problem of migration .

  • Existing ability :Rainbond It is a software delivery application , Or a cloud native application management platform that applies O & M management . Whether it's rapid delivery deployment , Or application management 、 monitor 、 iteration 、 disaster , The existing functions can already meet the daily needs of the delivery operation and maintenance personnel .
  • Containerization Technology :Rainbond Based on the container technology , Container is a lightweight virtualization technology in Arm64 The field has been brilliant . Since the container supports multiple architectures , Most open source middleware already provides basic images based on different architectures ,Arm64 Nature is the standard configuration . Choose containerization Technology , It is equivalent to choosing Arm64 Ecological support .
  • Self compatible Arm64 :Rainbond Started to adapt the localization framework very early , It adapts itself to include Arm64 Multiple architectures including .
  • Minimalist development environment deployment : Rainbond It has been supported to run on various personal platforms Docker Desktop Environment , Developers only need to use a computer with M1 Chip MacBook , You can spend ten minutes to build your own Rainbond Arm64 development environment , Convenient to the extreme .
  • Source code construction is compatible Arm64 : This is to get through the migration to Arm64 The last part of the architecture . stay Rainbond in , Developers can do without changing a line of code , Directly use the source code to build your own business components , It can be deployed and run on Arm64 Environment . at present Rainbond Source code construction has supported many mainstream languages on the market , Various extended dependencies around the language itself have become complete .

Rainbond compatible Arm64

Rainbond The cloud native application management platform can be deployed in Arm64 Environment . from 2020 year 1 Month begins ,Rainbond And Huawei respectively 、 Feiteng conducted the adaptation test . After verification ,Rainbond stay Kunpeng 920 Chip and FT2000+/64 These two paragraphs Arm64 The chip can run stably , Meet the standards available for production .

For personal development ,Rainbond And it's going on . at present ,Rainbond Support in a variety of individuals PC Under platform utilization Docker Desktop function . We will Rainbond All components of are integrated into one container , This approach allows individual developers to simplify the process , Take ten minutes to run your own development and testing environment . For the use of M1 Chip MacBook For individual developers , It is equivalent to based on Arm64 The architecture was developed .

Arm64 Source code compilation in

Rainbond The ability to compile source code has a long history . This function comes from Heroku/buildpack project , And by the Rainbond The team has done a lot of optimization for their own needs . With its ability , Users can source code based on multiple languages , Skip authoring Dockerfile The process of , Complete the containerization of business . Source code compilation is the simplest way to deploy enterprises to develop their own businesses , You only need to provide the warehouse address of the source code .

at present Arm64 The languages and versions supported by source code compilation are as follows :

Language support

Versioning support

Extended support

Java: Maven/Jar/War/Gradle

openjdk 8 / 9 / 10 / 11 / 12 / 13

pinpoint agent jmx-exporter

Node.js

Node 4.9.1 / 5.12.0 / 6.14.4 / 7.10.1 / 8.9.3 / 8.12.0 / 9.11.2 / 10.13.0 / 11.1.0

Yarn 1.9.4

Node.js The front-end project (VUE React)

Node 4.9.1 / 5.12.0 / 6.14.4 / 7.10.1 / 8.9.3 / 8.12.0 / 9.11.2 / 10.13.0 / 11.1.0

Yarn 1.9.4 Nginx 1.18.0

Golang

Go 1.8 / 1.9 / 1.10 / 1.11 / 1.12 / 1.13 / 1.14 / 1.15 / 1.16

Python

Python 2.7.9 / 2.7.17 / 3.4.9 / 3.5.7 / 3.6.6 / 3.6.10

PHP

PHP 5.5.38 / 5.6.32~37 / 7.0.29 / 7.1.27 / 7.2.16 / 7.3.3

apcu / ev / event / imgick memcached / mongodb oauth / phalcon pq / raphf / redis

Html

Nginx 1.18.0 / Apache Httpd 2.2.19

Build function adaptation in the source code Arm64 after , Users do not need to containerize the business themselves , Just provide the source code . This experience , It can be called zero cost migration of business to Arm64 In containers . It greatly reduces the technical burden of developers , Reduced migration adaptation costs . And in the process , Code running environment processing 、 The processing of extension dependencies has been done by Rainbond Arm64 Source code construction capability processing is completed .

The principle of source code construction is not complicated :

  • be based on Builder Provide a unified build environment , According to the characteristics of the business source code , Select the corresponding language buildpack Script .
  • according to buildpack Different scripts , And users in Rainbond The version specified in the console , Will store... From third-party objects (Rainbond AliyunOSS) Download the corresponding language runtime environment precompiled package ( Such as Openjdk) Prepare the basic compilation environment .
  • Perform the precompile process , According to the user in Rainbond Compilation features defined in the console ( Such as relying on the warehouse address ) Configure the compilation environment .
  • According to the user in Rainbond Compile commands specified by the console , Or default values for each language , Start compiling . Specific operations will be performed according to language characteristics , For example, execute hook function 、 Download the specified extension (PHP Expand ) etc. .
  • Package the finished products , Packing format , yes Heroku Style Slug package .
  • be based on Runner As a basic mirror , union Slug Packages are packaged into business container images , Automatic decompression at runtime Slug package , According to the startup command specified by the user , Complete the final run .

The entire build process has a real-time push log , For developers , It is not much different from compiling in your own development environment . While compiling , Need to provide Arm64 Supported include : Runtime precompiled package 、 Expand 、Nginx/Httpd The middle price has been officially adjusted , It saves the developer's effort , Lost a lot of hair .

Newly installed Rainbond platform , When you first build the source code , Can pull builder and runner Mirror image , This process takes a few minutes . Already in Arm64 Installed in the environment Rainbond Users of , You can execute the following commands , Pull the latest image , To get Arm64 Source code compilation capability .

With MacBook M1 It's installed on the computer Rainbond For example , Get into rainbond-allinone Operating in a container :

docker exec -ti rainbond-allinone bash

Get the login password of the built-in image warehouse , Log in to the image warehouse :

hubpassword=$(kubectl get rainbondcluster -o yaml -n rbd-system | grep password | awk '{print $2}')
docker login --username=admin --password=${hubpassword} goodrain.me

Dealing with images :

images=(builder runner)
for image in ${images[@]}
  do
    docker pull registry.cn-hangzhou.aliyuncs.com/goodrain/${image}:v5.5.0-release
    docker tag registry.cn-hangzhou.aliyuncs.com/goodrain/${image}:v5.5.0-release goodrain.me/${image}
    docker push goodrain.me/${image}
  done

Rainbond Provides sample code , It can be used for source code construction and testing .

After starting the build , The real-time push build log will pop up automatically , For developers to understand the construction progress .

The following information is provided in the current log :

  • Code warehouse address
  • Latest code submission information
  • The first source code build pull builder Mirror image ( This process pulls... Only in the first build )
  • Identify build environment CPU framework , At present, it is linux-arm64
  • Identify the language and how it is built , At present, it is Java-maven
  • Locale version , Will currently download Arm64 Environment available openjdk1.8
  • install Java Language capability expansion , Include Pinpoint APM agent and jmx-exporter
  • install Maven Constructing environment , current version 3.3.9
  • Execute the build command .

The next output , And standard Java-maven Build output is the same , It's a download pom And dependent processes . After the build is complete , Output log :

This completes the code compilation process , Next ,runner Will use the compiled and packaged slug File continue to build image , And complete the push to the built-in image warehouse :

First build , Can pull runner Mirror image , This behavior will only happen once .

thus , The source code has become a working container image , The image can be displayed in Arm64 Running in the environment .

Continuous delivery

When developers successfully deploy their business systems in Rainbond Arm64 After... In the environment ,Rainbond Existing delivery process , Can maximize the reduction to Arm64 The difficulty of environmental delivery . By publishing the business system as an application template , You get the standard deliverables that can be delivered to the final production environment . Whether exported as an offline package , Or based on online RainStore deliver , Can be very convenient to achieve . For subsequent processes, refer to previous articles or official documents .

Use Rainbond Realize offline environment software delivery

原网站

版权声明
本文为[Rainbow open source]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201121854510360.html