gunicorn/doc/htdocs/faq.html
2010-05-30 14:36:06 -04:00

120 lines
6.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Green Unicorn - FAQ</title>
<link rel="alternate" type="application/rss+xml" href="/feed.xml" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
</head>
<body>
<div class="container">
<div id="header">
<a href="./">
<img src="images/logo.png" alt="Gunicorn - Green Unicorn" />
</a>
</div>
<div id="menu">
<ul id="actions">
<li><a href="install.html">Install</a></li>
<li><a href="run.html">Run</a></li>
<li><a href="configure.html">Configure</a></li>
<li><a href="deploy.html">Deploy</a></li>
<li><a href="design.html">Design</a><li>
<li><a href="faq.html">FAQ</a></li>
<li><a href="news.html">News</a></li>
<li><a href="http://github.com/benoitc/gunicorn/">Code</a></li>
</ul>
</div>
<div id="content">
<div class="document">
<div class="contents topic" id="questions">
<p class="topic-title first">Questions</p>
<ul class="simple">
<li><a class="reference internal" href="#wsgi-bits" id="id1">WSGI Bits</a><ul>
<li><a class="reference internal" href="#how-do-i-set-script-name" id="id2">How do I set SCRIPT_NAME?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#server-stuff" id="id3">Server Stuff</a><ul>
<li><a class="reference internal" href="#how-do-i-reload-my-application-in-gunicorn" id="id4">How do I reload my application in Gunicorn?</a></li>
<li><a class="reference internal" href="#how-might-i-test-a-proxy-configuration" id="id5">How might I test a proxy configuration?</a></li>
<li><a class="reference internal" href="#how-can-i-name-processes" id="id6">How can I name processes?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#worker-processes" id="id7">Worker Processes</a><ul>
<li><a class="reference internal" href="#how-do-i-know-which-type-of-worker-to-use" id="id8">How do I know which type of worker to use?</a></li>
<li><a class="reference internal" href="#what-types-of-workers-are-there" id="id9">What types of workers are there?</a></li>
<li><a class="reference internal" href="#how-can-i-figure-out-the-best-number-of-worker-processes" id="id10">How can I figure out the best number of worker processes?</a></li>
<li><a class="reference internal" href="#how-can-i-change-the-number-of-workers-dynamically" id="id11">How can I change the number of workers dynamically?</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="wsgi-bits">
<h2><a class="toc-backref" href="#questions">WSGI Bits</a></h2>
<div class="section" id="how-do-i-set-script-name">
<h3><a class="toc-backref" href="#questions">How do I set SCRIPT_NAME?</a></h3>
<p>By default <tt class="docutils literal">SCRIPT_NAME</tt> is an empy string. The value could be set by
setting <tt class="docutils literal">SCRIPT_NAME</tt> in the environment or as an HTTP header.</p>
</div>
</div>
<div class="section" id="server-stuff">
<h2><a class="toc-backref" href="#questions">Server Stuff</a></h2>
<div class="section" id="how-do-i-reload-my-application-in-gunicorn">
<h3><a class="toc-backref" href="#questions">How do I reload my application in Gunicorn?</a></h3>
<p>You can gracefully reload by sending HUP signal to gunicorn:</p>
<pre class="literal-block">
$ kill -HUP masterpid
</pre>
</div>
<div class="section" id="how-might-i-test-a-proxy-configuration">
<h3><a class="toc-backref" href="#questions">How might I test a proxy configuration?</a></h3>
<p>The <a class="reference external" href="http://ha.ckers.org/slowloris/">Slowloris</a> script is a great way to test that your proxy is correctly
buffering responses for the synchronous workers.</p>
</div>
<div class="section" id="how-can-i-name-processes">
<h3><a class="toc-backref" href="#questions">How can I name processes?</a></h3>
<p>If you install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a> Gunicorn will set the process
names to something a bit more meaningful. This will affect the output you see
in tools like <tt class="docutils literal">ps</tt> and <tt class="docutils literal">top</tt>. This helps for distinguishing the master
process as well as between masters when running more than one app on a single
machine. See the <a class="reference external" href="/configure.html#proc-name">proc_name</a> setting for more information.</p>
</div>
</div>
<div class="section" id="worker-processes">
<h2><a class="toc-backref" href="#questions">Worker Processes</a></h2>
<div class="section" id="how-do-i-know-which-type-of-worker-to-use">
<h3><a class="toc-backref" href="#questions">How do I know which type of worker to use?</a></h3>
<p>Read the <a class="reference external" href="/design.html">design</a> page for help on the various worker types.</p>
</div>
<div class="section" id="what-types-of-workers-are-there">
<h3><a class="toc-backref" href="#questions">What types of workers are there?</a></h3>
<p>Check out the configuration docs for <a class="reference external" href="/configure.html#worker-class">worker_class</a></p>
</div>
<div class="section" id="how-can-i-figure-out-the-best-number-of-worker-processes">
<h3><a class="toc-backref" href="#questions">How can I figure out the best number of worker processes?</a></h3>
<p>Here is our recommendation for tuning the <a class="reference external" href="/design.html#how-many-workers">number of workers</a>.</p>
</div>
<div class="section" id="how-can-i-change-the-number-of-workers-dynamically">
<h3><a class="toc-backref" href="#questions">How can I change the number of workers dynamically?</a></h3>
<blockquote>
<p>To increase the worker count by one:</p>
<pre class="literal-block">
$ kill -TTIN $masterpid
</pre>
<p>To decrease the worker count by one:</p>
<pre class="literal-block">
$ kill -TTOU $masterpid
</pre>
</blockquote>
</div>
</div>
</div>
</div>
<div id="footer">
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.</p>
<p>Hosted on <a href="http://github.com/">Github</a></p>
</div>
</div>
</body>
</html>