简体   繁体   English

目标中的-T10C和-T4C -am是什么意思

[英]What is the meaning of -T10C and -T4C -am in goals

我想知道 -T4C 和 -T10C 之间的区别以及这多个内核将如何影响构建时间。

The help output of Maven via mvn --help will print out the following for -T : Maven 通过mvn --help的帮助输出将为-T打印以下内容:

 -T,--threads <arg>                     Thread count, for instance 2.0C
                                        where C is core multiplied

The first part of the answer to that is:答案的第一部分是:

If you have for example a machine which has 5 cores it will run your build with 4 * 5 threads (in case of -T4C ) which means 20 threads in total.例如,如果您有一台具有 5 个内核的机器,它将使用4 * 5线程(在-T4C的情况下)运行您的构建,这意味着总共有 20 个线程。 Or assuming you have given -T10C results in 10 * 5 which means 50 threads.或者假设你给了-T10C结果10 * 5这意味着 50 个线程。

So far the theory.理论到此为止。

The first thing is you have to have a multi module build which contains a number of modules.第一件事是你必须有一个包含多个模块的多模块构建。 Based on the dependencies between the modules you could decrease your buildtime by using something like mvn clean verify -T3 but that dependends on the number of modules and their dependencies between each other.根据模块之间的依赖关系,您可以使用mvn clean verify -T3 -T3 之类的方法来减少构建时间,但这取决于模块的数量及其相互之间的依赖关系。 In general the more modules you have the more you decrease the buildtime but that highly depends on the dependency structure of your modules.一般来说,你拥有的模块越多,构建时间就越短,但这在很大程度上取决于模块的依赖结构。

In a single module build this will usually not descrease the build time.在单个模块构建中,这通常不会减少构建时间。 It can descrease the whole build time dependending how your unit tests/integration test setup is done and how many unit- and/or integration tests you have.它可以减少整个构建时间,具体取决于您的单元测试/集成测试设置的完成方式以及您拥有的单元和/或集成测试的数量。

So the rule of thumb is simply to try to build your whole project with -T3 and check if your buildtime descreases if so next time try to use -T6 (assuming you have enough cores)...因此,经验法则是简单地尝试使用-T3构建整个项目并检查构建时间是否减少,如果是的话,下次尝试使用-T6 (假设您有足够的内核)......

Only if you have a very large number of modules (100+) you can try with higher numbers if you like...只有当您有大量模块(100 多个)时,如果您愿意,您可以尝试使用更多的模块...

So most of the times you can simply try to build with mvn -T1C that means the same number of threads as the number of CPU cores you have ...因此,大多数时候您可以简单地尝试使用mvn -T1C构建,这意味着线程数与您拥有的 CPU 内核数相同......

In the end it depends on the number of modules you have and the relationship between the modules...最后,这取决于您拥有的模块数量以及模块之间的关系......

You need to measure the build times with each different parameter of -TXXX to find the most performant way..您需要使用-TXXX的每个不同参数测量构建时间,以找到最高效的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM