Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > e450e7f3d6075c4a54de19e68d38177f > files > 320

groonga-doc-3.0.5-1.fc18.x86_64.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>7.3.1. Comparison &mdash; groonga v3.0.5 documentation</title>
    
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '3.0.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="top" title="groonga v3.0.5 documentation" href="../../index.html" />
    <link rel="up" title="7.3. HTTP" href="../http.html" />
    <link rel="next" title="7.3.2. groonga" href="groonga.html" />
    <link rel="prev" title="7.3. HTTP" href="../http.html" /> 
  </head>
  <body>
<div class="header">
  <h1 class="title">
    <a id="top-link" href="../../index.html">
      <span class="project">groonga</span>
      <span class="separator">-</span>
      <span class="description">An open-source fulltext search engine and column store.</span>
    </a>
  </h1>

  <div class="other-language-links">
    <ul>
      <li><a href="../../../../ja/html/server/http/comparison.html"><img src="../../_static/jp.png" alt="日本語">日本語版はこちら</a></li>
    </ul>
  </div>
</div>
  

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="groonga.html" title="7.3.2. groonga"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../http.html" title="7.3. HTTP"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../../server.html" >7. Server</a> &raquo;</li>
          <li><a href="../http.html" accesskey="U">7.3. HTTP</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="comparison">
<h1>7.3.1. Comparison<a class="headerlink" href="#comparison" title="Permalink to this headline">¶</a></h1>
<p>There are many differences between <a class="reference internal" href="groonga.html"><em>groonga</em></a> and
<a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a>. Here is a comparison table.</p>
<table border="1" class="docutils">
<colgroup>
<col width="38%" />
<col width="32%" />
<col width="30%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">&nbsp;</th>
<th class="head">groonga</th>
<th class="head">groonga-httpd</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>Performance</td>
<td>o</td>
<td>o</td>
</tr>
<tr class="row-odd"><td>Using multi CPU cores</td>
<td>o (by multi threading)</td>
<td>o (by multi process)</td>
</tr>
<tr class="row-even"><td>Configuration file</td>
<td>optional</td>
<td>required</td>
</tr>
<tr class="row-odd"><td>Custom prefix path</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-even"><td>Custom command version</td>
<td>o</td>
<td>x (comming soon)</td>
</tr>
<tr class="row-odd"><td>Multi databases</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-even"><td>Authentication</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-odd"><td>Gzip compression</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-even"><td>POST</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-odd"><td>HTTPS</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-even"><td>Access log</td>
<td>x</td>
<td>o</td>
</tr>
<tr class="row-odd"><td>Upgrading without downtime</td>
<td>x</td>
<td>o</td>
</tr>
</tbody>
</table>
<div class="section" id="performance">
<h2>7.3.1.1. Performance<a class="headerlink" href="#performance" title="Permalink to this headline">¶</a></h2>
<p>Both <a class="reference internal" href="groonga.html"><em>groonga</em></a> and <a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> are very fast. They can
work with the same throughput.</p>
</div>
<div class="section" id="using-multi-cpu-cores">
<h2>7.3.1.2. Using multi CPU cores<a class="headerlink" href="#using-multi-cpu-cores" title="Permalink to this headline">¶</a></h2>
<p>Groonga scales on multi CPU cores. <a class="reference internal" href="groonga.html"><em>groonga</em></a> scales by multi
threading. <a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> scales by multi processes.</p>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> uses the same number of threads as CPU cores by
default. If you have 8 CPU cores, 8 threads are used by default.</p>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> uses 1 process by default. You need to set
<a class="reference external" href="http://nginx.org/en/docs/ngx_core_module.html#worker_processes">worker_processes</a>
directive to use CPU cores. If you have 8 CPU cores, specify
<tt class="docutils literal"><span class="pre">worker_processes</span> <span class="pre">8</span></tt> in configuration file like the following:</p>
<div class="highlight-none"><div class="highlight"><pre>worker_processes 8;

