unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
						download: 
* [PATCH 0/3] reflect changes to Rack::Utils::HTTP_STATUS_CODES
@ 2015-06-30 22:51  4% Eric Wong
  2015-06-30 22:51  7% ` [PATCH 3/3] http_response: reduce size of multi-line header path Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2015-06-30 22:51 UTC (permalink / raw)
  To: unicorn-public; +Cc: e

A user privately reported (to unicorn@bogomips.org) that they wanted
status text reflected in their responses for an HTTP status code not
included with Rack::Utils::HTTP_STATUS_CODES.

They tried to modify Rack::Utils::HTTP_STATUS_CODES hash directly in
their app, but unicorn loads before their app and already memoized the
status codes internally in the CODES hash to reduce GC pressure, thus
their change was never reflected.

With the first change, users can change Rack::Utils::HTTP_STATUS_CODES
as many times as they want (perhaps even based on time-of-day, weather,
server load, whatever) and the changes will be reflected
instantaneously in responses.

Of course, this slows unicorn down slightly due to increased GC
pressure, but I doubt anybody would notice in Real World usage.
In case they do, patch 2/3 will recover the lost performance
if they're using Ruby 2.2+

I figure anybody who cares about micro-benchmark performance with
unicorn would be using the latest Rubies anyways...

That user is Bcc:-ed for these patches, and can follow any public
discussion at: http://bogomips.org/unicorn-public/
(including the Atom feed at http://bogomips.org/unicorn-public/atom.xml )

* [PATCH 1/3] reflect changes in Rack::Utils::HTTP_STATUS_CODES
  introduces a performance regression

* [PATCH 2/3] reduce constants and optimize for Ruby 2.2
  recover lost performance from [PATCH 1/3] (on Ruby 2.2+),
  further regressions for 2.1+

* [PATCH 3/3] http_response: reduce size of multi-line header path
  bonus reduce code size for common cases, should

 lib/unicorn/http_request.rb  | 19 +++++++------------
 lib/unicorn/http_response.rb | 23 ++++++++++-------------
 test/unit/test_response.rb   | 20 ++++++++++++++++++++
 3 files changed, 37 insertions(+), 25 deletions(-)

^ permalink raw reply	[relevance 4%]

* [PATCH 3/3] http_response: reduce size of multi-line header path
  2015-06-30 22:51  4% [PATCH 0/3] reflect changes to Rack::Utils::HTTP_STATUS_CODES Eric Wong
@ 2015-06-30 22:51  7% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2015-06-30 22:51 UTC (permalink / raw)
  To: unicorn-public; +Cc: e

This should save over 100 bytes of bytecode overhead due to
reduced method dispatch points.  The performance difference
when this is actually hit could go either way depending on
how String#<< and realloc(3) interact, but it's uncommon
enough that nobody is expected to notice either way.
---
 lib/unicorn/http_response.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index ec8b7c8..c1aa738 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -39,7 +39,7 @@ module Unicorn::HttpResponse
         else
           if value.include?("\n".freeze)
             # avoiding blank, key-only cookies with /\n+/
-            buf << value.split(/\n+/).map! { |v| "#{key}: #{v}\r\n" }.join
+            value.split(/\n+/).each { |v| buf << "#{key}: #{v}\r\n" }
           else
             buf << "#{key}: #{value}\r\n"
           end
-- 
EW


^ permalink raw reply	[relevance 7%]

* [ANN] unicorn 5.0.0.pre2 - another prerelease!
  @ 2015-07-06 21:41  4% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2015-07-06 21:41 UTC (permalink / raw)
  To: unicorn-public

There is a minor TCP socket options are now applied to inherited
sockets, and we have native support for inheriting sockets from
systemd (by emulating the sd_listen_fds(3) function).

Dynamic changes in the application to Rack::Utils::HTTP_STATUS
codes is now supported, so you can use your own custom status
lines.

Ruby 2.2 and later is now favored for performance.
Optimizations by using constants which made sense in earlier
versions of Ruby are gone: so users of old Ruby versions
will see performance regressions.  Ruby 2.2 users should
see the same or better performance, and we have less code
as a result.

* doc: update some invalid URLs
* apply TCP socket options on inherited sockets
* reflect changes in Rack::Utils::HTTP_STATUS_CODES
* reduce constants and optimize for Ruby 2.2
* http_response: reduce size of multi-line header path
* emulate sd_listen_fds for systemd support
* test/unit/test_response.rb: compatibility with older test-unit

This also includes all changes in unicorn 5.0.0.pre1:

http://bogomips.org/unicorn-public/m/20150615225652.GA16164@dcvr.yhbt.net.html

-- 
EW

^ permalink raw reply	[relevance 4%]

Results 1-3 of 3 | reverse results
2015-06-15 22:56     [ANN] unicorn 5.0.0.pre1 - incompatible changes! Eric Wong
2015-07-06 21:41  4% ` [ANN] unicorn 5.0.0.pre2 - another prerelease! Eric Wong
2015-06-30 22:51  4% [PATCH 0/3] reflect changes to Rack::Utils::HTTP_STATUS_CODES Eric Wong
2015-06-30 22:51  7% ` [PATCH 3/3] http_response: reduce size of multi-line header path Eric Wong


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

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

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.unicorn

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git