unicorn 0.93.2 → 0.93.3

Sign up to get free protection for your applications and to get access to all the features.
data/DESIGN CHANGED
@@ -7,7 +7,7 @@
7
7
  all clients down, just one. Only UNIX-like systems supporting
8
8
  fork() and file descriptor inheritance are supported.
9
9
 
10
- * The Ragel->C HTTP parser is taken from Mongrel. This is the
10
+ * The Ragel+C HTTP parser is taken from Mongrel. This is the
11
11
  only non-Ruby part and there are no plans to add any more
12
12
  non-Ruby components.
13
13
 
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v0.93.2.GIT
4
+ DEF_VER=v0.93.3.GIT
5
5
 
6
6
  LF='
7
7
  '
@@ -46,7 +46,6 @@ inst_deps := $(c_files) $(rb_files) GNUmakefile test/test_helper.rb
46
46
  ragel: $(ext)/unicorn_http.c
47
47
  $(ext)/unicorn_http.c: $(rl_files)
48
48
  cd $(@D) && $(ragel) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
49
- $(ruby) -i -p -e '$$_.gsub!(%r{[ \t]*$$},"")' $@
50
49
  $(ext)/Makefile: $(ext)/extconf.rb $(c_files)
51
50
  cd $(@D) && $(ruby) extconf.rb
52
51
  $(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile
data/PHILOSOPHY CHANGED
@@ -101,7 +101,7 @@ A reverse proxy for Unicorn should meet the following requirements:
101
101
  nginx is the only (Free) solution we know of that meets the above
102
102
  requirements.
103
103
 
104
- Indeed, the author of Unicorn has deployed nginx as a reverse-proxy not
104
+ Indeed, the folks behind Unicorn have deployed nginx as a reverse-proxy not
105
105
  only for Ruby applications, but also for production applications running
106
106
  Apache/mod_perl, Apache/mod_php and Apache Tomcat. In every single
107
107
  case, performance improved because application servers were able to use
@@ -137,3 +137,8 @@ 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.rubyforge.org/] aims to fill the gap for
142
+ odd corner cases where the nginx + Unicorn combination is not enough.
143
+ Keep in mind that Rainbows! is still very new (as of October 2009), far
144
+ more ambitious, and far less tested than Unicorn.
data/README CHANGED
@@ -1,9 +1,9 @@
1
- = Unicorn: Rack HTTP server for Unix and fast clients
1
+ = Unicorn: Rack HTTP server for fast clients and Unix
2
2
 
3
- Unicorn is a HTTP server for Rack applications designed to take
4
- advantage of features in Unix/Unix-like kernels and only serve fast
5
- clients on low-latency, high-bandwidth connections. Slow clients should
6
- only be served by placing a reverse proxy capable of fully-buffering
3
+ Unicorn is a HTTP server for Rack applications designed to only serve
4
+ fast clients on low-latency, high-bandwidth connections and take
5
+ advantage of features in Unix/Unix-like kernels. Slow clients should
6
+ only be served by placing a reverse proxy capable of fully buffering
7
7
  both the the request and response in between Unicorn and slow clients.
8
8
 
9
9
  == Features
@@ -131,8 +131,8 @@ options.
131
131
  == Disclaimer
132
132
 
133
133
  Like the creatures themselves, production deployments of Unicorn are
134
- rare or even non-existent. There is NO WARRANTY whatsoever if anything
135
- goes wrong, but let us know and we'll try our best to fix it.
134
+ rare. There is NO WARRANTY whatsoever if anything goes wrong, but let
135
+ us know and we'll try our best to fix it.
136
136
 
137
137
  Unicorn is designed to only serve fast clients either on the local host
138
138
  or a fast LAN. See the PHILOSOPHY and DESIGN documents for more details
@@ -1,5 +1,4 @@
1
1
  #!/bin/sh
2
- set -u
3
2
  set -e
