m1-test
m1-test copied to clipboard
MacBook Pro 2016 & AMD EPYC 7642 Test Result
晚上看见测试视频,我觉得蛮有意思,自己也找不同环境的测试了一番 包括Sun JDK11,Zulu JDK16
在我的MacBook Pro (15-inch, 2016) 的测试成绩如下: 配置信息: CPU 2.7 GHz 四核Intel Core i7 OS:Big Sur 内存:16 GB 2133 MHz LPDDR3 JDK:OpenJDK Runtime Environment Zulu16+59-CA (build 16-ea+24) mvn clean -T 1C -Drat.skip=true compile -offline
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.443 s (Wall Clock) [INFO] Finished at: 2020-12-15T14:24:27+08:00 [INFO] ------------------------------------------------------------------------
在一台48线程96核的AMD EPYC 7642 服务器上 CPU:EPYC 7642 2.3G 96线程 内存:1TB OS:CentOS 8 JDK:OpenJDK Runtime Environment Zulu16+59-CA (build 16-ea+24)
mvn clean -T 1C -Drat.skip=true compile -offline [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.583 s (Wall Clock) [INFO] Finished at: 2020-12-15T02:42:15-05:00 [INFO] ------------------------------------------------------------------------
从监控上看,mvn还是很难利用服务器CPU这么多核心并行编译,基本上就是利用了4个C左右 M1 从多线程性能上肯定比不过96线程的服务器CPU,只是说在相对线程数量不多的情况下,优化的确不错
可以再做一些更多的benchmark,common-lang的代码还是太少
赞👍. 一开始也是想测大的代码库的. 最后找的小代码库, 一方面是这样能够节省我太多时间(我每个test都要跑多遍), 另一方面, 代码库大了编译过程会很吃内存, 而两台电脑的内存差得很远, 容易引入噪音. 用小的代码库, 两台电脑的内存差异成为最后performance差距的dominant因素的概率就小很多。(当然, 应该也是可以通过设置heap max size来控制这个因素)。
Test more JVM parameter
- GC使用了CMS/G1/ZeroGC(JDK16已经去掉了CMS GC)
- JVM 测试了-client和-server,-server能快100ms 通过参数,可以控制编译common-lang的时候使用CMS不发生GC,因为的确很小的一个class编译
- 使用默认的G1GC
如果不指定-Xms和-Xmx,会发生16次GC,但是影响就是100-200ms
-Xms4096m -Xmx4096m 发送3次GC,暂停<100ms
[INFO] Total time: 4.417 s (Wall Clock) [INFO] Finished at: 2020-12-16T11:38:46+08:00
-
使用CMS
-Xms4096m -Xmx4096m -XX:NewSize=1536m -XX:+UseConcMarkSweepGC -XX:MetaspaceSize=512m -Xlog:gc* 不发生GC Total time: 4.381 s (Wall Clock)
-
使用UseZGC(Zulu JDK16)### 更慢,跟我理解不符合 -Xms4096m -Xmx4096m -XX:+UseZGC -Xlog:gc*
[INFO] Compiling 212 source files to /Volumes/xinchun-data/workspace/gitrepo/github/commons-lang/target/classes [2.807s][info][gc,start ] GC(0) Garbage Collection (Metadata GC Threshold) [2.808s][info][gc,phases ] GC(0) Pause Mark Start 0.007ms [2.925s][info][gc,phases ] GC(0) Concurrent Mark 117.223ms [2.925s][info][gc,phases ] GC(0) Pause Mark End 0.092ms [2.942s][info][gc,phases ] GC(0) Concurrent Process Non-Strong References 16.684ms [2.942s][info][gc,phases ] GC(0) Concurrent Reset Relocation Set 0.001ms [2.963s][info][gc,phases ] GC(0) Concurrent Select Relocation Set 21.001ms [2.964s][info][gc,phases ] GC(0) Pause Relocate Start 0.048ms [3.029s][info][gc,phases ] GC(0) Concurrent Relocate 64.588ms [3.029s][info][gc,load ] GC(0) Load: 2.82/2.78/2.59 [3.029s][info][gc,mmu ] GC(0) MMU: 2ms/95.4%, 5ms/98.2%, 10ms/99.1%, 20ms/99.5%, 50ms/99.7%, 100ms/99.9% [3.029s][info][gc,marking ] GC(0) Mark: 1 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 1 completion(s), 0 continuation(s) [3.029s][info][gc,nmethod ] GC(0) NMethods: 4752 registered, 0 unregistered [3.029s][info][gc,metaspace] GC(0) Metaspace: 25M used, 25M committed, 1048M reserved [3.029s][info][gc,ref ] GC(0) Soft: 3437 encountered, 0 discovered, 0 enqueued [3.029s][info][gc,ref ] GC(0) Weak: 2680 encountered, 1481 discovered, 433 enqueued [3.029s][info][gc,ref ] GC(0) Final: 2 encountered, 2 discovered, 2 enqueued [3.029s][info][gc,ref ] GC(0) Phantom: 1070 encountered, 679 discovered, 102 enqueued [3.029s][info][gc,reloc ] GC(0) Small Pages: 168 / 336M(100%), Empty: 14M(4%), Compacting: 320M(95%)->28M(8%) [3.029s][info][gc,reloc ] GC(0) Medium Pages: 0 / 0M(0%), Empty: 0M(0%), Compacting: 0M(0%)->0M(0%) [3.029s][info][gc,reloc ] GC(0) Large Pages: 0 / 0M(0%), Empty: 0M(0%), Compacting: 0M(0%)->0M(0%) [3.029s][info][gc,reloc ] GC(0) Forwarding Usage: 9M [3.029s][info][gc,reloc ] GC(0) Relocation: Successful [3.029s][info][gc,heap ] GC(0) Min Capacity: 4096M(100%) [3.029s][info][gc,heap ] GC(0) Max Capacity: 4096M(100%) [3.029s][info][gc,heap ] GC(0) Soft Max Capacity: 4096M(100%) [3.029s][info][gc,heap ] GC(0) Mark Start Mark End Relocate Start Relocate End High Low [3.029s][info][gc,heap ] GC(0) Capacity: 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) [3.029s][info][gc,heap ] GC(0) Reserve: 42M (1%) 42M (1%) 42M (1%) 42M (1%) 42M (1%) 42M (1%) [3.029s][info][gc,heap ] GC(0) Free: 3718M (91%) 3680M (90%) 3694M (90%) 3984M (97%) 3986M (97%) 3680M (90%) [3.029s][info][gc,heap ] GC(0) Used: 336M (8%) 374M (9%) 360M (9%) 70M (2%) 374M (9%) 68M (2%) [3.029s][info][gc,heap ] GC(0) Live: - 25M (1%) 25M (1%) 25M (1%) - - [3.029s][info][gc,heap ] GC(0) Allocated: - 38M (1%) 38M (1%) 68M (2%) - - [3.029s][info][gc,heap ] GC(0) Garbage: - 310M (8%) 296M (7%) 4M (0%) - - [3.029s][info][gc,heap ] GC(0) Reclaimed: - - 14M (0%) 306M (7%) - - [3.029s][info][gc ] GC(0) Garbage Collection (Metadata GC Threshold) 336M(8%)->70M(2%) [5.051s][info][gc,start ] GC(1) Garbage Collection (Warmup) [5.051s][info][gc,phases ] GC(1) Pause Mark Start 0.006ms [5.394s][info][gc,phases ] GC(1) Concurrent Mark 342.822ms [5.394s][info][gc,phases ] GC(1) Pause Mark End 0.026ms [5.417s][info][gc,phases ] GC(1) Concurrent Process Non-Strong References 22.800ms [5.417s][info][gc,phases ] GC(1) Concurrent Reset Relocation Set 0.034ms [5.435s][info][gc,phases ] GC(1) Concurrent Select Relocation Set 18.345ms [5.436s][info][gc,phases ] GC(1) Pause Relocate Start 0.040ms [5.530s][info][gc,phases ] GC(1) Concurrent Relocate 94.625ms [5.531s][info][gc,load ] GC(1) Load: 2.75/2.77/2.59 [5.531s][info][gc,mmu ] GC(1) MMU: 2ms/95.4%, 5ms/98.2%, 10ms/99.1%, 20ms/99.5%, 50ms/99.7%, 100ms/99.9% [5.531s][info][gc,marking ] GC(1) Mark: 1 stripe(s), 2 proactive flush(es), 1 terminate flush(es), 0 completion(s), 0 continuation(s) [5.531s][info][gc,nmethod ] GC(1) NMethods: 8002 registered, 0 unregistered [5.531s][info][gc,metaspace] GC(1) Metaspace: 28M used, 28M committed, 1056M reserved [5.531s][info][gc,ref ] GC(1) Soft: 5484 encountered, 0 discovered, 0 enqueued [5.531s][info][gc,ref ] GC(1) Weak: 8230 encountered, 3417 discovered, 774 enqueued [5.531s][info][gc,ref ] GC(1) Final: 0 encountered, 0 discovered, 0 enqueued [5.531s][info][gc,ref ] GC(1) Phantom: 1196 encountered, 823 discovered, 229 enqueued [5.531s][info][gc,reloc ] GC(1) Small Pages: 193 / 386M(92%), Empty: 4M(1%), Compacting: 358M(86%)->54M(13%) [5.531s][info][gc,reloc ] GC(1) Medium Pages: 1 / 32M(8%), Empty: 0M(0%), Compacting: 0M(0%)->0M(0%) [5.531s][info][gc,reloc ] GC(1) Large Pages: 0 / 0M(0%), Empty: 0M(0%), Compacting: 0M(0%)->0M(0%) [5.531s][info][gc,reloc ] GC(1) Forwarding Usage: 12M [5.531s][info][gc,reloc ] GC(1) Relocation: Successful [5.531s][info][gc,heap ] GC(1) Min Capacity: 4096M(100%) [5.531s][info][gc,heap ] GC(1) Max Capacity: 4096M(100%) [5.531s][info][gc,heap ] GC(1) Soft Max Capacity: 4096M(100%) [5.531s][info][gc,heap ] GC(1) Mark Start Mark End Relocate Start Relocate End High Low [5.531s][info][gc,heap ] GC(1) Capacity: 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) 4096M (100%) [5.531s][info][gc,heap ] GC(1) Reserve: 42M (1%) 42M (1%) 42M (1%) 42M (1%) 42M (1%) 42M (1%) [5.531s][info][gc,heap ] GC(1) Free: 3636M (89%) 3590M (88%) 3588M (88%) 3886M (95%) 3886M (95%) 3584M (88%) [5.531s][info][gc,heap ] GC(1) Used: 418M (10%) 464M (11%) 466M (11%) 168M (4%) 470M (11%) 168M (4%) [5.531s][info][gc,heap ] GC(1) Live: - 73M (2%) 73M (2%) 73M (2%) - - [5.531s][info][gc,heap ] GC(1) Allocated: - 46M (1%) 52M (1%) 112M (3%) - - [5.531s][info][gc,heap ] GC(1) Garbage: - 344M (8%) 340M (8%) 40M (1%) - - [5.531s][info][gc,heap ] GC(1) Reclaimed: - - 4M (0%) 304M (7%) - - [5.531s][info][gc ] GC(1) Garbage Collection (Warmup) 418M(10%)->168M(4%) [INFO] /Volumes/xinchun-data/workspace/gitrepo/github/commons-lang/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java: 某些输入文件使用或覆盖了已过时的 API。 [INFO] /Volumes/xinchun-data/workspace/gitrepo/github/commons-lang/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 [INFO] /Volumes/xinchun-data/workspace/gitrepo/github/commons-lang/src/main/java/org/apache/commons/lang3/function/FailableToLongFunction.java: 某些输入文件使用了未经检查或不安全的操作。 [INFO] /Volumes/xinchun-data/workspace/gitrepo/github/commons-lang/src/main/java/org/apache/commons/lang3/function/FailableToLongFunction.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.896 s (Wall Clock) [INFO] Finished at: 2020-12-16T11:36:08+08:00 [INFO] ------------------------------------------------------------------------ [5.821s][info][gc,heap,exit] Heap [5.821s][info][gc,heap,exit] ZHeap used 226M, capacity 4096M, max capacity 4096M [5.821s][info][gc,heap,exit] Metaspace used 29002K, committed 29440K, reserved 1081344K [5.821s][info][gc,heap,exit] class space used 3670K, committed 3840K, reserved 1048576K
有没有简单的JAVA的运行性能测工具测试呢
如果是测试服务端性能,可以用JMeter https://jmeter.apache.org/ 可以配置各种参数做性能压测。不过需要你先启动个Server起来,相对而言基本上没有什么Java的桌面应用程序,一般而言,除了像Intelli IDEA等