File: comparison.html

package info (click to toggle)
groonga 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,576 kB
  • sloc: ansic: 801,209; javascript: 62,121; ruby: 46,206; cpp: 33,790; xml: 24,951; yacc: 13,333; sh: 7,776; python: 3,266; makefile: 2,315; perl: 133
file content (447 lines) | stat: -rw-r--r-- 21,283 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447


<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>5.2.1. Comparison &#8212; Groonga v10.1.1-31-g1e46ba6 documentation</title>
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="5.2.2. groonga" href="groonga.html" />
    <link rel="prev" title="5.2. 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">日本語</a></li>
    </ul>
  </div>
</div>
  

    <div class="related" role="navigation" aria-label="related navigation">
      <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="5.2.2. groonga"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../http.html" title="5.2. HTTP"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../server.html" ><span class="section-number">5. </span>Server</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../http.html" accesskey="U"><span class="section-number">5.2. </span>HTTP</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">5.2.1. </span>Comparison</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="comparison">
<h1><span class="section-number">5.2.1. </span>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"><span class="doc">groonga</span></a> and
<a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a>. Here is a comparison table.</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 38%" />
<col style="width: 32%" />
<col style="width: 30%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"></th>
<th class="head"><p>groonga</p></th>
<th class="head"><p>groonga-httpd</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Performance</p></td>
<td><p>o</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-odd"><td><p>Using multi CPU cores</p></td>
<td><p>o (by multi threading)</p></td>
<td><p>o (by multi process)</p></td>
</tr>
<tr class="row-even"><td><p>Configuration file</p></td>
<td><p>optional</p></td>
<td><p>required</p></td>
</tr>
<tr class="row-odd"><td><p>Custom prefix path</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-even"><td><p>Custom command version</p></td>
<td><p>o</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-odd"><td><p>Multi databases</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-even"><td><p>Authentication</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-odd"><td><p>Gzip compression</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-even"><td><p>POST</p></td>
<td><p>o</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-odd"><td><p>HTTPS</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-even"><td><p>Access log</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
<tr class="row-odd"><td><p>Upgrading without downtime</p></td>
<td><p>x</p></td>
<td><p>o</p></td>
</tr>
</tbody>
</table>
<div class="section" id="performance">
<h2><span class="section-number">5.2.1.1. </span>Performance<a class="headerlink" href="#performance" title="Permalink to this headline">¶</a></h2>
<p>Both <a class="reference internal" href="groonga.html"><span class="doc">groonga</span></a> and <a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a> are very fast. They can
work with the same throughput.</p>
</div>
<div class="section" id="using-multi-cpu-cores">
<h2><span class="section-number">5.2.1.2. </span>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"><span class="doc">groonga</span></a> scales by multi
threading. <a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a> scales by multi processes.</p>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></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"><span class="doc">groonga-httpd</span></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
<code class="docutils literal notranslate"><span class="pre">worker_processes</span> <span class="pre">8</span></code> in configuration file like the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>worker_processes 8;

http {
  # ...
}
</pre></div>
</div>
</div>
<div class="section" id="configuration-file">
<h2><span class="section-number">5.2.1.3. </span>Configuration file<a class="headerlink" href="#configuration-file" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></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"><span class="doc">groonga</span></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"><span class="doc">groonga</span></a>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>% groonga --protocol http -d /PATH/TO/DATABASE
</pre></div>
</div>
<p><a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></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"><span class="doc">groonga-httpd</span></a>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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><span class="section-number">5.2.1.4. </span>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"><span class="doc">groonga</span></a> accepts a path that starts with <code class="docutils literal notranslate"><span class="pre">/d/</span></code> as command URL
such as <code class="docutils literal notranslate"><span class="pre">http://localhost:10041/d/status</span></code>. You cannot change the
prefix path <code class="docutils literal notranslate"><span class="pre">/d/</span></code>.</p>
<p><a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a> can custom prefix path. For example, you can use
<code class="docutils literal notranslate"><span class="pre">http://localhost:10041/api/status</span></code> as command URL. Here is a sample
configuration to use <code class="docutils literal notranslate"><span class="pre">/api/</span></code> as prefix path:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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><span class="section-number">5.2.1.5. </span>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"><span class="doc">Command version</span></a> mechanism. It is for
upgrading groonga commands with backward compatibility.</p>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></a> can change the default command veresion by
<code class="docutils literal notranslate"><span class="pre">--default-command-version</span></code> option. Here is a sample command line to
use command version 2 as the default command version:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>% groonga --protocol http --default-command-version 2 -d /PATH/TO/DATABASE
</pre></div>
</div>
<p><a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></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"><span class="doc">groonga-httpd</span></a> process. Here is a sample configuration to
provide command version 1 commands under <code class="docutils literal notranslate"><span class="pre">/api/1/</span></code> and command
version 2 comamnds under <code class="docutils literal notranslate"><span class="pre">/api/2/</span></code>:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>events {
}