4
3
  # Example init script, this can be used with nginx, too,
5
4
  # since nginx and unicorn accept the same signals
@@ -42,7 +42,23 @@ module Unicorn
42
42
  # This hash maps PIDs to Workers
43
43
  WORKERS = {}
44
44
 
45
- # See: http://cr.yp.to/docs/selfpipe.html
45
+ # We use SELF_PIPE differently in the master and worker processes:
46
+ #
47
+ # * The master process never closes or reinitializes this once
48
+ # initialized. Signal handlers in the master process will write to
49
+ # it to wake up the master from IO.select in exactly the same manner
50
+ # djb describes in http://cr.yp.to/docs/selfpipe.html
51
+ #
52
+ # * The workers immediately close the pipe they inherit from the
53
+ # master and replace it with a new pipe after forking. This new
54
+ # pipe is also used to wakeup from IO.select from inside (worker)
55
+ # signal handlers. However, workers *close* the pipe descriptors in
56
+ # the signal handlers to raise EBADF in IO.select instead of writing
57
+ # like we do in the master. We cannot easily use the reader set for
58
+ # IO.select because LISTENERS is already that set, and it's extra
59
+ # work (and cycles) to distinguish the pipe FD from the reader set
60
+ # once IO.select returns. So we're lazy and just close the pipe when
61
+ # a (rare) signal arrives in the worker and reinitialize the pipe later.
46
62
  SELF_PIPE = []
47
63
 
48
64
  # signal queue used for self-piping
@@ -559,13 +575,13 @@ module Unicorn
559
575
  nr = 0 # this becomes negative if we need to reopen logs
560
576
  alive = worker.tmp # tmp is our lifeline to the master process
561
577
  ready = LISTENERS
562
- t = ti = 0
563
578
 
564
579
  # closing anything we IO.select on will raise EBADF
565
580
  trap(:USR1) { nr = -65536; SELF_PIPE.first.close rescue nil }
566
581
  trap(:QUIT) { alive = nil; LISTENERS.each { |s| s.close rescue nil } }
567
582
  [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } } # instant shutdown
568
583
  logger.info "worker=#{worker.nr} ready"
584
+ m = 0
569
585
 
570
586
  begin
571
587
  nr < 0 and reopen_worker_logs(worker.nr)
@@ -579,13 +595,13 @@ module Unicorn
579
595
  # changes with chmod doesn't update ctime on all filesystems; so
580
596
  # we change our counter each and every time (after process_client
581
597
  # and before IO.select).
582
- t == (ti = Time.now.to_i) or alive.chmod(t = ti)
598
+ alive.chmod(m = 0 == m ? 1 : 0)
583
599
 
584
600
  ready.each do |sock|
585
601
  begin
586
602
  process_client(sock.accept_nonblock)
587
603
  nr += 1
588
- t == (ti = Time.now.to_i) or alive.chmod(t = ti)
604
+ alive.chmod(m = 0 == m ? 1 : 0)
589
605
  rescue Errno::EAGAIN, Errno::ECONNABORTED
590
606
  end
591
607
  break if nr < 0
@@ -598,7 +614,7 @@ module Unicorn
598
614
  redo unless nr == 0 # (nr < 0) => reopen logs
599
615
 
600
616
  ppid == Process.ppid or return
601
- alive.chmod(t = 0)
617
+ alive.chmod(m = 0 == m ? 1 : 0)
602
618
  begin
603
619
  # timeout used so we can detect parent death:
604
620
  ret = IO.select(LISTENERS, nil, SELF_PIPE, timeout) or redo
@@ -175,6 +175,23 @@ module Unicorn
175
175
  # to the scheduling limitations by the worker process. Due the
176
176
  # low-complexity, low-overhead implementation, timeouts of less
177
177
  # than 3.0 seconds can be considered inaccurate and unsafe.
