Repository: puma/puma
File: lib/puma/dsl.rb (Ruby)

Code before:
      @options[:fork_worker] = Integer(after_requests)
    end

    # The number of requests to attempt inline before sending a client back to
    # the reactor to be subject to normal ordering.
    #
    # The default is 10.
    #
    # @example
    #   max_fast_inline 20
    #
    def max_fast_inline(num_of_requests)
      @options[:max_fast_inline] = Float(num_of_requests)
    end

    # When true, keep-alives are maintained on in-bound connections. This is the default.
    # When false, the connection is closed by Puma after each request, requiring that
    # the client open a new request.
    # Setting to false is the best way to ensure requests are handled by the server
    # in the order in which they are received. There is a TCP operations cost for both
    # the client and server each time a new connection is opened/closed.
    # This option will ensure fairness at the cost of potentially more time spent in TCP operations.
    #
    # @example
    #   enable_keep_alives false
    #
    def enable_keep_alives(enabled=true)
      @options[:enable_keep_alives] = enabled
    end

    # Specify the backend for the IO selector.
    #
    # Provided values will be passed directly to +NIO::Selector.new+, with the
    # exception of +:auto+ which will let nio4r choose the backend.
    #
    # Check the documentation of +NIO::Selector.backends+ for the list of valid
    # options. Note that the available options on your system will depend on the
    # operating system. If you want to use the pure Ruby backend (not
    # recommended due to its comparatively low performance), set environment
    # variable +NIO4R_PURE+ to +true+.
    #
    # The default is +:auto+.
    #
    # @see https://github.com/socketry/nio4r/blob/master/lib/nio/selector.rb
    #
    def io_selector_backend(backend)
      @options[:io_selector_backend] = backend.to_sym
    end

    # Ensures +STDOUT+ and +STDERR+ is immediately flushed to the underlying
    # operating system and is not buffered internally

Review comment (suggestion):
```suggestion
    # When `true`, keep-alive connections are maintained on inbound requests. 
    # Enabling this setting reduces the number of TCP operations, reducing response 
    # times for connections that can send multiple requests in a single connection.
    #
    # When Puma receives more incoming connections than available Puma threads, 
    # enabling the keep-alive behavior may result in processing requests out-of-order, 
    # increasing overall response time variance. Increased response time variance 
    # means that the overall average of response times might not change, but more 
    # outliers will exist. Those long-tail outliers may significantly affect response 
    # times for some processed requests.
    # 
    # When `false`, Puma closes the connection after each request, requiring the 
    # client to open a new request. Disabling this setting guarantees that requests 
    # will be processed in the order they are fully received, decreasing response 
    # variance and eliminating long-tail outliers caused by keep-alive behavior. 
    # The trade-off is that the number of TCP operations required will increase.
    #
    # The default is +true+.
    # 
    # @example
    #   enable_keep_alives false
    #
```

Code after:
      @options[:fork_worker] = Integer(after_requests)
    end

    # The number of requests to attempt inline before sending a client back to
    # the reactor to be subject to normal ordering.
    #
    # The default is 10.
    #
    # @example
    #   max_fast_inline 20
    #
    def max_fast_inline(num_of_requests)
      @options[:max_fast_inline] = Float(num_of_requests)
    end

    # When `true`, keep-alive connections are maintained on inbound requests.
    # Enabling this setting reduces the number of TCP operations, reducing response
    # times for connections that can send multiple requests in a single connection.
    #
    # When Puma receives more incoming connections than available Puma threads,
    # enabling the keep-alive behavior may result in processing requests out-of-order,
    # increasing overall response time variance. Increased response time variance
    # means that the overall average of response times might not change, but more
    # outliers will exist. Those long-tail outliers may significantly affect response
    # times for some processed requests.
    #
    # When `false`, Puma closes the connection after each request, requiring the
    # client to open a new request. Disabling this setting guarantees that requests
    # will be processed in the order they are fully received, decreasing response
    # variance and eliminating long-tail outliers caused by keep-alive behavior.
    # The trade-off is that the number of TCP operations required will increase.
    #
    # The default is +true+.
    #
    # @example
    #   enable_keep_alives false
    #
    def enable_keep_alives(enabled=true)
      @options[:enable_keep_alives] = enabled
    end

    # Specify the backend for the IO selector.
    #
    # Provided values will be passed directly to +NIO::Selector.new+, with the
    # exception of +:auto+ which will let nio4r choose the backend.
    #
    # Check the documentation of +NIO::Selector.backends+ for the list of valid
    # options. Note that the available options on your system will depend on the
    # operating system. If you want to use the pure Ruby backend (not
    # recommended due to its comparatively low performance), set environment
    # variable +NIO4R_PURE+ to +true+.