http {
  # ...
}
</pre></div>
</div>
</div>
<div class="section" id="configuration-file">
<h2>7.3.1.3. Configuration file<a class="headerlink" href="#configuration-file" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> can work without configuration file. All configuration
items such as port number and the max number of threads can be
specified by command line. Configuration file is also used to specify
configuration items.</p>
<p>It's very easy to run groonga HTTP server because <a class="reference internal" href="groonga.html"><em>groonga</em></a>
requires just a few options to run. Here is the most simple command
line to start HTTP server by <a class="reference internal" href="groonga.html"><em>groonga</em></a>:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga --protocol http -d /PATH/TO/DATABASE
</pre></div>
</div>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> requires configuration file to run. Here is the
most simple configuration file to start HTTP server by
<a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a>:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    location /d/ {
      groonga on;
      groonga_database /PATH/TO/DATABASE;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="custom-prefix-path">
<h2>7.3.1.4. Custom prefix path<a class="headerlink" href="#custom-prefix-path" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> accepts a path that starts with <tt class="docutils literal"><span class="pre">/d/</span></tt> as command URL
such as <tt class="docutils literal"><span class="pre">http://localhost:10041/d/status</span></tt>. You cannot change the
prefix path <tt class="docutils literal"><span class="pre">/d/</span></tt>.</p>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> can custom prefix path. For example, you can use
<tt class="docutils literal"><span class="pre">http://localhost:10041/api/status</span></tt> as command URL. Here is a sample
configuration to use <tt class="docutils literal"><span class="pre">/api/</span></tt> as prefix path:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    location /api/ { # &lt;- change this
      groonga on;
      groonga_database /PATH/TO/DATABASE;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="custom-command-version">
<h2>7.3.1.5. Custom command version<a class="headerlink" href="#custom-command-version" title="Permalink to this headline">¶</a></h2>
<p>Groonga has <a class="reference internal" href="../../reference/command/command_version.html"><em>コマンドバージョン</em></a> mechanism. It is for
upgrading groonga commands with backward compatibility.</p>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> can change the default command veresion by
<tt class="docutils literal"><span class="pre">--default-command-version</span></tt> option. Here is a sample command line to
use command version 2 as the default command version:</p>
<div class="highlight-none"><div class="highlight"><pre>% groonga --protocol http --default-command-version 2 -d /PATH/TO/DATABASE
</pre></div>
</div>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> cannot custom the default command version
yet. But it will be supported soon. If it is supported, you can
provides different command version groonga commands in the same
<a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> process. Here is a sample configuration to
provide command version 1 commands under <tt class="docutils literal"><span class="pre">/api/1/</span></tt> and command
version 2 comamnds under <tt class="docutils literal"><span class="pre">/api/2/</span></tt>:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    groonga_database /PATH/TO/DATABASE;

    location /api/1/ {
      groonga on;
      groogna_default_command_version 1;
    }

    location /api/2/ {
      groonga on;
      groogna_default_command_version 2;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="multi-databases">
<h2>7.3.1.6. Multi databases<a class="headerlink" href="#multi-databases" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> can use only one database in a process.</p>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> can use one or more databases in a process. Here
is a sample configuration to provide <tt class="docutils literal"><span class="pre">/tmp/db1</span></tt> database under
<tt class="docutils literal"><span class="pre">/db1/</span></tt> path and <tt class="docutils literal"><span class="pre">/tmp/db2</span></tt> database under <tt class="docutils literal"><span class="pre">/db2/</span></tt> path:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    location /db1/ {
      groonga on;
      groonga_database /tmp/db1;
    }

    location /db2/ {
      groonga on;
      groonga_database /tmp/db2;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="authentication">
<h2>7.3.1.7. Authentication<a class="headerlink" href="#authentication" title="Permalink to this headline">¶</a></h2>
<p>HTTP supports authentications such as basic authentication and digest
authentication. It can be used for restricting use of danger command such
as <a class="reference internal" href="../../reference/commands/shutdown.html"><em>shutdown</em></a>.</p>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> doesn't support any authentications. To restrict use of
danger command, other tools such as iptables and reverse proxy are
needed.</p>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> supports basic authentication. Here is a sample
configuration to restrict use of <a class="reference internal" href="../../reference/commands/shutdown.html"><em>shutdown</em></a>
command:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    groonga_database /PATH/TO/DATABASE;

    location /d/shutdown {
      groonga on;
      auth_basic           &quot;manager is required!&quot;;
      auth_basic_user_file &quot;/etc/managers.htpasswd&quot;;
    }

    location /d/ {
      groonga on;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="gzip-compression">
<h2>7.3.1.8. Gzip compression<a class="headerlink" href="#gzip-compression" title="Permalink to this headline">¶</a></h2>
<p>HTTP supports response compression by gzip with <tt class="docutils literal"><span class="pre">Content-Encoding:</span>
<span class="pre">gzip</span></tt> response header. It can reduce network flow. It is useful
for large search response.</p>
<p><a class="reference internal" href="groonga.html"><em>groonga</em></a> doesn't support compression. To support compression,
reverse proxy is needed.</p>
<p><a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> supports gzip compression. Here is a sample
configuration to compress response by gzip:</p>
<div class="highlight-none"><div class="highlight"><pre>events {
}

http {
  server {
    listen 10041;

    groonga_database /PATH/TO/DATABASE;

    location /d/ {
      groonga    on;
      gzip       on;
      gzip_types *;
    }
  }
}
</pre></div>
</div>
<p>Note that <cite>gzip_types *</cite> is specified. It's one of the important
configuration. <cite>gzip_types</cite> specifies gzip target data formats by MIME
types. <a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> returns one of JSON, XML or MessagePack
format data. But those formats aren't included in the default value of
<cite>gzip_types</cite>. The default value of <cite>gzip_types</cite> is <cite>text/html</cite>.</p>
<p>To compress response data from <a class="reference internal" href="groonga-httpd.html"><em>groonga-httpd</em></a> by gzip, you need
to specify <cite>gzip_types *</cite> or <cite>gzip_types application/json text/xml
application/x-msgpack</cite> explicitly. <cite>gzip_types *</cite> is recommended.
There are two reasons for it. The first, groonga may support more
formats in the future. The second, all requests for the <cite>location</cite> are
processed by groonga. You don't need to consider about other modules.</p>
</div>
<div class="section" id="post">
<h2>7.3.1.9. POST<a class="headerlink" href="#post" title="Permalink to this headline">¶</a></h2>
<p>You can load your data by POST JSON data. You need follow the
following rules to use loading by POST.</p>
<ul class="simple">
<li><cite>Content-Type</cite> header value must be <cite>application/json</cite>.</li>
<li>JSON data is sent as body.</li>
<li>Table name is specified by query parameter such as <tt class="docutils literal"><span class="pre">table=NAME</span></tt>.</li>
</ul>
<p>Here is an example curl command line that loads two users <cite>alice</cite> and
<cite>bob</cite> to <cite>Users</cite> table:</p>
<div class="highlight-none"><div class="highlight"><pre>% curl --data-binary &#39;[{&quot;_key&quot;: &quot;alice&quot;}, {&quot;_key&quot;: &quot;bob&quot;}]&#39; -H &quot;Content-Type: application/json&quot; &quot;http://localhost:10041/d/load?table=Users&quot;
</pre></div>
</div>
</div>
<div class="section" id="https">
<h2>7.3.1.10. HTTPS<a class="headerlink" href="#https" title="Permalink to this headline">¶</a></h2>
<p>TODO</p>
</div>
<div class="section" id="access-log">
<h2>7.3.1.11. Access log<a class="headerlink" href="#access-log" title="Permalink to this headline">¶</a></h2>
<p>TODO</p>
</div>
<div class="section" id="upgrading-without-downtime">
<h2>7.3.1.12. Upgrading without downtime<a class="headerlink" href="#upgrading-without-downtime" title="Permalink to this headline">¶</a></h2>
<p>TODO</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">7.3.1. Comparison</a><ul>
<li><a class="reference internal" href="#performance">7.3.1.1. Performance</a></li>
<li><a class="reference internal" href="#using-multi-cpu-cores">7.3.1.2. Using multi CPU cores</a></li>
<li><a class="reference internal" href="#configuration-file">7.3.1.3. Configuration file</a></li>
<li><a class="reference internal" href="#custom-prefix-path">7.3.1.4. Custom prefix path</a></li>
<li><a class="reference internal" href="#custom-command-version">7.3.1.5. Custom command version</a></li>
<li><a class="reference internal" href="#multi-databases">7.3.1.6. Multi databases</a></li>
<li><a class="reference internal" href="#authentication">7.3.1.7. Authentication</a></li>
<li><a class="reference internal" href="#gzip-compression">7.3.1.8. Gzip compression</a></li>
<li><a class="reference internal" href="#post">7.3.1.9. POST</a></li>
<li><a class="reference internal" href="#https">7.3.1.10. HTTPS</a></li>
<li><a class="reference internal" href="#access-log">7.3.1.11. Access log</a></li>
<li><a class="reference internal" href="#upgrading-without-downtime">7.3.1.12. Upgrading without downtime</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../http.html"
                        title="previous chapter">7.3. HTTP</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="groonga.html"
                        title="next chapter">7.3.2. groonga</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/server/http/comparison.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="groonga.html" title="7.3.2. groonga"
             >next</a> |</li>
        <li class="right" >
          <a href="../http.html" title="7.3. HTTP"
             >previous</a> |</li>
        <li><a href="../../index.html">groonga v3.0.5 documentation</a> &raquo;</li>
          <li><a href="../../server.html" >7. Server</a> &raquo;</li>
          <li><a href="../http.html" >7.3. HTTP</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Brazil, Inc.
    </div>
  </body>
</html>