##############一些概念和小技巧#########################
git clone https://gitee.com/fastsource/flink
如何判断当前版本是什么型号呢?
看各种jar包的后缀名,如果是1.12就表示最新版本号是1.12了
flink-streaming-java_2.11-1.12-SNAPSHOT.jar
#######################################
/home/appleyuchi/桌面/flink的配置实验/flink/flink-runtime-web/pom.xml中
准备工作
nvm install v12.11.1(angular支持的最新nodejs版本,绝对不能比这个版本再高了)
npm config set registry http://registry.npm.taobao.org/
npm install --sass-binary-path="linux-x64-72_binding.node"(v12版本的node-sass)
npm config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
npm install -g @angular/cli
使用全局npm/nodejs编译web部分[3]
如果怕编译失败,浪费时间,可以
先测试编译环境是否正常:
只保留
注释掉其他所有module
mvn clean install -T 2C -DskipTests -Dmaven.compile.fork=true
整体编译:
flink/pom.xml恢复原样 (取消原来的注释)
mvn clean install -T 2C -DskipTests -Dmaven.compile.fork=true
编译耗时:
[INFO] Total time: 14:11 min (Wall Clock)
[INFO] Finished at: 2020-06-15T19:01:35+08:00
[3]编译思路:
①npm编译(只有runtime-web这个模块)和maven编译分别进行,不要混在一起.
②前者npm编译成功后,再进行整体maven编译.
#################################附录-失败经历###############################
尝试一:
-T 2C的意思是机器开启超线程工作.(我的电脑是四核八线程)
-Dmaven.compile.fork=true的意思是多核编译.
到底是2C,1.5C还是1C在不同参考资料上有不通说法,下面进行实测,到底哪个快?
使用命令(下面的Dskip.npm是错误的,不要模仿) | 耗时 |
mvn clean install -T 1C -DskipTests -Dskip.npm -Dmaven.compile.fork=true | Total time: 15:54 min (Wall Clock) |
mvn clean install -T 1.5C -DskipTests -Dskip.npm -Dmaven.compile.fork=true | Total time: 15:30 min (Wall Clock) |
mvn clean install -T 2C -DskipTests -Dskip.npm -Dmaven.compile.fork=true | Total time: 13:52 min (Wall Clock) |
注意:
多核优势只能在编译部分(CPU密集)发挥,
并不能在下载依赖部分(CPU I/O)发挥
上述评测是基于之前第一次已经下载过依赖包,所以能大大节省依赖部分消耗的时间
Wall Clock的含义可以参考[1]
测试过程中可以看到CPU占有率:
编译后发现webui不能打开,JIRA上被告知是不能有Dskip.npm
这个尝试虽然是错误的,但是知道了2C是能最大限度发挥超线程能力的.
并且发现超线程没有传说中的20%,从耗时上来看,比单线程提高了大概10%的性能.
尝试二:
猜测flink编译可能需要全局提供的Angular
遇到下面的报错
[ERROR] Node.js version v10.9.0 detected.
[ERROR] The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.
[ERROR]
[ERROR] Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
[ERROR]
[ERROR] Aborted (core dumped)
[INFO] /home/appleyuchi/桌面/Flink超线程测试/flink/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java: Some input files use or override a deprecated API.
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 134
[ERROR] npm ERR! [email protected] build: `ng build --prod --base-href ./`
[ERROR] npm ERR! Exit status 134
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the [email protected] build script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[INFO] /home/appleyuchi/桌面/Flink超线程测试/flink/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java: Recompile with -Xlint:deprecation for details.
[INFO] /home/appleyuchi/桌面/Flink超线程测试/flink/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java: Some input files use unchecked or unsafe operations.
[INFO] /home/appleyuchi/桌面/Flink超线程测试/flink/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ flink-cep_2.11 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 57 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ flink-cep_2.11 ---
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR! /home/appleyuchi/.npm/_logs/2020-06-15T06_16_37_162Z-debug.log
[INFO] ------------------------------------------------------------------------[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR! /home/appleyuchi/.npm/_logs/2020-06-15T06_16_37_162Z-debug.log
[INFO] ------------------------------------------------------------------------
尝试三:
根据[2]查询v10.9.0对应的angular版本为8.3.25
nvm install v10.9.0
切换到10.9.0版本
npm install -g @angular/[email protected]无法安装core dumped
--------------------------------------------------------------------------------------------------------------------------------------------
上面流程总共JIRA+钉钉骚扰了阿里四个人,总算是跑通了,反正骚扰一下总是可以的,恩.
编译了至少有二十几次吧,才最后成功.
Reference:
[1]CPU time与WALL time
[2]Is there a compatibility list for Angular / Angular-CLI and Node.js?
[3]在package-lock.json中指定node-mass版本+独立编译flink中的flink-runtime-web模块