Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Adjust default timeouts so that they're more suited for virtual private 
servers. Rename some config options.
Hongli Lai (Phusion) (author)
Fri May 09 06:49:44 -0700 2008
commit  ac793e927deffe8cdf971ccd9a915a3f4a544987
tree    525f1e43edb339f78c9a863a816756ea98adec43
parent  edda89381f511c6f78e21fc5b151915e35df5921
...
384
385
386
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
388
389
...
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
...
549
550
551
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
553
554
0
@@ -384,6 +384,49 @@ This option allows one to specify the Ruby interpreter to use.
0
 This option may only occur once, in the global server configuration.
0
 The default is 'ruby'.
0
 
0
+=== PassengerMaxPoolSize <integer> ===
0
+The maximum number of Ruby on Rails or Rack application instances that may
0
+be simultaneously active. A larger number results in higher memory usage,
0
+but improved ability to handle concurrent HTTP clients.
0
+
0
+The optimal value depends on your system's hardware and the server's average
0
+load. You should experiment with different values. But generally speaking,
0
+the value should be at least equal to the number of CPUs (or CPU cores) that
0
+you have. If your system has 2 GB of RAM, then we recommend a value of '30'.
0
+If your system is a Virtual Private Server (VPS) and has about 256 MB RAM, and
0
+is also running other services such as MySQL, then we recommend a value of '2'.
0
+
0
+If you find that your server is unable to handle the load on your Rails/Rack websites
0
+(i.e. running out of memory) then you should lower this value. (Though if your
0
+sites are really that popular, then you should strongly consider upgrading your
0
+hardware or getting more servers.)
0
+
0
+This option may only occur once, in the global server configuration.
0
+The default value is '6'.
0
+
0
+TIP: We strongly recommend you to <<reducing_memory_usage,use Ruby Enterprise
0
+Edition>>. This allows you to reduce the memory usage of your Ruby on Rails applications
0
+by about 33%. And it's not hard to install.
0
+
0
+=== PassengerPoolIdleTime <integer> ===
0
+The maximum number of seconds that a Ruby on Rails or Rack application instance
0
+may be idle. That is, if an application instance hasn't done anything after
0
+the given number of seconds, then it will be shutdown in order to conserve
0
+memory.
0
+
0
+Decreasing this value means that applications will have to be spawned
0
+more often. Since spawning is a relatively slow operation, some visitors may
0
+notice a small delay when they visit your Rails/Rack website. However, it will also
0
+free up resources used by applications more quickly.
0
+
0
+The optimal value depends on the average time that a visitor spends on a single
0
+Rails/Rack web page. We recommend a value of `2 * x`, where `x` is the average
0
+number of seconds that a visitor spends on a single Rails/Rack web page. But your
0
+mileage may vary.
0
+
0
+This option may only occur once, in the global server configuration.
0
+The default value is '300'.
0
+
0
 [[PassengerUserSwitching]]
0
 === PassengerUserSwitching <on|off> ===
0
 Whether to enable <<user_switching,user switching support>>.
0
@@ -506,49 +549,6 @@ render <<reducing_memory_usage,Ruby Enterprise Edition's memory reduction techno
0
 This option may occur once, in the global server configuration or in a virtual host
0
 configuration block. The default value is 'smart'.
0
 
0
-==== RailsMaxPoolSize <integer> ====
0
-The maximum number of Ruby on Rails application instances that may
0
-be simultaneously active. A larger number results in higher memory usage,
0
-but improved ability to handle concurrent HTTP clients.
0
-
0
-The optimal value depends on your system's hardware and the server's average
0
-load. You should experiment with different values. But generally speaking,
0
-the value should be at least equal to the number of CPUs (or CPU cores) that
0
-you have. If your system has 2 GB of RAM, then we recommend a value of '30'.
0
-If your system is a Virtual Private Server (VPS) and has about 256 MB RAM, and
0
-is also running other services such as MySQL, then we recommend a value of '2'.
0
-
0
-If you find that your server is unable to handle the load on your Rails websites
0
-(i.e. running out of memory) then you should lower this value. (Though if your
0
-sites are really that popular, then you should strongly consider upgrading your
0
-hardware or getting more servers.)
0
-
0
-This option may only occur once, in the global server configuration.
0
-The default value is '20'.
0
-
0
-TIP: We strongly recommend you to <<reducing_memory_usage,use Ruby Enterprise
0
-Edition>>. This allows you to reduce your memory usage by about 33%. And it's
0
-not hard to install.
0
-
0
-==== RailsPoolIdleTime <integer> ====
0
-The maximum number of seconds that a Ruby on Rails application instance
0
-may be idle. That is, if an application instance hasn't done anything after
0
-the given number of seconds, then it will be shutdown in order to conserve
0
-memory.
0
-
0
-Decreasing this value means that Rails applications will have to be spawned
0
-more often. Since spawning is a relatively slow operation, some visitors may
0
-notice a small delay when they visit your Rails site. However, it will also
0
-free up resources used by Rails applications more quickly.
0
-
0
-The optimal value depends on the average time that a visitor spends on a single
0
-Rails web page. We recommend a value of `2 * x`, where `x` is the average
0
-number of seconds that a visitor spends on a single Rails web page. But your
0
-mileage may vary.
0
-
0
-This option may only occur once, in the global server configuration.
0
-The default value is '120'.
0
-
0
 === Rack-specific options ===