178
+ #
179
+ # For running Unicorn behind nginx, it is recommended to set
180
+ # "fail_timeout=0" for in your nginx configuration like this
181
+ # to have nginx always retry backends that may have had workers
182
+ # SIGKILL-ed due to timeouts.
183
+ #
184
+ # # See http://wiki.nginx.org/NginxHttpUpstreamModule for more details
185
+ # # on nginx upstream configuration:
186
+ # upstream unicorn_backend {
187
+ # # for UNIX domain socket setups:
188
+ # server unix:/path/to/unicorn.sock fail_timeout=0;
189
+ #
190
+ # # for TCP setups
191
+ # server 192.168.0.7:8080 fail_timeout=0;
192
+ # server 192.168.0.8:8080 fail_timeout=0;
193
+ # server 192.168.0.9:8080 fail_timeout=0;
194
+ # }
178
195
  def timeout(seconds)
179
196
  Numeric === seconds or raise ArgumentError,
180
197
  "not numeric: timeout=#{seconds.inspect}"
@@ -7,7 +7,7 @@ module Unicorn
7
7
  # gave about a 3% to 10% performance improvement over using the strings directly.
8
8
  # Symbols did not really improve things much compared to constants.
9
9
  module Const
10
- UNICORN_VERSION="0.93.2"
10
+ UNICORN_VERSION="0.93.3"
11
11
 
12
12
  DEFAULT_HOST = "0.0.0.0" # default TCP listen host address
13
13
  DEFAULT_PORT = 8080 # default TCP listen port
@@ -35,11 +35,11 @@ Gem::Specification.new do |s|
35
35
  s.files = manifest
36
36
  s.homepage = %q{http://unicorn.bogomips.org/}
37
37
 
38
- s.rdoc_options = [ "-Na", "-t",
39
- "Unicorn: Rack HTTP server for Unix and fast clients" ]
38
+ summary = %q{Rack HTTP server for fast clients and Unix}
39
+ s.rdoc_options = [ "-Na", "-t", "Unicorn: #{summary}" ]
40
40
  s.require_paths = %w(lib ext)
41
41
  s.rubyforge_project = %q{mongrel}
42
- s.summary = %q{Rack HTTP server for Unix and fast clients}
42
+ s.summary = summary
43
43
 
44
44
  s.test_files = test_files
45
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.93.2
4
+ version: 0.93.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unicorn developers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-07 00:00:00 -07:00
12
+ date: 2009-10-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: "0"
24
24
  version:
25
25
  description: |-
26
- Unicorn is a HTTP server for Rack applications designed to take
27
- advantage of features in Unix/Unix-like kernels and only serve fast
28
- clients on low-latency, high-bandwidth connections. Slow clients should
29
- only be served by placing a reverse proxy capable of fully-buffering
26
+ Unicorn is a HTTP server for Rack applications designed to only serve
27
+ fast clients on low-latency, high-bandwidth connections and take
28
+ advantage of features in Unix/Unix-like kernels. Slow clients should
29
+ only be served by placing a reverse proxy capable of fully buffering
30
30
  both the the request and response in between Unicorn and slow clients.
31
31
  email: mongrel-unicorn@rubyforge.org
32
32
  executables:
@@ -223,7 +223,7 @@ post_install_message:
223
223
  rdoc_options:
224
224
  - -Na
225
225
  - -t
226
- - "Unicorn: Rack HTTP server for Unix and fast clients"
226
+ - "Unicorn: Rack HTTP server for fast clients and Unix"
227
227
  require_paths:
228
228
  - lib
229
229
  - ext
@@ -245,7 +245,7 @@ rubyforge_project: mongrel
245
245
  rubygems_version: 1.3.5
246
246
  signing_key:
247
247
  specification_version: 3
248
- summary: Rack HTTP server for Unix and fast clients
248
+ summary: Rack HTTP server for fast clients and Unix
249
249
  test_files:
250
250
  - test/unit/test_configurator.rb
251
251
  - test/unit/test_http_parser.rb