热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

OptimizenpmInstallRetryTimeinBranch0.7

Thispullrequestaimstooptimizethenpminstallretrytimeinbranch0.7,reducingdelayscausedbylongtimeoutswhennonetworkconnectionisavailable.

Purpose of This Pull Request

This pull request targets branch 0.7 and addresses the issue of excessive delay during npm install when the machine is not connected to any network. The root cause is the lengthy retry timeout configured for npm install operations. This PR introduces a reduction in the retry timeout to mitigate these delays. It is related to the master branch PR: https://github.com/apache/zeppelin/pull/2095.

Type of Pull Request

Enhancement

Jira Issue

https://issues.apache.org/jira/browse/ZEPPELIN-2094

Testing Instructions

To test this change, you need to have at least one Helium visualization enabled. The specific changes can be found on line 221 of the file zeppelin-zengine/org.apache.zeppelin.helium.HeliumVisualizationFactory.java.

First, configure the npm install command as follows:

1
String commandForNpmInstall = "install --loglevel=error";

Then, disconnect from all network connections and perform a build and run operation.

Next, modify the command to include custom retry parameters:

1
2
3
4
String commandForNpmInstall =
String.format("install --fetch-retries=%d --fetch-retry-factor=%d "+
"--fetch-retry-mintimeout=%d",
FETCH_RETRY_COUNT, FETCH_RETRY_FACTOR_COUNT, FETCH_RETRY_MIN_TIMEOUT);

Again, ensure there is no network connection, and then build and run the application.

Additionally, perform the same steps on line 345, where an npm install operation for a specific artifact is executed.

Explanation of Parameters

The following table explains the impact of the changes made to the retry parameters:

DescriptionBeforeAfter
Conditionnpm's default settingsCustom settings
Random factorFalse = 1False = 1
Retry count22
Minimum timeout (sec)105
Maximum timeout (sec)6060
Factor101
First retry calculationMath.round(1 * 10 * 10^1)Math.round(1 * 5 * 1^1)
First retry result (approx.)100 sec5 sec
Second retry calculationMath.min(Math.round(1 * 10 * 10^2), 60)Math.min(Math.round(1 * 5 * 1^2), 60)
Second retry result (approx.)60 sec5 sec
Total waiting time (approx.)160 sec10 sec

These changes significantly reduce the total waiting time for npm install operations when no network is available.

Screenshots

Below are screenshots comparing the behavior before and after the changes:

BeforeAfter
Image placeholderImage placeholder

推荐阅读
author-avatar
odile微笑头
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有