0
 
0
 ==== RackAutoDetect <on|off> ====
...
25
26
27
28
29
 
 
30
31
32
...
161
162
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
165
166
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
...
309
310
311
 
 
 
 
 
 
 
 
 
 
312
313
314
...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
...
375
376
377
 
 
 
 
 
 
 
 
 
 
378
379
380
...
25
26
27
 
 
28
29
30
31
32
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
...
261
262
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
265
266
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
356
357
358
 
 
 
 
 
 
 
 
 
 
359
360
361
...
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
0
@@ -25,8 +25,8 @@ using namespace Passenger;
0
 
0
 extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
0
 
0
-#define DEFAULT_MAX_POOL_SIZE 20
0
-#define DEFAULT_POOL_IDLE_TIME 120
0
+#define DEFAULT_MAX_POOL_SIZE 6
0
+#define DEFAULT_POOL_IDLE_TIME 300
0
 
0
 
0
 template<typename T> static apr_status_t
0
@@ -161,6 +161,44 @@ cmd_passenger_ruby(cmd_parms *cmd, void *pcfg, const char *arg) {
0
 }
0
 
0
 static const char *
0
+cmd_passenger_max_pool_size(cmd_parms *cmd, void *pcfg, const char *arg) {
0
+ ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
+ cmd->server->module_config, &passenger_module);
0
+ char *end;
0
+ long int result;
0
+
0
+ result = strtol(arg, &end, 10);
0
+ if (*end != '\0') {
0
+ return "Invalid number specified for PassengerMaxPoolSize.";
0
+ } else if (result <= 0) {
0
+ return "Value for PassengerMaxPoolSize must be greater than 0.";
0
+ } else {
0
+ config->maxPoolSize = (unsigned int) result;
0
+ config->maxPoolSizeSpecified = true;
0
+ return NULL;
0
+ }
0
+}
0
+
0
+static const char *
0
+cmd_passenger_pool_idle_time(cmd_parms *cmd, void *pcfg, const char *arg) {
0
+ ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
+ cmd->server->module_config, &passenger_module);
0
+ char *end;
0
+ long int result;
0
+
0
+ result = strtol(arg, &end, 10);
0
+ if (*end != '\0') {
0
+ return "Invalid number specified for PassengerPoolIdleTime.";
0
+ } else if (result <= 0) {
0
+ return "Value for PassengerPoolIdleTime must be greater than 0.";
0
+ } else {
0
+ config->poolIdleTime = (unsigned int) result;
0
+ config->poolIdleTimeSpecified = true;
0
+ return NULL;
0
+ }
0
+}
0
+
0
+static const char *
0
 cmd_passenger_user_switching(cmd_parms *cmd, void *pcfg, int arg) {
0
   ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
     cmd->server->module_config, &passenger_module);
0
@@ -223,44 +261,6 @@ cmd_rails_spawn_method(cmd_parms *cmd, void *pcfg, const char *arg) {
0
   return NULL;
0
 }
0
 
