詹金斯大师与奴隶能力计划



背景

任何人都可以对詹金斯大师在容量规划方面的责任提供一些见解。

我当前有一个主人和从设置,其中主是一个强大的EC2 t2.micro,但从属是t2.medium

主人时不时地死亡,并且存在与内存错误有关的错误,并且在检查项目时无法分配内存。Jenkins已配置为-Xmx768m

我已经验证了构建是否与从属节点相关,而不是主节点。主人已配置0个执行者,作业显示为从属上运行(1个执行程序)。

示例错误

这就是这样的示例

 ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/xyz.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:130)
    at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:262)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:421)
Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://github.com/xyz.git +refs/pull/16/head:refs/remotes/origin/PR-16 +refs/heads/develop:refs/remotes/origin/develop" returned status code 128:
stdout: 
stderr: error: cannot fork() for fetch-pack: Cannot allocate memory
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1990)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1709)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:400)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
    ... 8 more

我的问题

从资源利用的角度来看,主人在本设置中的作用是什么?我以为是奴隶正在检查项目和建筑物(而不是母校)。 - 因此,为什么我将更多的资源分配给从存储器,CPU,磁盘容量和IOPS方面。

除了集中式插件配置外,我没想到主人通过SSH在奴隶上启动代理人以外的角色(从MEM/CPU的角度来看,我期望成为强化工作)。<<<<<<<<<</p>

在短期内,我计划将主人升级为更强大的EC2实例类型,但是,最好了解主人真正需要的内容,以确保我正确地计划容量,并且不必要地提供远处的提供太多。

如果您在构建日志中遇到此错误,并且您已通过请求节点标签或减少执行者的数量来将构建脚本在从奴隶上运行在主人到0上,然后结帐将发生在构建代理中。

如果是这样,那么记忆的用完不是您的主人,而是您的奴隶。

我会尝试增加slave.jar的堆大小。如何做到这将取决于您如何射击奴隶。

从詹金斯文档中的这个位中,您会看到它读取:

这些Windows服务的JVM启动参数分别由XML文件jenkins.xml jenkins-slave.xml 控制。这些文件可以在$ jenkins_home和从属根目录中分别找到,因为您将其安装为Windows服务。文件格式应该是自称的。调整参数例如,为JVM提供更大的内存

但是,如果您使用java -jar slave.jar从命令行启动它们,则应在这里使用Xmx参数。也许您正在运行代理的框确实有足够的内存,但是Jenkins代理只是不使用它。

另外,这是Jenkins Wiki中的一个非常有趣的页面,涵盖了如何尺寸的大师和奴隶。

最新更新