yahns 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +5 -0
  3. data/.gitignore +2 -2
  4. data/Documentation/.gitignore +5 -2
  5. data/Documentation/GNUmakefile +25 -6
  6. data/Documentation/yahns-rackup.pod +178 -0
  7. data/Documentation/yahns.pod +96 -0
  8. data/Documentation/yahns_config.pod +658 -0
  9. data/GIT-VERSION-GEN +6 -5
  10. data/GNUmakefile +3 -3
  11. data/HACKING +2 -2
  12. data/README +6 -6
  13. data/Rakefile +7 -2
  14. data/bin/yahns +3 -2
  15. data/bin/yahns-rackup +3 -2
  16. data/examples/yahns_rack_basic.conf.rb +7 -2
  17. data/extras/README +2 -2
  18. data/extras/autoindex.rb +3 -2
  19. data/extras/exec_cgi.rb +3 -2
  20. data/extras/proxy_pass.rb +6 -5
  21. data/extras/try_gzip_static.rb +4 -3
  22. data/lib/yahns.rb +15 -9
  23. data/lib/yahns/acceptor.rb +4 -3
  24. data/lib/yahns/cap_input.rb +2 -1
  25. data/lib/yahns/client_expire_generic.rb +3 -2
  26. data/lib/yahns/client_expire_tcpi.rb +3 -2
  27. data/lib/yahns/config.rb +23 -18
  28. data/lib/yahns/daemon.rb +3 -2
  29. data/lib/yahns/fdmap.rb +3 -2
  30. data/lib/yahns/http_client.rb +4 -7
  31. data/lib/yahns/http_context.rb +13 -10
  32. data/lib/yahns/http_response.rb +8 -5
  33. data/lib/yahns/log.rb +3 -2
  34. data/lib/yahns/max_body.rb +2 -1
  35. data/lib/yahns/max_body/rewindable_wrapper.rb +3 -2
  36. data/lib/yahns/max_body/wrapper.rb +10 -5
  37. data/lib/yahns/openssl_client.rb +3 -2
  38. data/lib/yahns/openssl_server.rb +3 -2
  39. data/lib/yahns/proxy_http_response.rb +8 -7
  40. data/lib/yahns/proxy_pass.rb +7 -5
  41. data/lib/yahns/queue.rb +3 -2
  42. data/lib/yahns/queue_egg.rb +3 -2
  43. data/lib/yahns/queue_epoll.rb +4 -3
  44. data/lib/yahns/queue_kqueue.rb +4 -3
  45. data/lib/yahns/queue_quitter.rb +3 -2
  46. data/lib/yahns/queue_quitter_pipe.rb +3 -2
  47. data/lib/yahns/rack.rb +5 -4
  48. data/lib/yahns/rackup_handler.rb +4 -2
  49. data/lib/yahns/sendfile_compat.rb +5 -8
  50. data/lib/yahns/server.rb +14 -3
  51. data/lib/yahns/server_mp.rb +4 -2
  52. data/lib/yahns/sigevent.rb +3 -2
  53. data/lib/yahns/sigevent_efd.rb +3 -2
  54. data/lib/yahns/sigevent_pipe.rb +3 -2
  55. data/lib/yahns/socket_helper.rb +4 -2
  56. data/lib/yahns/stream_file.rb +3 -2
  57. data/lib/yahns/stream_input.rb +5 -4
  58. data/lib/yahns/tcp_server.rb +3 -2
  59. data/lib/yahns/tee_input.rb +4 -2
  60. data/lib/yahns/tmpio.rb +2 -1
  61. data/lib/yahns/unix_server.rb +3 -2
  62. data/lib/yahns/wbuf.rb +3 -2
  63. data/lib/yahns/wbuf_common.rb +4 -2
  64. data/lib/yahns/wbuf_str.rb +3 -2
  65. data/lib/yahns/worker.rb +3 -2
  66. data/test/covshow.rb +3 -2
  67. data/test/helper.rb +3 -2
  68. data/test/server_helper.rb +3 -2
  69. data/test/test_bin.rb +3 -2
  70. data/test/test_buffer_tmpdir.rb +3 -2
  71. data/test/test_client_expire.rb +5 -4
  72. data/test/test_client_max_body_size.rb +4 -3
  73. data/test/test_config.rb +3 -2
  74. data/test/test_expect_100.rb +5 -4
  75. data/test/test_extras_autoindex.rb +3 -2
  76. data/test/test_extras_exec_cgi.rb +4 -3
  77. data/test/test_extras_exec_cgi.sh +2 -2
  78. data/test/test_extras_proxy_pass.rb +3 -2
  79. data/test/test_extras_try_gzip_static.rb +3 -2
  80. data/test/test_fdmap.rb +3 -2
  81. data/test/test_input.rb +4 -3
  82. data/test/test_mt_accept.rb +3 -2
  83. data/test/test_output_buffering.rb +4 -3
  84. data/test/test_proxy_pass.rb +15 -14
  85. data/test/test_rack.rb +3 -2
  86. data/test/test_rack_hijack.rb +3 -2
  87. data/test/test_reopen_logs.rb +3 -2
  88. data/test/test_response.rb +3 -2
  89. data/test/test_serve_static.rb +2 -2
  90. data/test/test_server.rb +15 -14
  91. data/test/test_ssl.rb +60 -9
  92. data/test/test_stream_file.rb +3 -2
  93. data/test/test_tmpio.rb +3 -2
  94. data/test/test_unix_socket.rb +3 -2
  95. data/test/test_wbuf.rb +3 -2
  96. data/yahns.gemspec +5 -2
  97. metadata +21 -6
  98. data/Documentation/yahns-rackup.txt +0 -152
  99. data/Documentation/yahns.txt +0 -72
  100. data/Documentation/yahns_config.txt +0 -584
