public
Rubygem
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Click here to lend your support to: thin and make a donation at www.pledgie.com !
Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
macournoyer (author)
Sun Jul 13 20:43:16 -0700 2008
commit  37fbf1d50876315d94865e6ad44c4ac4d9840599
tree    4b5003107f0a76cf5746a043e1bac5a0574b3916
parent  729b76ae2391a197e14d1bb8ec2d40f82a47b1a4
...
1
2
 
 
3
4
5
...
1
 
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 == 1.0.0 The Big release
0
- * Add --force (-f) option to force stopping of a daemonized server, fixes [#72 state:resolved]
0
+ * Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
0
+ * Add --force (-f) option to force stopping of a daemonized server [#72 state:resolved]
0
  * Update halycon adapter loader [mtodd]
0
 
0
 == 0.8.2 Double Margarita release
...
30
31
32
 
 
 
33
34
35
...
72
73
74
75
 
76
77
78
...
30
31
32
33
34
35
36
37
38
...
75
76
77
 
78
79
80
81
0
@@ -30,6 +30,9 @@ module Thin
0
       # Number of persistent connections currently opened
0
       attr_accessor :persistent_connection_count
0
       
0
+      # Disable the use of epoll under Linux
0
+      attr_accessor :no_epoll
0
+      
0
       def initialize
0
         @connections                    = []
0
         @timeout                        = Server::DEFAULT_TIMEOUT
0
@@ -72,7 +75,7 @@ module Thin
0
       # so you can do crazy stuff that require godlike powers here.
0
       def config
0
         # See http://rubyeventmachine.com/pub/rdoc/files/EPOLL.html
0
-        EventMachine.epoll
0
+        EventMachine.epoll unless @no_epoll
0
         
0
         # Set the maximum number of socket descriptors that the server may open.
0
         # The process needs to have required privilege to set it higher the 1024 on
...
49
50
51
 
52
53
54
...
49
50
51
52
53
54
55
0
@@ -49,6 +49,7 @@ module Thin
0
         server.maximum_connections            = @options[:max_conns]
0
         server.maximum_persistent_connections = @options[:max_persistent_conns]
0
         server.threaded                       = @options[:threaded]
0
+        server.no_epoll                       = @options[:no_epoll]
0
 
0
         # Detach the process, after this line the current process returns
0
         server.daemonize if @options[:daemonize]
...
111
112
113
 
114
115
116
...
111
112
113
114
115
116
117
0
@@ -111,6 +111,7 @@ module Thin
0
                                        "(default: #{@options[:max_persistent_conns]})") { |num| @options[:max_persistent_conns] = num.to_i }
0
         opts.on(      "--threaded", "Call the Rack application in threads " +
0
                                     "[experimental]")                                   { @options[:threaded] = true }
0
+        opts.on(      "--no-epoll", "Disable the use of epoll")                         { @options[:no_epoll] = true } if Thin.linux?
0
         
0
         opts.separator ""
0
         opts.separator "Common options:"
...
5
6
7
 
 
 
 
 
 
 
 
 
 
 
8
9
10
...
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -5,6 +5,17 @@ describe Backends::TcpServer do
0
     @backend = Backends::TcpServer.new('0.0.0.0', 3333)
0
   end
0
   
0
+  it "should not use epoll" do
0
+    @backend.no_epoll = true
0
+    EventMachine.should_not_receive(:epoll)
0
+    @backend.config
0
+  end
0
+  
0
+  it "should use epoll" do
0
+    EventMachine.should_receive(:epoll)
0
+    @backend.config
0
+  end
0
+  
0
   it "should connect" do
0
     EventMachine.run do
0
       @backend.connect

Comments