Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 1256

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- overload</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/sasl-2.2.1.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>System Application Support Libraries (SASL)</strong><br><strong>Reference Manual</strong><br><small>Version 2.2.1</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li title="sasl (App)"><a href="sasl_app.html">sasl (App)
                </a></li>
<li id="no" title="alarm_handler " expanded="false">alarm_handler<ul>
<li><a href="alarm_handler.html">
                  Top of manual page
                </a></li>
<li title="clear_alarm-1"><a href="alarm_handler.html#clear_alarm-1">clear_alarm/1</a></li>
<li title="get_alarms-0"><a href="alarm_handler.html#get_alarms-0">get_alarms/0</a></li>
<li title="set_alarm-1"><a href="alarm_handler.html#set_alarm-1">set_alarm/1</a></li>
</ul>
</li>
<li id="loadscrollpos" title="overload " expanded="true">overload<ul>
<li><a href="overload.html">
                  Top of manual page
                </a></li>
<li title="request-0"><a href="overload.html#request-0">request/0</a></li>
<li title="get_overload_info-0"><a href="overload.html#get_overload_info-0">get_overload_info/0</a></li>
</ul>
</li>
<li id="no" title="rb " expanded="false">rb<ul>
<li><a href="rb.html">
                  Top of manual page
                </a></li>
<li title="filter-1"><a href="rb.html#filter-1">filter/1</a></li>
<li title="filter-2"><a href="rb.html#filter-2">filter/2</a></li>
<li title="grep-1"><a href="rb.html#grep-1">grep/1</a></li>
<li title="h-0"><a href="rb.html#h-0">h/0</a></li>
<li title="help-0"><a href="rb.html#help-0">help/0</a></li>
<li title="list-0"><a href="rb.html#list-0">list/0</a></li>
<li title="list-1"><a href="rb.html#list-1">list/1</a></li>
<li title="rescan-0"><a href="rb.html#rescan-0">rescan/0</a></li>
<li title="rescan-1"><a href="rb.html#rescan-1">rescan/1</a></li>
<li title="show-0"><a href="rb.html#show-0">show/0</a></li>
<li title="show-1"><a href="rb.html#show-1">show/1</a></li>
<li title="start-0"><a href="rb.html#start-0">start/0</a></li>
<li title="start-1"><a href="rb.html#start-1">start/1</a></li>
<li title="start_log-1"><a href="rb.html#start_log-1">start_log/1</a></li>
<li title="stop-0"><a href="rb.html#stop-0">stop/0</a></li>
<li title="stop_log-0"><a href="rb.html#stop_log-0">stop_log/0</a></li>
</ul>
</li>
<li id="no" title="release_handler " expanded="false">release_handler<ul>
<li><a href="release_handler.html">
                  Top of manual page
                </a></li>
<li title="check_install_release-1"><a href="release_handler.html#check_install_release-1">check_install_release/1</a></li>
<li title="check_install_release-2"><a href="release_handler.html#check_install_release-2">check_install_release/2</a></li>
<li title="create_RELEASES-4"><a href="release_handler.html#create_RELEASES-4">create_RELEASES/4</a></li>
<li title="install_file-2"><a href="release_handler.html#install_file-2">install_file/2</a></li>
<li title="install_release-1"><a href="release_handler.html#install_release-1">install_release/1</a></li>
<li title="install_release-2"><a href="release_handler.html#install_release-2">install_release/2</a></li>
<li title="make_permanent-1"><a href="release_handler.html#make_permanent-1">make_permanent/1</a></li>
<li title="remove_release-1"><a href="release_handler.html#remove_release-1">remove_release/1</a></li>
<li title="reboot_old_release-1"><a href="release_handler.html#reboot_old_release-1">reboot_old_release/1</a></li>
<li title="set_removed-1"><a href="release_handler.html#set_removed-1">set_removed/1</a></li>
<li title="set_unpacked-2"><a href="release_handler.html#set_unpacked-2">set_unpacked/2</a></li>
<li title="unpack_release-1"><a href="release_handler.html#unpack_release-1">unpack_release/1</a></li>
<li title="which_releases-0"><a href="release_handler.html#which_releases-0">which_releases/0</a></li>
<li title="which_releases-1"><a href="release_handler.html#which_releases-1">which_releases/1</a></li>
<li title="upgrade_app-2"><a href="release_handler.html#upgrade_app-2">upgrade_app/2</a></li>
<li title="downgrade_app-2"><a href="release_handler.html#downgrade_app-2">downgrade_app/2</a></li>
<li title="downgrade_app-3"><a href="release_handler.html#downgrade_app-3">downgrade_app/3</a></li>
<li title="upgrade_script-2"><a href="release_handler.html#upgrade_script-2">upgrade_script/2</a></li>
<li title="downgrade_script-3"><a href="release_handler.html#downgrade_script-3">downgrade_script/3</a></li>
<li title="eval_appup_script-4"><a href="release_handler.html#eval_appup_script-4">eval_appup_script/4</a></li>
</ul>
</li>
<li id="no" title="systools " expanded="false">systools<ul>
<li><a href="systools.html">
                  Top of manual page
                </a></li>
<li title="make_relup-3"><a href="systools.html#make_relup-3">make_relup/3</a></li>
<li title="make_relup-4"><a href="systools.html#make_relup-4">make_relup/4</a></li>
<li title="make_script-1"><a href="systools.html#make_script-1">make_script/1</a></li>
<li title="make_script-2"><a href="systools.html#make_script-2">make_script/2</a></li>
<li title="make_tar-1"><a href="systools.html#make_tar-1">make_tar/1</a></li>
<li title="make_tar-2"><a href="systools.html#make_tar-2">make_tar/2</a></li>
<li title="script2boot-1"><a href="systools.html#script2boot-1">script2boot/1</a></li>
</ul>
</li>
<li title="appup"><a href="appup.html">appup</a></li>
<li title="rel"><a href="rel.html">rel</a></li>
<li title="relup"><a href="relup.html">relup</a></li>
<li title="script"><a href="script.html">script</a></li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>overload</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">overload</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">An Overload Regulation Process</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p><span class="code">overload</span> is a process which indirectly regulates CPU
      usage in the system. The idea is that a main application calls
      the <span class="code">request/0</span> function before starting a major job, and
      proceeds with the job if the return value is positive; otherwise
      the job must not be started.
      </p>
    <p><span class="code">overload</span> is part of the <span class="code">sasl</span> application, and all
      configuration parameters are defined there.
      </p>
    <p>A set of two intensities are maintained, the <span class="code">total intensity</span> and the <span class="code">accept intensity</span>. For that purpose
      there are two configuration parameters, the <span class="code">MaxIntensity</span>
      and the <span class="code">Weight</span> value (both are measured in 1/second).
      </p>
    <p>Then total and accept intensities are calculated as
      follows. Assume that the time of the current call to
      <span class="code">request/0</span> is <span class="code">T(n)</span>, and that the time of the
      previous call was <span class="code">T(n-1)</span>.
      </p>
    <ul>
      <li>
        <p>The current <span class="code">total intensity</span>, denoted
          <span class="code">TI(n)</span>, is calculated according to the formula,
          </p>
        <p><span class="code">TI(n) = exp(-Weight*(T(n) - T(n-1)) * TI(n-1) +  Weight</span>,
          </p>
        <p>where <span class="code">TI(n-1)</span> is the previous total intensity.
          </p>
      </li>
      <li>
        <p>The current <span class="code">accept intensity</span>, denoted
          <span class="code">AI(n)</span>, is determined by the formula,
          </p>
        <p><span class="code">AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1) + Weight</span>,
          </p>
        <p>where <span class="code">AI(n-1)</span> is the previous accept intensity,
          provided that the value of <span class="code">exp(-Weight*(T(n) - T(n-1)) * AI(n-1)</span> is less than <span class="code">MaxIntensity</span>; otherwise the
          value is
          </p>
        <p><span class="code">AI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1)</span>.
          </p>
      </li>
    </ul>
    <p>The value of configuration parameter <span class="code">Weight</span> controls the
      speed with which the calculations of intensities will react to
      changes in the underlying input intensity. The inverted value of
      <span class="code">Weight</span>,
      </p>
    <p><span class="code">T = 1/Weight</span></p>
    <p>can be thought of as the "time constant"
      of the intensity calculation formulas. For example, if <span class="code">Weight = 0.1</span>, then a change in the underlying input intensity will be
      reflected in the <span class="code">total</span> and <span class="code">accept intensities</span> within
      approximately 10 seconds.
      </p>
    <p>The overload process defines one alarm, which it sets using
      <span class="code">alarm_handler:set_alarm(Alarm)</span>.  <span class="code">Alarm</span> is defined
      as:
      </p>
    <dl>
      <dt><strong><span class="code">{overload, []}</span></strong></dt>
      <dd>
        <p>This alarm is set when the current accept intensity exceeds
          <span class="code">MaxIntensity</span>. 
          </p>
      </dd>
    </dl>
    <p>A new overload alarm is not set until the current accept
      intensity has fallen below <span class="code">MaxIntensity</span>. To prevent the
      overload process from generating a lot of set/reset alarms, the
      alarm is not reset until the current accept intensity has fallen
      below 75% of <span class="code">MaxIntensity</span>, and it is not until then that
      the alarm can be set again.
      </p>
  </p></div>
  <h3>EXPORTS</h3>
    <p><a name="request-0"><span class="bold_code">request() -&gt; accept | reject</span></a><br></p>
<div class="REFBODY"><p>
        <p>Returns <span class="code">accept</span> or <span class="code">reject</span> depending on the
          current value of the accept intensity.  </p>
        <p>The application
          calling this function should be processed with the job in
          question if the return value is <span class="code">accept</span>; otherwise it
          should not continue with that job.
          </p>
      </p></div>
    <p><a name="get_overload_info-0"><span class="bold_code">get_overload_info() -&gt; OverloadInfo</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">OverloadInfo = [{total_intensity, TotalIntensity}, {accept_intensity, AcceptIntensity}, {max_intensity, MaxIntensity}, {weight, Weight}, {total_requests, TotalRequests}, {accepted_requests, AcceptedRequests}].</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TotalIntensity = float() &gt; 0</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">AcceptIntensity = float() &gt; 0</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">MaxIntensity = float() &gt; 0</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Weight = float() &gt; 0</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">TotalRequests = integer()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">AcceptedRequests = integer()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the current total and accept intensities, the
          configuration parameters, and absolute counts of the total
          number of requests, and accepted number of requests (since
          the overload process was started).</p>
      </p></div>
  

  <h3><a name="id64890">See Also</a></h3>
<div class="REFBODY">
    
    <p>alarm_handler(3), sasl(3)
      </p>
  </div>
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>