unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
c91bec3c1f6bc6d422bcf27a095e59d894929bd7 blob 1431 bytes (raw)

 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
 
# This app is intended to test large HTTP requests with or without
# a fully-buffering reverse proxy such as nginx. Without a fully-buffering
# reverse proxy, unicorn will be unresponsive when client count exceeds
# worker_processes.

DOC = <<DOC
To demonstrate how bad unicorn is at slowly uploading clients:

  # in one terminal, start unicorn with one worker:
  unicorn -E none -l 127.0.0.1:8080 test/benchmark/readinput.ru

  # in a different terminal, upload 45M from multiple curl processes:
  dd if=/dev/zero bs=45M count=1 | curl -T- -HExpect: --limit-rate 1M \
     --trace-time -v http://127.0.0.1:8080/ &
  dd if=/dev/zero bs=45M count=1 | curl -T- -HExpect: --limit-rate 1M \
     --trace-time -v http://127.0.0.1:8080/ &
  wait

# The last client won't see a response until the first one is done uploading
# You also won't be able to make GET requests to view this documentation
# while clients are uploading.  You can also view the stderr debug output
# of unicorn (see logging code in #{__FILE__}).
DOC

run(lambda do |env|
  input = env['rack.input']
  buf = ''.b

  # default logger contains timestamps, rely on that so users can
  # see what the server is doing
  l = env['rack.logger']

  l.debug('BEGIN reading input ...') if l
  :nop while input.read(16384, buf)
  l.debug('DONE reading input ...') if l

  buf.clear
  [ 200, [ %W(Content-Length #{DOC.size}), %w(Content-Type text/plain) ],
    [ DOC ] ]
end)
debug log:

solving c91bec3 ...
found c91bec3 in unicorn.git

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhbt.net/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 unicorn-public unicorn-public/ https://yhbt.net/unicorn-public \
		unicorn-public@yhbt.net unicorn-public@bogomips.org mongrel-unicorn@rubyforge.org mongrel-unicorn-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
	public-inbox-index unicorn-public

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.lang.ruby.unicorn
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	../../../unicorn.git

AGPL code for this site: git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git