unicorn 4.9.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitattributes +5 -0
- data/.manifest +3 -10
- data/Application_Timeouts +3 -3
- data/DESIGN +2 -4
- data/Documentation/unicorn.1.txt +8 -5
- data/Documentation/unicorn_rails.1.txt +2 -2
- data/FAQ +17 -8
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +6 -1
- data/ISSUES +20 -28
- data/KNOWN_ISSUES +9 -9
- data/LATEST +28 -29
- data/Links +14 -17
- data/NEWS +159 -0
- data/PHILOSOPHY +0 -6
- data/README +22 -17
- data/SIGNALS +1 -1
- data/Sandbox +4 -4
- data/TUNING +11 -8
- data/bin/unicorn +1 -1
- data/bin/unicorn_rails +1 -1
- data/examples/nginx.conf +10 -11
- data/examples/unicorn.conf.rb +1 -4
- data/examples/unicorn.socket +11 -0
- data/examples/unicorn@.service +26 -0
- data/ext/unicorn_http/extconf.rb +1 -0
- data/ext/unicorn_http/httpdate.c +1 -1
- data/ext/unicorn_http/unicorn_http.c +267 -334
- data/ext/unicorn_http/unicorn_http.rl +89 -156
- data/lib/unicorn/configurator.rb +17 -31
- data/lib/unicorn/const.rb +2 -25
- data/lib/unicorn/http_request.rb +22 -33
- data/lib/unicorn/http_response.rb +13 -31
- data/lib/unicorn/http_server.rb +129 -122
- data/lib/unicorn/socket_helper.rb +36 -72
- data/lib/unicorn/stream_input.rb +3 -3
- data/lib/unicorn/tmpio.rb +0 -5
- data/lib/unicorn/util.rb +2 -1
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn/worker.rb +3 -15
- data/lib/unicorn.rb +10 -18
- data/man/man1/unicorn.1 +7 -5
- data/man/man1/unicorn_rails.1 +2 -2
- data/t/hijack.ru +2 -1
- data/t/t0200-rack-hijack.sh +5 -2
- data/test/exec/test_exec.rb +52 -0
- data/test/test_helper.rb +3 -2
- data/test/unit/test_http_parser_ng.rb +16 -114
- data/test/unit/test_response.rb +28 -16
- data/test/unit/test_socket_helper.rb +1 -1
- data/unicorn.gemspec +10 -1
- metadata +13 -23
- data/examples/git.ru +0 -13
- data/lib/unicorn/app/exec_cgi.rb +0 -154
- data/lib/unicorn/app/inetd.rb +0 -109
- data/lib/unicorn/ssl_client.rb +0 -11
- data/lib/unicorn/ssl_configurator.rb +0 -104
- data/lib/unicorn/ssl_server.rb +0 -42
- data/t/t0016-trust-x-forwarded-false.sh +0 -30
- data/t/t0017-trust-x-forwarded-true.sh +0 -30
- data/test/unit/test_http_parser_xftrust.rb +0 -38
- data/test/unit/test_sni_hostnames.rb +0 -47
data/NEWS
CHANGED
|
@@ -1,3 +1,162 @@
|
|
|
1
|
+
=== unicorn 5.0.0.pre2 - another prerelease! / 2015-07-06 21:37 UTC
|
|
2
|
+
|
|
3
|
+
There is a minor TCP socket options are now applied to inherited
|
|
4
|
+
sockets, and we have native support for inheriting sockets from
|
|
5
|
+
systemd (by emulating the sd_listen_fds(3) function).
|
|
6
|
+
|
|
7
|
+
Dynamic changes in the application to Rack::Utils::HTTP_STATUS
|
|
8
|
+
codes is now supported, so you can use your own custom status
|
|
9
|
+
lines.
|
|
10
|
+
|
|
11
|
+
Ruby 2.2 and later is now favored for performance.
|
|
12
|
+
Optimizations by using constants which made sense in earlier
|
|
13
|
+
versions of Ruby are gone: so users of old Ruby versions
|
|
14
|
+
will see performance regressions. Ruby 2.2 users should
|
|
15
|
+
see the same or better performance, and we have less code
|
|
16
|
+
as a result.
|
|
17
|
+
|
|
18
|
+
* doc: update some invalid URLs
|
|
19
|
+
* apply TCP socket options on inherited sockets
|
|
20
|
+
* reflect changes in Rack::Utils::HTTP_STATUS_CODES
|
|
21
|
+
* reduce constants and optimize for Ruby 2.2
|
|
22
|
+
* http_response: reduce size of multi-line header path
|
|
23
|
+
* emulate sd_listen_fds for systemd support
|
|
24
|
+
* test/unit/test_response.rb: compatibility with older test-unit
|
|
25
|
+
|
|
26
|
+
This also includes all changes in unicorn 5.0.0.pre1:
|
|
27
|
+
|
|
28
|
+
http://bogomips.org/unicorn-public/m/20150615225652.GA16164@dcvr.yhbt.net.html
|
|
29
|
+
|
|
30
|
+
=== unicorn 5.0.0.pre1 - incompatible changes! / 2015-06-15 22:49 UTC
|
|
31
|
+
|
|
32
|
+
This release finally drops Ruby 1.8 support and requires Ruby 1.9.3
|
|
33
|
+
or later. The horrible "Status:" header in our HTTP response is
|
|
34
|
+
finally gone, saving at least 16 precious bytes in every single HTTP
|
|
35
|
+
response.
|
|
36
|
+
|
|
37
|
+
Under Ruby 2.1 and later, the monotonic clock is used for timeout
|
|
38
|
+
handling for better accuracy.
|
|
39
|
+
|
|
40
|
+
Several experimental, unused and undocumented features are removed.
|
|
41
|
+
|
|
42
|
+
There's also tiny, minor performance and memory improvements from
|
|
43
|
+
dropping 1.8 compatibility, but probably nothing noticeable on a
|
|
44
|
+
typical real-life (bloated) app.
|
|
45
|
+
|
|
46
|
+
The biggest performance improvement we made was to our website by
|
|
47
|
+
switching to olddoc. Depending on connection speed, latency, and
|
|
48
|
+
renderer performance, it typically loads two to four times faster.
|
|
49
|
+
|
|
50
|
+
Finally, for the billionth time: unicorn must never be exposed
|
|
51
|
+
to slow clients, as it will never ever use new-fangled things
|
|
52
|
+
like non-blocking socket I/O, threads, epoll or kqueue. unicorn
|
|
53
|
+
must be used with a fully-buffering reverse proxy such as nginx
|
|
54
|
+
for slow clients.
|
|
55
|
+
|
|
56
|
+
* ISSUES: update with mailing list subscription
|
|
57
|
+
* GIT-VERSION-GEN: start 5.0.0 development
|
|
58
|
+
* http: remove xftrust options
|
|
59
|
+
* FAQ: add entry for Rails autoflush_log
|
|
60
|
+
* dev: remove isolate dependency
|
|
61
|
+
* unicorn.gemspec: depend on test-unit 3.0
|
|
62
|
+
* http_response: remove Status: header
|
|
63
|
+
* remove RubyForge and Freecode references
|
|
64
|
+
* remove mongrel.rubyforge.org references
|
|
65
|
+
* http: remove the keepalive requests limit
|
|
66
|
+
* http: reduce parser from 72 to 56 bytes on 64-bit
|
|
67
|
+
* examples: add run_once to before_fork hook example
|
|
68
|
+
* worker: remove old tmp accessor
|
|
69
|
+
* http_server: save 450+ bytes of memory on x86-64
|
|
70
|
+
* t/t0002-parser-error.sh: relax test for rack 1.6.0
|
|
71
|
+
* remove SSL support
|
|
72
|
+
* tmpio: drop the "size" method
|
|
73
|
+
* switch docs + website to olddoc
|
|
74
|
+
* README: clarify/reduce references to unicorn_rails
|
|
75
|
+
* gemspec: fixup olddoc migration
|
|
76
|
+
* use the monotonic clock under Ruby 2.1+
|
|
77
|
+
* http: -Wshorten-64-to-32 warnings on clang
|
|
78
|
+
* remove old inetd+git examples and exec_cgi
|
|
79
|
+
* http: standalone require + reduction in binary size
|
|
80
|
+
* GNUmakefile: fix clean gem build + reduce build cruft
|
|
81
|
+
* socket_helper: reduce constant lookups and caching
|
|
82
|
+
* remove 1.8, <= 1.9.1 fallback for missing IO#autoclose=
|
|
83
|
+
* favor IO#close_on_exec= over fcntl in 1.9+
|
|
84
|
+
* use require_relative to reduce syscalls at startup
|
|
85
|
+
* doc: update support status for Ruby versions
|
|
86
|
+
* fix uninstalled testing and reduce require paths
|
|
87
|
+
* test_socket_helper: do not depend on SO_REUSEPORT
|
|
88
|
+
* favor "a.b(&:c)" form over "a.b { |x| x.c }"
|
|
89
|
+
* ISSUES: add section for bugs in other projects
|
|
90
|
+
* http_server: favor ivars over constants
|
|
91
|
+
* explain 11 byte magic number for self-pipe
|
|
92
|
+
* const: drop constants used by Rainbows!
|
|
93
|
+
* reduce and localize constant string use
|
|
94
|
+
* Links: mark Rainbows! as historical, reference yahns
|
|
95
|
+
* save about 200 bytes of memory on x86-64
|
|
96
|
+
* http: remove deprecated reset method
|
|
97
|
+
* http: remove experimental dechunk! method
|
|
98
|
+
* socket_helper: update comments
|
|
99
|
+
* doc: document UNICORN_FD in manpage
|
|
100
|
+
* doc: document Etc.nprocessors for worker_processes
|
|
101
|
+
* favor more string literals for cold call sites
|
|
102
|
+
* tee_input: support for Rack::TempfileReaper middleware
|
|
103
|
+
* support TempfileReaper in deployment and development envs
|
|
104
|
+
* favor kgio_wait_readable for single FD over select
|
|
105
|
+
* Merge tag 'v4.9.0'
|
|
106
|
+
* http_request: support rack.hijack by default
|
|
107
|
+
* avoid extra allocation for hijack proc creation
|
|
108
|
+
* FAQ: add note about ECONNRESET errors from bodies
|
|
109
|
+
* process SIGWINCH unless stdin is a TTY
|
|
110
|
+
* ISSUES: discourage HTML mail strongly, welcome nyms
|
|
111
|
+
* http: use rb_hash_clear in Ruby 2.0+
|
|
112
|
+
* http_response: avoid special-casing for Rack < 1.5
|
|
113
|
+
* www: install NEWS.atom.xml properly
|
|
114
|
+
* http_server: remove a few more accessors and constants
|
|
115
|
+
* http_response: simplify regular expression
|
|
116
|
+
* move the socket into Rack env for hijacking
|
|
117
|
+
* http: move response_start_sent into the C ext
|
|
118
|
+
* FAQ: reorder bit on Rack 1.1.x and Rails 2.3.x
|
|
119
|
+
* ensure body is closed during hijack
|
|
120
|
+
|
|
121
|
+
=== unicorn 4.9.0 - TempfileReaper support in Rack 1.6 / 2015-04-24 03:09 UTC
|
|
122
|
+
|
|
123
|
+
This release supports the Rack::TempfileReaper middleware found
|
|
124
|
+
in rack 1.6 for cleaning up disk space used by temporary files.
|
|
125
|
+
We also use Rack::TempfileReaper for cleaning up large temporary
|
|
126
|
+
files buffered with TeeInput. Users on rack 1.5 and earlier
|
|
127
|
+
will see no changes.
|
|
128
|
+
|
|
129
|
+
There's also a bunch of documentation/build system improvements.
|
|
130
|
+
|
|
131
|
+
This is likely to be the last Ruby 1.8-compatible release,
|
|
132
|
+
unicorn 5.x will require 1.9.3 or later as well as dropping lots
|
|
133
|
+
of cruft (the stupid "Status:" header in responses being the
|
|
134
|
+
most notable).
|
|
135
|
+
|
|
136
|
+
21 changes backported from master:
|
|
137
|
+
|
|
138
|
+
ISSUES: update with mailing list subscription
|
|
139
|
+
FAQ: add entry for Rails autoflush_log
|
|
140
|
+
dev: remove isolate dependency
|
|
141
|
+
unicorn.gemspec: depend on test-unit 3.0
|
|
142
|
+
remove RubyForge and Freecode references
|
|
143
|
+
remove mongrel.rubyforge.org references
|
|
144
|
+
examples: add run_once to before_fork hook example
|
|
145
|
+
t/t0002-parser-error.sh: relax test for rack 1.6.0
|
|
146
|
+
switch docs + website to olddoc
|
|
147
|
+
README: clarify/reduce references to unicorn_rails
|
|
148
|
+
gemspec: fixup olddoc migration
|
|
149
|
+
GNUmakefile: fix clean gem build + reduce build cruft
|
|
150
|
+
doc: update support status for Ruby versions
|
|
151
|
+
fix uninstalled testing and reduce require paths
|
|
152
|
+
test_socket_helper: do not depend on SO_REUSEPORT
|
|
153
|
+
ISSUES: add section for bugs in other projects
|
|
154
|
+
explain 11 byte magic number for self-pipe
|
|
155
|
+
Links: mark Rainbows! as historical, reference yahns
|
|
156
|
+
doc: document UNICORN_FD in manpage
|
|
157
|
+
tee_input: support for Rack::TempfileReaper middleware
|
|
158
|
+
support TempfileReaper in deployment and development envs
|
|
159
|
+
|
|
1
160
|
=== unicorn 4.8.3 - the end of an era / 2014-05-07 07:50 UTC
|
|
2
161
|
|
|
3
162
|
This release updates documentation to reflect the migration of the
|
data/PHILOSOPHY
CHANGED
|
@@ -137,9 +137,3 @@ unicorn is highly inefficient for Comet/reverse-HTTP/push applications
|
|
|
137
137
|
where the HTTP connection spends a large amount of time idle.
|
|
138
138
|
Nevertheless, the ease of troubleshooting, debugging, and management of
|
|
139
139
|
unicorn may still outweigh the drawbacks for these applications.
|
|
140
|
-
|
|
141
|
-
The {Rainbows!}[http://rainbows.bogomips.org/] aims to fill the gap for
|
|
142
|
-
odd corner cases where the nginx + unicorn combination is not enough.
|
|
143
|
-
While Rainbows! management/administration is largely identical to
|
|
144
|
-
unicorn, Rainbows! is far more ambitious and has seen little real-world
|
|
145
|
-
usage.
|
data/README
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
=
|
|
1
|
+
= unicorn: Rack HTTP server for fast clients and Unix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
unicorn is an HTTP server for Rack applications designed to only serve
|
|
4
4
|
fast clients on low-latency, high-bandwidth connections and take
|
|
5
5
|
advantage of features in Unix/Unix-like kernels. Slow clients should
|
|
6
6
|
only be served by placing a reverse proxy capable of fully buffering
|
|
7
|
-
both the the request and response in between
|
|
7
|
+
both the the request and response in between unicorn and slow clients.
|
|
8
8
|
|
|
9
9
|
== Features
|
|
10
10
|
|
|
11
11
|
* Designed for Rack, Unix, fast clients, and ease-of-debugging. We
|
|
12
12
|
cut out everything that is better supported by the operating system,
|
|
13
|
-
{nginx}[http://nginx.
|
|
13
|
+
{nginx}[http://nginx.org/] or {Rack}[http://rack.github.io/].
|
|
14
14
|
|
|
15
15
|
* Compatible with Ruby 1.9.3 and later.
|
|
16
16
|
unicorn 4.8.x will remain supported for Ruby 1.8 users.
|
|
17
17
|
|
|
18
|
-
* Process management:
|
|
18
|
+
* Process management: unicorn will reap and restart workers that
|
|
19
19
|
die from broken apps. There is no need to manage multiple processes
|
|
20
|
-
or ports yourself.
|
|
20
|
+
or ports yourself. unicorn can spawn and manage any number of
|
|
21
21
|
worker processes you choose to scale to your backend.
|
|
22
22
|
|
|
23
23
|
* Load balancing is done entirely by the operating system kernel.
|
|
@@ -33,11 +33,11 @@ both the the request and response in between \Unicorn and slow clients.
|
|
|
33
33
|
* Builtin reopening of all log files in your application via
|
|
34
34
|
USR1 signal. This allows logrotate to rotate files atomically and
|
|
35
35
|
quickly via rename instead of the racy and slow copytruncate method.
|
|
36
|
-
|
|
36
|
+
unicorn also takes steps to ensure multi-line log entries from one
|
|
37
37
|
request all stay within the same file.
|
|
38
38
|
|
|
39
39
|
* nginx-style binary upgrades without losing connections.
|
|
40
|
-
You can upgrade
|
|
40
|
+
You can upgrade unicorn, your entire application, libraries
|
|
41
41
|
and even your Ruby interpreter without dropping clients.
|
|
42
42
|
|
|
43
43
|
* before_fork and after_fork hooks in case your application
|
|
@@ -60,15 +60,15 @@ both the the request and response in between \Unicorn and slow clients.
|
|
|
60
60
|
|
|
61
61
|
== License
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
unicorn is copyright 2009 by all contributors (see logs in git).
|
|
64
64
|
It is based on Mongrel 1.1.5.
|
|
65
65
|
Mongrel is copyright 2007 Zed A. Shaw and contributors.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
unicorn is licensed under (your choice) of the GPLv2 or later
|
|
68
68
|
(GPLv3+ preferred), or Ruby (1.8)-specific terms.
|
|
69
69
|
See the included LICENSE file for details.
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
unicorn is 100% Free Software.
|
|
72
72
|
|
|
73
73
|
== Install
|
|
74
74
|
|
|
@@ -108,17 +108,17 @@ In RAILS_ROOT, run:
|
|
|
108
108
|
|
|
109
109
|
unicorn_rails
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
unicorn will bind to all interfaces on TCP port 8080 by default.
|
|
112
112
|
You may use the +--listen/-l+ switch to bind to a different
|
|
113
113
|
address:port or a UNIX socket.
|
|
114
114
|
|
|
115
115
|
=== Configuration File(s)
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
unicorn will look for the config.ru file used by rackup in APP_ROOT.
|
|
118
118
|
|
|
119
|
-
For deployments, it can use a config file for
|
|
119
|
+
For deployments, it can use a config file for unicorn-specific options
|
|
120
120
|
specified by the +--config-file/-c+ command-line switch. See
|
|
121
|
-
Unicorn::Configurator for the syntax of the
|
|
121
|
+
Unicorn::Configurator for the syntax of the unicorn-specific options.
|
|
122
122
|
The default settings are designed for maximum out-of-the-box
|
|
123
123
|
compatibility with existing applications.
|
|
124
124
|
|
|
@@ -130,7 +130,7 @@ supported. Run `unicorn -h` to see command-line options.
|
|
|
130
130
|
There is NO WARRANTY whatsoever if anything goes wrong, but
|
|
131
131
|
{let us know}[link:ISSUES.html] and we'll try our best to fix it.
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
unicorn is designed to only serve fast clients either on the local host
|
|
134
134
|
or a fast LAN. See the PHILOSOPHY and DESIGN documents for more details
|
|
135
135
|
regarding this.
|
|
136
136
|
|
|
@@ -140,6 +140,11 @@ All feedback (bug reports, user/development dicussion, patches, pull
|
|
|
140
140
|
requests) go to the mailing list/newsgroup. See the ISSUES document for
|
|
141
141
|
information on the {mailing list}[mailto:unicorn-public@bogomips.org].
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
The mailing list is archived at http://bogomips.org/unicorn-public/
|
|
144
|
+
Read-only NNTP access is available at:
|
|
145
|
+
nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn and
|
|
146
|
+
nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
|
|
147
|
+
|
|
148
|
+
For the latest on unicorn releases, you may also finger us at
|
|
144
149
|
unicorn@bogomips.org or check our NEWS page (and subscribe to our Atom
|
|
145
150
|
feed).
|
data/SIGNALS
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
In general, signals need only be sent to the master process. However,
|
|
4
4
|
the signals Unicorn uses internally to communicate with the worker
|
|
5
5
|
processes are documented here as well. With the exception of TTIN/TTOU,
|
|
6
|
-
signal handling matches the behavior of {nginx}[http://nginx.
|
|
6
|
+
signal handling matches the behavior of {nginx}[http://nginx.org/] so it
|
|
7
7
|
should be possible to easily share process management scripts between
|
|
8
8
|
Unicorn and nginx.
|
|
9
9
|
|
data/Sandbox
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
= Tips for using
|
|
1
|
+
= Tips for using unicorn with Sandbox installation tools
|
|
2
2
|
|
|
3
3
|
Since unicorn includes executables and is usually used to start a Ruby
|
|
4
4
|
process, there are certain caveats to using it with tools that sandbox
|
|
5
5
|
RubyGems installations such as
|
|
6
|
-
{Bundler}[http://
|
|
7
|
-
{Isolate}[
|
|
6
|
+
{Bundler}[http://bundler.io/] or
|
|
7
|
+
{Isolate}[https://github.com/jbarnette/isolate].
|
|
8
8
|
|
|
9
9
|
== General deployment
|
|
10
10
|
|
|
@@ -58,7 +58,7 @@ the before_exec hook:
|
|
|
58
58
|
|
|
59
59
|
If you're using an older Bundler version (0.9.x), you may need to set or
|
|
60
60
|
reset GEM_HOME, GEM_PATH and PATH environment variables in the
|
|
61
|
-
before_exec hook as illustrated by
|
|
61
|
+
before_exec hook as illustrated by https://gist.github.com/534668
|
|
62
62
|
|
|
63
63
|
=== Ruby 2.0.0 close-on-exec and SIGUSR2 incompatibility
|
|
64
64
|
|
data/TUNING
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
= Tuning
|
|
1
|
+
= Tuning unicorn
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
unicorn performance is generally as good as a (mostly) Ruby web server
|
|
4
4
|
can provide. Most often the performance bottleneck is in the web
|
|
5
5
|
application running on Unicorn rather than Unicorn itself.
|
|
6
6
|
|
|
7
|
-
==
|
|
7
|
+
== unicorn Configuration
|
|
8
8
|
|
|
9
9
|
See Unicorn::Configurator for details on the config file format.
|
|
10
10
|
+worker_processes+ is the most-commonly needed tuning parameter.
|
|
@@ -14,12 +14,15 @@ See Unicorn::Configurator for details on the config file format.
|
|
|
14
14
|
* worker_processes should be scaled to the number of processes your
|
|
15
15
|
backend system(s) can support. DO NOT scale it to the number of
|
|
16
16
|
external network clients your application expects to be serving.
|
|
17
|
-
|
|
17
|
+
unicorn is NOT for serving slow clients, that is the job of nginx.
|
|
18
18
|
|
|
19
19
|
* worker_processes should be *at* *least* the number of CPU cores on
|
|
20
|
-
a dedicated server
|
|
21
|
-
responses that are /not/
|
|
22
|
-
workaround those inefficiencies.
|
|
20
|
+
a dedicated server (unless you do not have enough memory).
|
|
21
|
+
If your application has occasionally slow responses that are /not/
|
|
22
|
+
CPU-intensive, you may increase this to workaround those inefficiencies.
|
|
23
|
+
|
|
24
|
+
* Under Ruby 2.2 or later, Etc.nprocessors may be used to determine
|
|
25
|
+
the number of CPU cores present.
|
|
23
26
|
|
|
24
27
|
* worker_processes may be increased for Unicorn::OobGC users to provide
|
|
25
28
|
more consistent response times.
|
|
@@ -55,7 +58,7 @@ See Unicorn::Configurator for details on the config file format.
|
|
|
55
58
|
* UNIX domain sockets are slightly faster than TCP sockets, but only
|
|
56
59
|
work if nginx is on the same machine.
|
|
57
60
|
|
|
58
|
-
== Other
|
|
61
|
+
== Other unicorn settings
|
|
59
62
|
|
|
60
63
|
* Setting "preload_app true" can allow copy-on-write-friendly GC to
|
|
61
64
|
be used to save memory. It will probably not work out of the box with
|
data/bin/unicorn
CHANGED
|
@@ -29,7 +29,7 @@ op = OptionParser.new("", 24, ' ') do |opts|
|
|
|
29
29
|
|
|
30
30
|
opts.on("-I", "--include PATH",
|
|
31
31
|
"specify $LOAD_PATH (may be used more than once)") do |path|
|
|
32
|
-
$LOAD_PATH.unshift(*path.split(
|
|
32
|
+
$LOAD_PATH.unshift(*path.split(':'))
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
opts.on("-r", "--require LIBRARY",
|
data/bin/unicorn_rails
CHANGED
|
@@ -30,7 +30,7 @@ op = OptionParser.new("", 24, ' ') do |opts|
|
|
|
30
30
|
|
|
31
31
|
opts.on("-I", "--include PATH",
|
|
32
32
|
"specify $LOAD_PATH (may be used more than once)") do |path|
|
|
33
|
-
$LOAD_PATH.unshift(*path.split(
|
|
33
|
+
$LOAD_PATH.unshift(*path.split(':'))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
opts.on("-r", "--require LIBRARY",
|
data/examples/nginx.conf
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This is example contains the bare mininum to get nginx going with
|
|
2
|
-
#
|
|
2
|
+
# unicorn servers. Generally these configuration settings
|
|
3
3
|
# are applicable to other HTTP application servers (and not just Ruby
|
|
4
4
|
# ones), so if you have one working well for proxying another app
|
|
5
5
|
# server, feel free to continue using it.
|
|
@@ -44,8 +44,8 @@ http {
|
|
|
44
44
|
# click tracking!
|
|
45
45
|
access_log /path/to/nginx.access.log combined;
|
|
46
46
|
|
|
47
|
-
# you generally want to serve static files with nginx since
|
|
48
|
-
#
|
|
47
|
+
# you generally want to serve static files with nginx since
|
|
48
|
+
# unicorn is not and will never be optimized for it
|
|
49
49
|
sendfile on;
|
|
50
50
|
|
|
51
51
|
tcp_nopush on; # off may be better for *some* Comet/long-poll stuff
|
|
@@ -67,10 +67,10 @@ http {
|
|
|
67
67
|
text/javascript application/x-javascript
|
|
68
68
|
application/atom+xml;
|
|
69
69
|
|
|
70
|
-
# this can be any application server, not just
|
|
70
|
+
# this can be any application server, not just unicorn
|
|
71
71
|
upstream app_server {
|
|
72
72
|
# fail_timeout=0 means we always retry an upstream even if it failed
|
|
73
|
-
# to return a good HTTP response (in case the
|
|
73
|
+
# to return a good HTTP response (in case the unicorn master nukes a
|
|
74
74
|
# single worker for timing out).
|
|
75
75
|
|
|
76
76
|
# for UNIX domain socket setups:
|
|
@@ -132,12 +132,11 @@ http {
|
|
|
132
132
|
# redirects, we set the Host: header above already.
|
|
133
133
|
proxy_redirect off;
|
|
134
134
|
|
|
135
|
-
# set
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
# client can become a bottleneck of Unicorn.
|
|
135
|
+
# It's also safe to set if you're using only serving fast clients
|
|
136
|
+
# with unicorn + nginx, but not slow clients. You normally want
|
|
137
|
+
# nginx to buffer responses to slow clients, even with Rails 3.1
|
|
138
|
+
# streaming because otherwise a slow client can become a bottleneck
|
|
139
|
+
# of unicorn.
|
|
141
140
|
#
|
|
142
141
|
# The Rack application may also set "X-Accel-Buffering (yes|no)"
|
|
143
142
|
# in the response headers do disable/enable buffering on a
|
data/examples/unicorn.conf.rb
CHANGED
|
@@ -40,11 +40,8 @@ pid "/path/to/app/shared/pids/unicorn.pid"
|
|
|
40
40
|
stderr_path "/path/to/app/shared/log/unicorn.stderr.log"
|
|
41
41
|
stdout_path "/path/to/app/shared/log/unicorn.stdout.log"
|
|
42
42
|
|
|
43
|
-
# combine Ruby 2.0.
|
|
44
|
-
# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
|
|
43
|
+
# combine Ruby 2.0.0+ with "preload_app true" for memory savings
|
|
45
44
|
preload_app true
|
|
46
|
-
GC.respond_to?(:copy_on_write_friendly=) and
|
|
47
|
-
GC.copy_on_write_friendly = true
|
|
48
45
|
|
|
49
46
|
# Enable this flag to have unicorn test client connections by writing the
|
|
50
47
|
# beginning of the HTTP headers before calling the application. This
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ==> /etc/systemd/system/unicorn@.service <==
|
|
2
|
+
# Since SIGUSR2 upgrades do not work under systemd, this service file
|
|
3
|
+
# allows starting two simultaneous services during upgrade time
|
|
4
|
+
# (e.g. unicorn@1 unicorn@2) with the intention that they take
|
|
5
|
+
# turns running in-between upgrades. This should allow upgrading
|
|
6
|
+
# without downtime.
|
|
7
|
+
|
|
8
|
+
[Unit]
|
|
9
|
+
Description = unicorn Rack application server %i
|
|
10
|
+
Wants = unicorn.socket
|
|
11
|
+
After = unicorn.socket
|
|
12
|
+
|
|
13
|
+
[Service]
|
|
14
|
+
ExecStart = /usr/bin/unicorn -c /path/to/unicorn.conf.rb /path/to/config.ru
|
|
15
|
+
Sockets = unicorn.socket
|
|
16
|
+
KillSignal = SIGQUIT
|
|
17
|
+
User = nobody
|
|
18
|
+
Group = nogroup
|
|
19
|
+
ExecReload = /bin/kill -HUP $MAINPID
|
|
20
|
+
|
|
21
|
+
# This is based on the Unicorn::Configurator#timeout directive,
|
|
22
|
+
# adding a few seconds for scheduling differences:
|
|
23
|
+
TimeoutStopSec = 62
|
|
24
|
+
|
|
25
|
+
[Install]
|
|
26
|
+
WantedBy = multi-user.target
|
data/ext/unicorn_http/extconf.rb
CHANGED
|
@@ -5,6 +5,7 @@ have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_t", "sys/types.h")
|
|
|
5
5
|
have_macro("SIZEOF_SIZE_T", "ruby.h") or check_sizeof("size_t", "sys/types.h")
|
|
6
6
|
have_macro("SIZEOF_LONG", "ruby.h") or check_sizeof("long", "sys/types.h")
|
|
7
7
|
have_func("rb_str_set_len", "ruby.h")
|
|
8
|
+
have_func("rb_hash_clear", "ruby.h") # Ruby 2.0+
|
|
8
9
|
have_func("gmtime_r", "time.h")
|
|
9
10
|
|
|
10
11
|
create_makefile("unicorn_http")
|
data/ext/unicorn_http/httpdate.c
CHANGED
|
@@ -66,7 +66,7 @@ static VALUE httpdate(VALUE self)
|
|
|
66
66
|
|
|
67
67
|
void init_unicorn_httpdate(void)
|
|
68
68
|
{
|
|
69
|
-
VALUE mod =
|
|
69
|
+
VALUE mod = rb_define_module("Unicorn");
|
|
70
70
|
mod = rb_define_module_under(mod, "HttpResponse");
|
|
71
71
|
|
|
72
72
|
buf = rb_str_new(0, buf_capa - 1);
|