热门标签 | 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

推荐阅读
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 主要用了2个类来实现的,话不多说,直接看运行结果,然后在奉上源代码1.Index.javaimportjava.awt.Color;im ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 本文介绍了如何通过配置 Android Studio 和 Gradle 来显著提高构建性能,涵盖内存分配优化、并行构建和性能分析等实用技巧。 ... [详细]
  • 深入理解Vue.js:从入门到精通
    本文详细介绍了Vue.js的基础知识、安装方法、核心概念及实战案例,帮助开发者全面掌握这一流行的前端框架。 ... [详细]
  • Symfony是一个功能强大的PHP框架,以其依赖注入(DI)特性著称。许多流行的PHP框架如Drupal和Laravel的核心组件都基于Symfony构建。本文将详细介绍Symfony的安装方法及其基本使用。 ... [详细]
  • 利用jstack进行死锁检测与线程堆栈分析
    本文介绍了如何使用jstack工具进行Java应用中的死锁检测及高CPU使用率线程的堆栈分析,帮助开发者快速定位并解决性能瓶颈。 ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • Android 渐变圆环加载控件实现
    本文介绍了如何在 Android 中创建一个自定义的渐变圆环加载控件,该控件已在多个知名应用中使用。我们将详细探讨其工作原理和实现方法。 ... [详细]
  • Coursera ML 机器学习
    2019独角兽企业重金招聘Python工程师标准线性回归算法计算过程CostFunction梯度下降算法多变量回归![选择特征](https:static.oschina.n ... [详细]
  • 探讨如何修复Visual Studio Code中JavaScript的智能感知和自动完成功能在特定场景下无法正常工作的问题,包括配置检查、语言模式选择以及类型注释的使用。 ... [详细]
  • InmyapplicationIhaveQGraphicsScenewithpixmapaddedandallisviewedinQGraphicsViewwithsc ... [详细]
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社区 版权所有