File: thread_limit.rst

package info (click to toggle)
groonga 9.0.0-1%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 101,496 kB
  • sloc: ansic: 608,707; ruby: 35,042; xml: 23,643; cpp: 10,319; sh: 7,453; yacc: 5,968; python: 3,033; makefile: 2,609; perl: 133
file content (110 lines) | stat: -rw-r--r-- 2,631 bytes parent folder | download | duplicates (5)
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
.. -*- rst -*-

.. highlightlang:: none

.. groonga-command
.. database: commands_thread_limit

.. groonga-command
.. thread_limit 2

``thread_limit``
================

Summary
-------

.. versionadded:: 5.0.7

``thread_limit`` has the following two features:

  * It returns the max number of threads.
  * It sets the max number of threads.

:doc:`/reference/executables/groonga` is the only Groonga server that
supports full ``thread_limit`` features.

:doc:`/reference/executables/groonga-httpd` supports only one feature
that returns the max number of threads. The max number of threads of
:doc:`/reference/executables/groonga-httpd` always returns ``1``
because :doc:`/reference/executables/groonga-httpd` uses single thread
model.

If you're using Groonga as a library, ``thread_limit`` doesn't work
without you set custom functions by
:c:func:`grn_thread_set_get_limit_func()` and
:c:func:`grn_thread_set_set_limit_func()`. If you set a function by
:c:func:`grn_thread_set_get_limit_func()`, the feature that returns
the max number of threads works. If you set a function by
:c:func:`grn_thread_set_set_limit_func()`, the feature that sets the
max number of threads works.

Syntax
------

This command takes only one optional parameter::

  thread_limit [max=null]

Usage
-----

You can get the max number of threads by calling without any parameters:

.. groonga-command
.. include:: ../../example/reference/commands/thread_limit/usage_get.log
.. thread_limit

If it returns ``0``, your Groonga server doesn't support the feature.

You can set the max number of threads by calling ``max`` parameter:

.. groonga-command
.. include:: ../../example/reference/commands/thread_limit/usage_set.log
.. thread_limit --max 4

It returns the previous max number of threads when you pass
``max`` parameter.

Parameters
----------

This section describes all parameters.

Required parameters
^^^^^^^^^^^^^^^^^^^

There is no required parameter.

Optional parameters
^^^^^^^^^^^^^^^^^^^

There is one optional parameter.

.. _thread-limit-max:

``max``
"""""""

Specifies the new max number of threads.

You must specify positive integer:

.. groonga-command
.. include:: ../../example/reference/commands/thread_limit/max.log
.. thread_limit --max 3

If you specify ``max`` parameter, ``thread_limit`` returns the
max number of threads before ``max`` is applied.

Return value
------------

The command returns the max number of threads as body::

  [HEADER, N_MAX_THREADS]

If ``max`` is specified, ``N_MAX_THREADS`` is the max number of
threads before ``max`` is applied.

See :doc:`/reference/command/output_format` for ``HEADER``.