0
-static const char *
0
-cmd_rails_max_pool_size(cmd_parms *cmd, void *pcfg, const char *arg) {
0
- ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
- cmd->server->module_config, &passenger_module);
0
- char *end;
0
- long int result;
0
-
0
- result = strtol(arg, &end, 10);
0
- if (*end != '\0') {
0
- return "Invalid number specified for RailsMaxPoolSize.";
0
- } else if (result <= 0) {
0
- return "Value for RailsMaxPoolSize must be greater than 0.";
0
- } else {
0
- config->maxPoolSize = (unsigned int) result;
0
- config->maxPoolSizeSpecified = true;
0
- return NULL;
0
- }
0
-}
0
-
0
-static const char *
0
-cmd_rails_pool_idle_time(cmd_parms *cmd, void *pcfg, const char *arg) {
0
- ServerConfig *config = (ServerConfig *) ap_get_module_config(
0
- cmd->server->module_config, &passenger_module);
0
- char *end;
0
- long int result;
0
-
0
- result = strtol(arg, &end, 10);
0
- if (*end != '\0') {
0
- return "Invalid number specified for RailsPoolIdleTime.";
0
- } else if (result <= 0) {
0
- return "Value for RailsPoolIdleTime must be greater than 0.";
0
- } else {
0
- config->poolIdleTime = (unsigned int) result;
0
- config->poolIdleTimeSpecified = true;
0
- return NULL;
0
- }
0
-}
0
-
0
 
0
 /*************************************************
0
  * Rack-specific settings
0
@@ -309,6 +309,16 @@ const command_rec passenger_commands[] = {
0
     NULL,
0
     RSRC_CONF,
0
     "The Ruby interpreter to use."),
0
+ AP_INIT_TAKE1("PassengerMaxPoolSize",
0
+ (Take1Func) cmd_passenger_max_pool_size,
0
+ NULL,
0
+ RSRC_CONF,
0
+ "The maximum number of simultaneously alive application instances."),
0
+ AP_INIT_TAKE1("PassengerPoolIdleTime",
0
+ (Take1Func) cmd_passenger_pool_idle_time,
0
+ NULL,
0
+ RSRC_CONF,
0
+ "The maximum number of seconds that an application may be idle before it gets terminated."),
0
   AP_INIT_FLAG("PassengerUserSwitching",
0
     (Take1Func) cmd_passenger_user_switching,
0
     NULL,
0
@@ -346,16 +356,6 @@ const command_rec passenger_commands[] = {
0
     NULL,
0
     RSRC_CONF,
0
     "The spawn method to use."),
0
- AP_INIT_TAKE1("RailsMaxPoolSize",
0
- (Take1Func) cmd_rails_max_pool_size,
0
- NULL,
0
- RSRC_CONF,
0
- "The maximum number of simultaneously alive Rails application instances."),
0
- AP_INIT_TAKE1("RailsPoolIdleTime",
0
- (Take1Func) cmd_rails_pool_idle_time,
0
- NULL,
0
- RSRC_CONF,
0
- "The maximum number of seconds that a Rails application may be idle before it gets terminated."),
0
   
0
   // Rack-specific settings.
0
   AP_INIT_FLAG("RackAutoDetect",
0
@@ -375,6 +375,16 @@ const command_rec passenger_commands[] = {
0
     NULL,
0
     RSRC_CONF,
0
     "Deprecated option."),
0
+ AP_INIT_TAKE1("RailsMaxPoolSize",
0
+ (Take1Func) cmd_passenger_max_pool_size,
0
+ NULL,
0
+ RSRC_CONF,
0
+ "Deprecated option."),
0
+ AP_INIT_TAKE1("RailsPoolIdleTime",
0
+ (Take1Func) cmd_passenger_pool_idle_time,
0
+ NULL,
0
+ RSRC_CONF,
0
+ "Deprecated option."),
0
   AP_INIT_FLAG("RailsUserSwitching",
0
     (Take1Func) cmd_passenger_user_switching,
0
     NULL,
...
32
33
34
35
 
36
37
38
...
32
33
34
 
35
36
37
38
0
@@ -32,7 +32,7 @@ module Passenger
0
 # *Note*: FrameworkSpawner may only be started asynchronously with AbstractServer#start.
0
 # Starting it synchronously with AbstractServer#start_synchronously has not been tested.
0
 class FrameworkSpawner < AbstractServer
0
- APP_SPAWNER_MAX_IDLE_TIME = 120
0
+ APP_SPAWNER_MAX_IDLE_TIME = 600
0
   APP_SPAWNER_CLEAN_INTERVAL = APP_SPAWNER_MAX_IDLE_TIME + 5
0
 
0
   include Utils

Comments

    No one has commented yet.