Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Document passenger_buffer_response.

  • Loading branch information...
commit 35b13d24fc79ae52d75cdc5735b2649c69abd9c0 1 parent 745d210
@FooBarWidget FooBarWidget authored
Showing with 59 additions and 0 deletions.
  1. +59 −0 doc/Users guide Nginx.txt
View
59 doc/Users guide Nginx.txt
@@ -784,6 +784,65 @@ This option may occur in the following places:
* In a 'location' configuration block.
* In an 'if' configuration scope.
+==== passenger_buffer_response <on|off> ====
+When turned on, application-generated responses are buffered in memory and also on
+disk if the response is larger than a certain threshold. By buffering responses,
+protection is provided against slow HTTP clients that can not read your response
+immediately.
+
+For example, consider an HTTP client that's on a dial-up modem link, and your
+application instance generates a 2 MB response. If response buffering is turned
+off then your application instance will be blocked until the entire 2 MB has been
+sent out to the HTTP client. This disallows your application instance to do any useful
+work in the mean time. By enabling response buffering, Phusion Passenger will read
+the application response as quickly as possible and will take care of slow clients.
+
+However, keep in mind that enabling this option will make streaming responses
+impossible. Consider for example this piece of Rails code:
+
+--------------------------------
+render :text => lambda { |response, output|
+ 10.times do |i|
+ output.write("entry #{i}\n")
+ output.flush
+ sleep 1
+ end
+}
+--------------------------------
+
+...or this piece of Rack code:
+
+--------------------------------
+class Response
+ def each
+ 10.times do |i|
+ yield("entry #{i}\n")
+ sleep 1
+ end
+ end
+end
+
+app = lambda do |env|
+ [200, { "Content-Type" => "text/plain" }, Response.new]
+end
+--------------------------------
+
+When response buffering is turned on, Phusion Passenger will wait until
+the application is done sending the entire response before forwarding it
+to the client. The client will not receive anything for 10 seconds,
+after which it receives the entire response at once.
+When response buffering is turned off, it works as expected: the client
+receives an "entry X" message every second for 10 seconds.
+
+This option may occur in the following places:
+
+ * In the 'http' configuration block.
+ * In a 'server' configuration block.
+ * In a 'location' configuration block.
+ * In an 'if' configuration scope.
+
+In each place, it may be specified at most once. The default value is 'on'.
+
=== Security options ===
[[PassengerUserSwitching]]
==== passenger_user_switching <on|off> ====
Please sign in to comment.
Something went wrong with that request. Please try again.