http {
  server {
    listen 10041;

    groonga_database /PATH/TO/DATABASE;

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

    location /api/2/ {
      groonga on;
      groonga_default_command_version 2;
    }
  }
}
</pre></div>
</div>
</div>
<div class="section" id="multi-databases">
<h2><span class="section-number">5.2.1.6. </span>Multi databases<a class="headerlink" href="#multi-databases" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></a> can use only one database in a process.</p>
<p><a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a> can use one or more databases in a process. Here
is a sample configuration to provide <code class="docutils literal notranslate"><span class="pre">/tmp/db1</span></code> database under
<code class="docutils literal notranslate"><span class="pre">/db1/</span></code> path and <code class="docutils literal notranslate"><span class="pre">/tmp/db2</span></code> database under <code class="docutils literal notranslate"><span class="pre">/db2/</span></code> path:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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><span class="section-number">5.2.1.7. </span>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"><span class="doc">shutdown</span></a>.</p>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></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"><span class="doc">groonga-httpd</span></a> supports basic authentication. Here is a sample
configuration to restrict use of <a class="reference internal" href="../../reference/commands/shutdown.html"><span class="doc">shutdown</span></a>
command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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><span class="section-number">5.2.1.8. </span>Gzip compression<a class="headerlink" href="#gzip-compression" title="Permalink to this headline">¶</a></h2>
<p>HTTP supports response compression by gzip with <code class="docutils literal notranslate"><span class="pre">Content-Encoding:</span>
<span class="pre">gzip</span></code> response header. It can reduce network flow. It is useful
for large search response.</p>
<p><a class="reference internal" href="groonga.html"><span class="doc">groonga</span></a> doesn’t support compression. To support compression,
reverse proxy is needed.</p>
<p><a class="reference internal" href="groonga-httpd.html"><span class="doc">groonga-httpd</span></a> supports gzip compression. Here is a sample
configuration to compress response by gzip:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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"><span class="doc">groonga-httpd</span></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"><span class="doc">groonga-httpd</span></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><span class="section-number">5.2.1.9. </span>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><p><cite>Content-Type</cite> header value must be <cite>application/json</cite>.</p></li>
<li><p>JSON data is sent as body.</p></li>
<li><p>Table name is specified by query parameter such as <code class="docutils literal notranslate"><span class="pre">table=NAME</span></code>.</p></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 notranslate"><div class="highlight"><pre><span></span>% 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><span class="section-number">5.2.1.10. </span>HTTPS<a class="headerlink" href="#https" title="Permalink to this headline">¶</a></h2>
<p>TODO</p>
</div>
<div class="section" id="access-log">
<h2><span class="section-number">5.2.1.11. </span>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><span class="section-number">5.2.1.12. </span>Upgrading without downtime<a class="headerlink" href="#upgrading-without-downtime" title="Permalink to this headline">¶</a></h2>
<p>TODO</p>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">5.2.1. Comparison</a><ul>
<li><a class="reference internal" href="#performance">5.2.1.1. Performance</a></li>
<li><a class="reference internal" href="#using-multi-cpu-cores">5.2.1.2. Using multi CPU cores</a></li>
<li><a class="reference internal" href="#configuration-file">5.2.1.3. Configuration file</a></li>
<li><a class="reference internal" href="#custom-prefix-path">5.2.1.4. Custom prefix path</a></li>
<li><a class="reference internal" href="#custom-command-version">5.2.1.5. Custom command version</a></li>
<li><a class="reference internal" href="#multi-databases">5.2.1.6. Multi databases</a></li>
<li><a class="reference internal" href="#authentication">5.2.1.7. Authentication</a></li>
<li><a class="reference internal" href="#gzip-compression">5.2.1.8. Gzip compression</a></li>
<li><a class="reference internal" href="#post">5.2.1.9. POST</a></li>
<li><a class="reference internal" href="#https">5.2.1.10. HTTPS</a></li>
<li><a class="reference internal" href="#access-log">5.2.1.11. Access log</a></li>
<li><a class="reference internal" href="#upgrading-without-downtime">5.2.1.12. Upgrading without downtime</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../http.html"
                        title="previous chapter"><span class="section-number">5.2. </span>HTTP</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="groonga.html"
                        title="next chapter"><span class="section-number">5.2.2. </span>groonga</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <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="5.2.2. groonga"
             >next</a> |</li>
        <li class="right" >
          <a href="../http.html" title="5.2. HTTP"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../server.html" ><span class="section-number">5. </span>Server</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../http.html" ><span class="section-number">5.2. </span>HTTP</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">5.2.1. </span>Comparison</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2009-2021, Brazil, Inc.
    </div>
  </body>
</html>