Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaxContentLength modification at runtime #5

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

MaxContentLength modification at runtime #5

wants to merge 14 commits into from

Conversation

alor
Copy link
Contributor

@alor alor commented Jan 31, 2011

i've added the bindings to change the max length of a post request at runtime.
i've also inserted the ability to specify the HTTP status code description in responses.

if you like it, merge it and publish a new gem version.

thank you.

@alor
Copy link
Contributor Author

alor commented Feb 11, 2011

any comments on it ?
if you don't like the way it is written, i can fix it. just give me feedback.
i just need to know if this feature will go mainstream or not.

thank you.

gdb and others added 10 commits March 16, 2011 22:15
…ector

Currently, if a class overrides the 'unbind' method, the RubyHttpConnection
object in each connection object will be leaked.  Similarly, if no one ever
calls 'unbind' on the HttpServer, the RubyHttpConnection will be leaked on
garbage collection.  For example, the following program has a memory leak:

"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection
  include EM::HttpServer
  def unbind; end
end
EM.run do
  EM.start_server '127.0.0.1', 9000, MyServer
end
"""

As does the following:

"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection
  include EM::HttpServer
end
10000.times { MyServer.new 1 }
"""

This patch moves destruction of the RubyHttpConnection object from the unbind
method to the garbage collector.

One may wonder about the performance implications of this patch.  As a rough
estimate, on my quad-core/16 GB RAM desktop, I ran
  time for i in $(seq 1 10000); do curl localhost:9000; done
with and without this patch against the following server program:

"""
require 'rubygems'; require 'eventmachine'; require 'evma_httpserver'
class MyServer < EM::Connection; include EM::HttpServer; end
EM.run { EM.start_server '0.0.0.0', 9000, MyServer }
"""

Results are shown below.

[Without this patch (8e20269)]
$ time ( for i in $(seq 1 10000); do curl 127.0.0.1:9000; done >/dev/null 2>/dev/null )

real   0m57.654s
user   0m2.770s
sys    0m3.230s

[With this patch]
$ time ( for i in $(seq 1 10000); do curl 127.0.0.1:9000; done >/dev/null 2>/dev/null )

real   0m55.123s
user   0m2.550s
sys    0m3.240s
A 404/201 response does not indicate that the connection is unviable.
Added support for absolute URIs on request line
added OPTIONS to list of verbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants