GitHub user NohSeho opened a pull request:

    https://github.com/apache/zeppelin/pull/2060

    [ZEPPELIN-2094] Decrease npm install retry time

    ### What is this PR for?
    It’s too delayed for npm install when computer do not connected any 
networks.
    Beacause when npm install, it has too long retry timeout.
    This PR is to decrease retry timeout when npm install.
    
    
    ### What type of PR is it?
    Improvement
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/ZEPPELIN-2094
    
    ### How should this be tested?
    Line 197 In zeppelin-zengine 
org.apache.zeppelin.helium.HeliumBundleFactory.java
    
    First set with 
    `String npmCommand = "install —loglevel=error”;`
    and You don’t connect any ethernet or wireless internet.
    build & run
    
    and set with
    `String npmCommand = "install —fetch-retries=2 —fetch-retry-factor=1 
—fetch-retry-mintimeout=5000 —loglevel=error”;`
    also don’t connect any networks, build & run.
    
    WHY
    retries = 2
    factor = 1
    mintimeout = 5(sec)?
    
    npm use [retry](https://github.com/tim-kos/node-retry) module to retry.
    It refers [this 
article](http://dthain.blogspot.kr/2009/02/exponential-backoff-in-distributed.html)
 for retry algorithms.
    It is a math which structured _Math.min(Math.round(random * minTimeout * 
Math.pow(factor, attempt)), maxTimeout)_.
    
    So before, zeppelin use npm's default setting
    random = False = 1
    retry = 2
    minTimeout = 10(sec)
    maxTimeout = 60(sec)
    factor = 10
    
    First retry
    _Math.min(1 * 10(sec) * Math.pow(10, 1), 60(sec))_
    then, _Math.min(10(sec) * 10^1, 60(sec))_ -> _Math.min(100(sec), 60(sec))_ 
= _100sec_ wating for first retry
    
    and Second
    _Math.min(1 * 10(sec) * Math.pow(10, 2), 60(sec))_
    then, _Math.min(10(sec) * 10^2, 60(sec))_ -> _Math.min(10(sec) * 100, 
60(sec))_ -> _Math.min(1000(sec), 60(sec))_ = _60sec_ wating for second retry
    
    approximately 160sec, 2min 40sec wating for two times retries.
    
    But it's too long to run server when no networks.
    
    So decrease like that you see above.
    
    First retry
    _Math.min(1 * 5(sec) * Math.pow(1, 1), 60(sec))_
    then, _Math.min(5(sec) * 1^1, 60(sec))_ -> _Math.min(5(sec), 60(sec)_ = 
_5sec_ wating for first retry
    
    and Second
    _Math.min(1 * 5(sec) * Math.pow(1, 2), 60(sec))_
    then, _Math.min(5(sec) * 1^2, 60(sec))_ -> _Math.min(5(sec), 60(sec)_ = 
_5sec_ wating for second retry
    
    approximately 10sec waiting for two times retries.
    
    You can check like this below Screenshots.
    
    ### Screenshots
    <img width="1077" alt="2017-02-24 12 32 06" 
src="https://cloud.githubusercontent.com/assets/1144643/23267951/9deaec6e-fa2f-11e6-9171-5792f24de76d.png";>
    <img width="1081" alt="2017-02-24 12 37 10" 
src="https://cloud.githubusercontent.com/assets/1144643/23267954/a12c0c0a-fa2f-11e6-99cd-335deef607ac.png";>
    
    
    ### Questions:
    * Does the licenses files need update? N/A
    * Is there breaking changes for older versions? N/A
    * Does this needs documentation? N/A

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/NohSeho/zeppelin ZEPPELIN-2094

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zeppelin/pull/2060.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2060
    
----
commit b3fe1886df3d8d64c4aced5672d0f98bb5ad4241
Author: NohSeho <[email protected]>
Date:   2017-02-23T15:59:57Z

    [ZEPPELIN-2094] Decrease npm install retry time

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to