Debian Codegraph @

doc/source/reference/commands/thread_limit.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_thread_limit
5
6 .. groonga-command
7 .. thread_limit 2
8
9 ``thread_limit``
10 ================
11
12 Summary
13 -------
14
15 .. versionadded:: 5.0.7
16
17 ``thread_limit`` has the following two features:
18
19 * It returns the max number of threads.
20 * It sets the max number of threads.
21
22 :doc:`/reference/executables/groonga` is the only Groonga server that
23 supports full ``thread_limit`` features.
24
25 :doc:`/reference/executables/groonga-httpd` supports only one feature
26 that returns the max number of threads. The max number of threads of
27 :doc:`/reference/executables/groonga-httpd` always returns ``1``
28 because :doc:`/reference/executables/groonga-httpd` uses single thread
29 model.
30
31 If you're using Groonga as a library, ``thread_limit`` doesn't work
32 without you set custom functions by
33 :c:func:`grn_thread_set_get_limit_func()` and
34 :c:func:`grn_thread_set_set_limit_func()`. If you set a function by
35 :c:func:`grn_thread_set_get_limit_func()`, the feature that returns
36 the max number of threads works. If you set a function by
37 :c:func:`grn_thread_set_set_limit_func()`, the feature that sets the
38 max number of threads works.
39
40 Syntax
41 ------
42
43 This command takes only one optional parameter::
44
45 thread_limit [max=null]
46
47 Usage
48 -----
49
50 You can get the max number of threads by calling without any parameters:
51
52 .. groonga-command
53 .. include:: ../../example/reference/commands/thread_limit/usage_get.log
54 .. thread_limit
55
56 If it returns ``0``, your Groonga server doesn't support the feature.
57
58 You can set the max number of threads by calling ``max`` parameter:
59
60 .. groonga-command
61 .. include:: ../../example/reference/commands/thread_limit/usage_set.log
62 .. thread_limit --max 4
63
64 It returns the previous max number of threads when you pass
65 ``max`` parameter.
66
67 Parameters
68 ----------
69
70 This section describes all parameters.
71
72 Required parameters
73 ^^^^^^^^^^^^^^^^^^^
74
75 There is no required parameter.
76
77 Optional parameters
78 ^^^^^^^^^^^^^^^^^^^
79
80 There is one optional parameter.
81
82 .. _thread-limit-max:
83
84 ``max``
85 """""""
86
87 Specifies the new max number of threads.
88
89 You must specify positive integer:
90
91 .. groonga-command
92 .. include:: ../../example/reference/commands/thread_limit/max.log
93 .. thread_limit --max 3
94
95 If you specify ``max`` parameter, ``thread_limit`` returns the
96 max number of threads before ``max`` is applied.
97
98 Return value
99 ------------
100
101 The command returns the max number of threads as body::
102
103 [HEADER, N_MAX_THREADS]
104
105 If ``max`` is specified, ``N_MAX_THREADS`` is the max number of
106 threads before ``max`` is applied.
107
108 See :doc:`/reference/command/output_format` for ``HEADER``.