@@ -1,72 +0,0 @@
1
- % yahns(1) yahns user manual
2
- %
3
-
4
- # NAME
5
-
6
- yahns - multi-threaded, non-blocking application server for Ruby
7
-
8
- # SYNOPSYS
9
-
10
- yahns -c CONFIG_FILE [-D|--daemonize]
11
-
12
- # DESCRIPTION
13
-
14
- yahns(1) is the primary interface for launching a yahns application
15
- server. The configuration file is documented in yahns_config(5). yahns
16
- hosts Rack HTTP applications, but may support others in the future such
17
- as DRb.
18
-
19
- # SIGNALS
20
-
21
- The following UNIX signals may be sent to the running yahns process.
22
- If yahns is configured for worker_processes (optional), signals should
23
- only be sent to the master process.
24
-
25
- * INT/TERM/QUIT - graceful shutdown. If repeated (any of these signals
26
- is sent twice), shutdown occurs immediately.
27
- * USR1 - reopen all logs owned by the master and all workers.
28
- This scans the Ruby ObjectSpace for all open File objects with the O_APPEND
29
- file flag and buffering disabled (IO#sync==false)
30
- * USR2 - reexecute the running binary. A separate QUIT should be sent to
31
- * HUP - if worker_processes are not used, this will reexecute the running
32
- binary and gracefully exit the running process. If worker_processes are
33
- used, this will reload config file, app, and gracefully restart all workers
34
- * WINCH - gracefully stops workers but keep the master running.
35
- This will only work for daemonized processes and only if the
36
- worker_processes configuration directive is used.
37
- * TTIN - increment the number of worker processes by one
38
- (only if the worker_processes directive is used)
39
- * TTOU - decrement the number of worker processes by one
40
- (only if the worker_processes directive is used)
41
-
42
- # ENVIRONMENT
43
-
44
- yahns(1) itself requires no special environment variables. However,
45
- environment variables such as RACK_ENV and RAILS_ENV can affect Rack and
46
- Rails applications it hosts. Ruby and C library implementation-specific
47
- environment variables will also affect it.
48
-
49
- yahns will update the PWD (current working directory) env if the
50
- working_directory directive is set (see yahns_config(5)).
51
-
52
- LISTEN_FDS and LISTEN_PID variables are used in our emulation
53
- of sd_listen_fds(3) function. See sd_listen_fds(3) manpage
54
- for more details.
55
-
56
- # FILES
57
-
58
- See yahns_config(5) for documentation on the configuration file format.
59
-
60
- # CONTACT
61
-
62
- All feedback welcome via plain-text mail to <yahns-public@yhbt.net>\
63
- No subscription is necessary to post to the mailing list.
64
-
65
- # COPYRIGHT
66
-
67
- Copyright (C) 2013-2015 all contributors <yahns-public@yhbt.net>
68
- License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
69
-
70
- # SEE ALSO
71
-
72
- yahns-rackup(1), yahns_config(5), sd_listen_fds(3)
@@ -1,584 +0,0 @@
1
- % yahns_config(5) yahns user manual
2
- %
3
-
4
- # NAME
5
-
6
- yahns_config - configuration file description for yahns(1)
7
-
8
- # DESCRIPTION
9
-
10
- Since yahns is a Ruby application server, its configuration file is
11
- implemented in Ruby syntax, making it dependent on the version of
12
- Ruby it is running under.
13
-
14
- # TOP-LEVEL DIRECTIVES
15
-
16
- * app :TYPE, *APP_ARGUMENTS, &BLOCK
17
-
18
- This defines an application context for yahns to run. :TYPE defines
19
- the type of application it runs. yahns will eventually support
20
- application types other than :rack, but for now, only :rack is
21
- supported.
22
-
23
- The &BLOCK given configures the which sockets the app listens on,
24
- buffering and logging settings.
25
-
26
- An app with the same :TYPE and APP_ARGUMENTS may be defined multiple
27
- times with different &BLOCK contents (with different listeners and
28
- buffering settings).
29
-
30
- See the APP-BLOCK DIRECTIVES section for details on what goes into
31
- the &BLOCK.
32
-
33
- This directive may be specified multiple times for different or
34
- identical applications.
35
-
36
- If the "working_directory" directive is used, all app directives may
37
- only be specified after setting "working_directory".
38
-
39
- For Rack HTTP applications, see RACK APP ARGUMENTS for more
40
- information.
41
-
42
- * before_exec &BLOCK
43
-
44
- This runs &BLOCK before Kernel#exec (execve(2) wrapper). The command
45
- array to be passed to Kernel#exec may be modified within this hook:
46
-
47
- before_exec do |cmd|
48
- # you may modify ENV here inside the child process
49
- ENV["MALLOC_ARENA_MAX"] = ENV["MALLOC_ARENA_TEST"] = "1"
50
-
51
- # You may change to a different installation of Ruby or yahns
52
- # by doing an in-place modification of cmd:
53
- cmd.replace(%W(/another/install/of/yahns -c cfg.rb))
54
- end
55
-
56
- Default: (none)
57
-
58
- * client_expire_threshold {INTEGER|FLOAT}
59
-
60
- yahns will start expiring idle clients when it hits this threshold.
61
- If the threshold is a floating point number, it is that fraction of
62
- the soft open file limit (RLIMIT_NOFILE ir `ulimit -S -n` in shell).
63
- Thus if the soft open file limit is 1024 (a typical value) and the
64
- client_expire_threshold is 0.3, yahns will start expiring clients once
65
- it hits 307 clients (0.3 * 1024).
66
-
67
- If given a positive integer, yahns will start expiring clients once it
68
- its this absolute threshold of connected clients.
69
-
70
- If given a negative integer, yahns will start expiring clients once it
71
- reaches N clients away from the the soft file limit. That is, if
72
- client_expire_threshold is -666 and the soft open file limit is 1024,
73
- it will start expiring once it hits 358 clients.
74
-
75
- Clients are expired when the configured client_timeout for their
76
- app context is hit.
77
-
78
- Default: 0.5
79
-
80
- * logger LOGGER
81
-
82
- Sets LOGGER as the default logger of the process. The new
83
- LOGGER must respond to the following methods:
84
-
85
- debug, info, warn, error, fatal
86
-
87
- The default logger will log its output to the path specified
88
- by stderr_path. If you're running yahns daemonized, then
89
- you must specify a path to prevent error messages from going
90
- to /dev/null
91
-
92
- A per-APP &BLOCK logger may also be configured inside an app &BLOCK.
93
-
94
- Default: Logger.new($stderr)
95
-
96
- * pid PATHNAME
97
-
98
- Sets the path of the PID file for use with management/init scripts.
99
-
100
- Default: none
101
-
102
- * queue [NAME] &BLOCK
103
-
104
- As a top-level directive, this configures or defines a queue.
105
- If no NAME is specified, a default queue (named :default) is
106
- assumed. See the QUEUE-LEVEL DIRECTIVES section for details.
107
-
108
- A &BLOCK must be given if used as a top-level directive. This
109
- behaves slightly differently inside an app &BLOCK. This may also
110
- be given without a block to associate an app block with a named
111
- queue.
112
-
113
- Usually, only one queue is necessary. Each queue corresponds to
114
- an epoll descriptor and worker thread pool.
115
-
116
- Default: NAME defaults to :default
117
-
118
- * stderr_path PATHNAME
119
-
120
- Allow redirecting $stderr to a given path. Unlike doing this from
121
- the shell, this allows the yahns process to know the path its
122
- writing to and rotate the file if it is used for logging. The
123
- file will be opened with the O_APPEND flag and writes
124
- synchronized to the kernel (but not necessarily to _disk_) so
125
- multiple processes can safely append to it.
126
-
127
- If you are daemonizing and using the default logger, it is important
128
- to specify this as errors will otherwise be lost to /dev/null.
129
- Some applications/libraries may also triggering warnings that go to
130
- stderr, and they will end up here.
131
-
132
- Default: /dev/null if daemonized, controlling terminal if not
133
-
134
- * stdout_path PATHNAME
135
-
136
- Same as stderr_path, except for $stdout. Not many applications
137
- write to $stdout, but any that do will have their output written here.
138
- It is safe to point this to the same location a stderr_path.
139
- Like stderr_path, this defaults to /dev/null when daemonized.
140
-
141
- Default: /dev/null if daemonized, controlling terminal if not
142
-
143
- * working_directory PATHNAME
144
-
145
- Sets the working directory for the process. This ensures SIGUSR2 will
146
- start a new instance of yahns in this directory. This may be
147
- a symlink, a common scenario for Capistrano users. Unlike
148
- all other yahns configuration directives, this binds immediately
149
- for error checking and cannot be undone by unsetting it in the
150
- configuration file and reloading.
151
-
152
- This must be specified before any "app" directives
153
-
154
- Default: / if daemonized, current working directory if not
155
-
156
- # QUEUE-LEVEL DIRECTIVES
157
-
158
- * max_events INTEGER
159
-
160
- This controls the number of events a worker thread will fetch at
161
- once via epoll_wait(2). There is no good reason to change this
162
- unless you use very few (e.g. 1) worker_threads. Leaving this at
163
- 1 will give the fairest load balancing behavior with epoll.
164
-
165
- Default: 1
166
-
167
- * worker_threads INTEGER
168
-
169
- This controls the number of threads for application processing.
170
- Each queue has its own thread pool. Increase this number if your
171
- applications are able to use more threads effectively or if either
172
- (or both) input/output buffering are disabled. Lower this number if
173
- you do not need multi-thread concurrency at all.
174
-
175
- Default: 7
176
-
177
- ## APP-BLOCK DIRECTIVES
178
-
179
- * atfork_prepare, atfork_parent, atfork_child
180
-
181
- These are identical to the methods defined in WORKER_PROCESSES-LEVEL
182
- DIRECTIVES, however they are available inside the app blocks for
183
- convenience in case it is easier to organize per-app hooks.
184
-
185
- Default: (none)
186
-
187
- * check_client_connection BOOLEAN
188
-
189
- When enabled, yahns will check the client connection by writing
190
- the beginning of the HTTP headers before calling the application.
191
-
192
- This can prevent calling the application for clients who have
193
- disconnected while their connection was waiting for a free
194
- worker thread.
195
-
196
- This only affects clients connecting over Unix domain sockets and
197
- TCP via loopback (127.*.*.*). It is unlikely to detect disconnects
198
- if the client is on a remote host (even on a fast LAN).
199
-
200
- This has no effect for (rare) HTTP/0.9 clients.
201
-
202
- Default: false
203
-
204
- * client_body_buffer_size INTEGER
205
-
206
- This controls the maximum size of a request body before it is
207
- buffered to the filesystem (instead of memory). This has no effect
208
- if input_buffering is false. This also governs the size of an
209
- individual read(2) system call when reading a request body.
210
-
211
- There is generally no need to change this value and this directive
212
- may be removed in the future.
213
-
214
- Default: 8192 bytes (8 kilobytes)
215
-
216
- * client_header_buffer_size INTEGER
217
-
218
- This controls the size of a single read(2) syscall for reading
219
- client request headers. Increase this as needed if your application
220
- uses large cookies or long URLs. Lowering this may reduce GC and
221
- memory allocator overhead.
222
-
223
- Default 4000 bytes
224
-
225
- * client_max_body_size {INTEGER|nil}
226
-
227
- This controls the maximum request body size before a client is
228
- rejected with an HTTP 413 error.
229
-
230
- Setting this to nil will allow unlimited-sized inputs.
231
-
232
- Default: 1048576 bytes (one megabyte)
233
-
234
- * client_timeout SECONDS
235
-
236
- Defines the timeout expiring idle connections.
237
-
238
- If input_buffering is false or :lazy, this defines the maximum
239
- amount of time a worker thread will wait synchronously for a client
240
- request body.
241
-
242
- If output_buffering is false, this defines the maximm amount of
243
- time a worker thread will wait synchronously for a client socket
244
- to become writable.
245
-
246
- It makes sense to lower this to a low value (e.g. 5 seconds) if
247
- either output or input buffering are disabled. The default value
248
- of 15 seconds is suitable for configurations with both input and
249
- output buffering enabled and assumes all application dispatch
250
- finishes in less than 15 seconds.
251
-
252
- Default: 15 (seconds)
253
-
254
- * errors {IO|PATHNAME}
255
-
256
- For Rack applications, this controls the env["rack.errors"]
257
- destination. If given a PATHNAME, it will be a writable file
258
- opened with O_APPEND without userspace buffering, making it suitable
259
- for concurrent appends by multiple processes and threads, as well as
260
- making it eligible for reopening via SIGUSR1 after log rotation.
261
-
262
- Default: $stderr
263
-
264
- * input_buffering {:lazy|true|false}[, OPTIONS]
265
-
266
- This controls buffering of the HTTP request body.
267
-
268
- + true - fully buffers the request before application dispatch. This is
269
- most suitable for slow and untrusted clients which may trickle
270
- the request to the server.
271
-
272
- + :lazy - provides streaming, but rewindable input. This is suitable
273
- for fast, trusted clients and is fully-compatible with Rack 1.x
274
- specifications. :lazy buffering may also be suitable for slow and
275
- untrusted clients if you are able and willing to run a queue with
276
- many worker threads.
277
-
278
- + false - disable input buffering completely. This violates the
279
- Rack 1.x spec and is only suitable for fast, trusted clients or
280
- queues with many worker threads.
281
-
282
- HTTP request headers are always buffered in memory.
283
-
284
- Do not be tempted to disable any buffering because it improves
285
- numbers on a synthetic benchmark over a fast connection.
286
- Slow, real-world clients can easily overwhelm servers without both
287
- input and output buffering.
288
-
289
- Default: true
290
-
291
- The following OPTIONS may be specified:
292
-
293
- + tmpdir: DIRECTORY
294
-
295
- Specify an alternative temporary directory of input_buffering is
296
- :lazy or true. This can be used in case the normal temporary
297
- directory is too small or busy to be used for input buffering.
298
-
299
- Default: Dir.tmpdir (usually from TMPDIR env or /tmp)
300
-
301
- * listen ADDRESS [, OPTIONS]
302
-
303
- Adds an ADDRESS to the existing listener set. May be specified more
304
- than once. ADDRESS may be an Integer port number for a TCP port, an
305
- "IP_ADDRESS:PORT" for TCP listeners or a pathname for UNIX domain sockets.
306
-
307
- listen 3000 # listen to port 3000 on all TCP interfaces
308
- listen "127.0.0.1:3000" # listen to port 3000 on the loopback interface
309
- listen "/path/to/.unicorn.sock" # listen on the given Unix domain socket
310
- listen "[::1]:3000" # listen to port 3000 on the IPv6 loopback interface
311
-
312
- When using Unix domain sockets, be sure:
313
- 1) the path matches the one used by nginx
314
- 2) uses the same filesystem namespace as the nginx process
315
- For systemd users using PrivateTmp=true (for either nginx or yahns),
316
- this means Unix domain sockets must not be placed in /tmp
317
-
318
- The following OPTIONS may be specified (but are generally not needed):
319
-
320
- + backlog: INTEGER
321
-
322
- This is the backlog of the listen(2) syscall.
323
-
324
- Some operating systems allow negative values here to specify the
325
- maximum allowable value. In most cases, this number is only
326
- recommendation and there are other OS-specific tunables and
327
- variables that can affect this number. See the listen(2)
328
- syscall documentation of your OS for the exact semantics of
329
- this.
330
-
331
- If you are running unicorn on multiple machines, lowering this number
332
- can help your load balancer detect when a machine is overloaded
333
- and give requests to a different machine.
334
-
335
- Default: 1024
336
-
337
- + ipv6only: BOOLEAN
338
-
339
- This option makes IPv6-capable TCP listeners IPv6-only and unable
340
- to receive IPv4 queries on dual-stack systems. A separate IPv4-only
341
- listener is required if this is true.
342
-
343
- Enabling this option for the IPv6-only listener and having a
344
- separate IPv4 listener is recommended if you wish to support IPv6
345
- on the same TCP port. Otherwise, the value of env["REMOTE_ADDR"]
346
- will appear as an ugly IPv4-mapped-IPv6 address for IPv4 clients
347
- (e.g ":ffff:10.0.0.1" instead of just "10.0.0.1").
348
-
349
- Default: Operating-system dependent
350
-
351
- + sndbuf / rcvbuf: INTEGER
352
-
353
- Maximum receive and send buffer sizes (in bytes) of sockets.
354
-
355
- These correspond to the SO_RCVBUF and SO_SNDBUF settings which
356
- can be set via the setsockopt(2) syscall. Some kernels
357
- (e.g. Linux 2.4+) have intelligent auto-tuning mechanisms and
358
- there is no need (and it is sometimes detrimental) to specify them.
359
-
360
- See the socket API documentation of your operating system
361
- to determine the exact semantics of these settings and
362
- other operating system-specific knobs where they can be
363
- specified.
364
-
365
- Defaults: operating system defaults
366
-
367
- + reuseport: BOOLEAN
368
-
369
- This enables multiple, independently-started yahns instances to
370
- bind to the same port (as long as all the processes enable this).
371
-
372
- This option must be used when yahns first binds the listen socket.
373
- It cannot be enabled when a socket is inherited via SIGUSR2
374
- (but it will remain on if inherited), and it cannot be enabled
375
- directly via SIGHUP.
376
-
377
- Note: there is a chance of connections being dropped if
378
- one of the yahns instances is stopped while using this.
379
-
380
- This is supported on *BSD systems and Linux 3.9 or later.
381
-
382
- ref: https://lwn.net/Articles/542629/
383
-
384
- Default: false (unset)
385
-
386
- + threads: INTEGER
387
-
388
- Used to control the number of threads blocking on the accept(2)
389
- or accept4(2) system call (per listen socket).
390
-
391
- Usually, only one thread here is necessary, especially when
392
- multiple worker_processes are configured (as there'll be one
393
- thread per-process). Having extra threads may increase
394
- contention with epoll and FD allocation within one process.
395
-
396
- Note: do not confuse this option with worker_threads for queues,
397
- each queue has their own thread pool and it makes sense to
398
- have multiple threads there.
399
-
400
- Default: 1
401
-
402
- + umask: MODE
403
-
404
- Sets the file mode creation mask for UNIX sockets. If specified,
405
- this is usually in octal notation.
406
-
407
- Typically UNIX domain sockets are created with more liberal
408
- file permissions than the rest of the application. By default,
409
- we create UNIX domain sockets to be readable and writable by
410
- all local users to give them the same accessibility as
411
- locally-bound TCP listeners.
412
-
413
- This has no effect on TCP listeners.
414
-
415
- Default: 0000 (world-read/writable)
416
-
417
- * logger LOGGER
418
-
419
- Configures a logger within the current app &BLOCK.
420
- This behaves the same as the logger directive described in
421
- TOP-LEVEL DIRECTIVES
422
-
423
- Default: uses the top-level logger
424
-
425
- * output_buffering BOOLEAN [, OPTIONS]
426
-
427
- This enables or disables buffering of the HTTP response. If enabled,
428
- buffering is only performed lazily. In other words, buffering only
429
- happens if socket buffers (in the kernel) are filled up, and yahns
430
- will continously try to flush the buffered data to the socket while
431
- it is buffering.
432
-
433
- Disabling output buffering is only recommended if ALL clients
434
- connecting to this application context are fast, trusted or
435
- you are willing and able to run many worker threads.
436
-
437
- Do not be tempted to disable any buffering because it improves
438
- numbers on a synthetic benchmark over a fast connection.
439
- Slow, real-world clients can easily overwhelm servers without both
440
- input and output buffering.
441
-
442
- If output buffering is disabled, client_timeout controls the maximum
443
- amount of time a worker thread will wait synchronously.
444
-
445
- Default: true
446
-
447
- The following OPTIONS may be specified:
448
-
449
- + tmpdir: DIRECTORY
450
-
451
- Specify an alternative temporary directory of output_buffering is
452
- enabled. This can be used in case the normal temporary directory
453
- is too small or busy to be used for output buffering.
454
-
455
- Default: Dir.tmpdir (usually from TMPDIR env or /tmp)
456
-
457
- * persistent_connections BOOLEAN
458
-
459
- Enable or disables persistent connections and pipelining for HTTP
460
- connections. Persistent connections only expire when the global
461
- client_expire_threshold is hit and a client hits its client_timeout.
462
-
463
- Default: true
464
-
465
- * user USER [,GROUP]
466
-
467
- Runs application process(es) as the specified USER and GROUP.
468
-
469
- If using worker_processes, this only affects the workers and the
470
- master stays running as the user who started it. This switch will
471
- occur before calling the atfork_child hook(s).
472
-
473
- GROUP is optional and will not change if unspecified.
474
-
475
- Default: none (no user switching is done)
476
-
477
- * queue [NAME or &BLOCK]
478
-
479
- If given a NAME-only, this will associate this app &BLOCK with an
480
- existing queue.
481
-
482
- If given a &BLOCK-only, this will create an anonymous queue for this
483
- application context only. If given a &BLOCK, this takes the same
484
- parameters (worker_threads and max_events) as described in
485
- QUEUE-LEVEL DIRECTIVES.
486
-
487
- NAME and &BLOCK may not be combined inside an app &BLOCK.
488
-
489
- Default: uses the global, :default queue if none is specified
490
-
491
- * shutdown_timeout SECONDS
492
-
493
- This defines the timeout for gracefully exiting the process if there
494
- are still connected clients. This should generally be higher or equal
495
- to the app with the highest client_timeout value.
496
-
497
- Increase this if your application has slow endpoints which may take
498
- longer than the default timeout.
499
-
500
- Default: max client_timeout value of all apps in the process
501
-
502
- * worker_processes INTEGER [&BLOCK]
503
-
504
- This directive allows yahns to use a master/worker configuration to
505
- use multiple processes. Specifying any numeric value (including 1)
506
- here means yahns will enable yahns to use a master/worker process
507
- model instead of a single process.
508
-
509
- If an optional &BLOCK is given, it may be used to configure
510
- pthread_atfork(3)-style hooks. See WORKER_PROCESSES-LEVEL DIRECTIVES
511
- for details.
512
-
513
- Using worker_processes is strongly recommended if your application
514
- relies on using a SIGCHLD handler for reaping forked processes.
515
- Without worker_processes, yahns must reserve SIGCHLD for rolling
516
- back SIGUSR2 upgrades, leading to conflicts if the appplication
517
- expects to handle SIGCHLD.
518
-
519
- Default: nil (single process, no master/worker separation)
520
-
521
- ## WORKER_PROCESSES-LEVEL DIRECTIVES
522
-
523
- Note: all of the atfork_* hooks described here are available inside the
524
- "app" blocks, too.
525
-
526
- * atfork_prepare &BLOCK
527
-
528
- This &BLOCK is executed in the parent before fork(2) operation.
529
- This may be useful for app directives which specify "preload: true"
530
- to disconnect from databases or otherwise close open file descriptors
531
- to prevent them from being shared with the children.
532
-
533
- Default: none
534
-
535
- * atfork_parent &BLOCK
536
-
537
- This &BLOCK is executed in the parent after the fork(2) operation.
538
- This may not be useful, but exists in case somebody finds a use for it.
539
-
540
- Default: none
541
-
542
- * atfork_child &BLOCK
543
-
544
- This &BLOCK is executed in the child after the fork(2) operation.
545
-
546
- This may be useful for app directives which specify "preload: true"
547
- to reconnect to databases or reopen closed file descriptors which
548
- were closed in the atfork_prepare hook.
549
-
550
- Default: none
551
-
552
- # RACK APP ARGUMENTS
553
-
554
- Rack applications take a PATHNAME to the rackup(1) config file (e.g.
555
- "config.ru") as its first argument.
556
-
557
- The only supported keyword argument is the preload: BOOLEAN.
558
-
559
- preload: only makes sense if worker_processes are configured.
560
- Preloading an app allows memory to be saved under a copy-on-write GC,
561
- but will often require atfork_* hooks to be registered when configuring
562
- worker_processes. preload: defaults to false for maximum out-of-the-box
563
- compatibility.
564
-
565
- ## RACK APP EXAMPLE
566
-
567
- app(:rack, "/path/to/config.ru", preload: false) do
568
- # APP-BLOCK DIRECTIVES GO HERE
569
- end
570
-
571
- # EXAMPLES
572
-
573
- See the examples/ directory in the git source tree.
574
-
575
- git clone git://yhbt.net/yahns.git
576
-
577
- # COPYRIGHT
578
-
579
- Copyright (C) 2013-2015 all contributors <yahns-public@yhbt.net>
580
- License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
581
-
582
- # SEE ALSO
583
-
584
- yahns(1)