代码之家  ›  专栏  ›  技术社区  ›  tsdbrown

使用Phusion Passenger和Rails时,初始服务器启动缓慢

  •  88
  • tsdbrown  · 技术社区  · 16 年前

    为了加入Phusion Passenger的团队,我们为一个小型rails应用程序设置了一个测试服务器来进行测试。

    7 回复  |  直到 16 年前
        1
  •  115
  •   John Douthat    12 年前

    # Speeds up spawn time tremendously -- if your app is compatible. 
    # RMagick seems to be incompatible with smart spawning
    # Older versions of Passenger called this RailsSpawnMethod
    PassengerSpawnMethod smart
    
    # Keep the application instances alive longer. Default is 300 (seconds)
    PassengerPoolIdleTime 1000
    
    # Keep the spawners alive, which speeds up spawning a new Application
    # listener after a period of inactivity at the expense of memory.
    # Older versions of Passenger called this RailsAppSpawnerIdleTime
    PassengerMaxPreloaderIdleTime 0
    
    # Just in case you're leaking memory, restart a listener 
    # after processing 5000 requests
    PassengerMaxRequests 5000
    

    Application fork

    Passenger User Guide 是这些和更多配置选项的绝佳参考。

    :

    # Automatically hit your site when apache starts, so that you don't have to wait
    # for the first request for passenger to "spin up" your application. This even
    # helps when you have smart spawning enabled. 
    PassengerPreStart http://myexample.com/
    PassengerPreStart http://myexample2.com:3500/
    
    # the minimum number of application instances that must be kept around whenever 
    # the application is first accessed or after passenger cleans up idle instances
    # With this option, 3 application instances will ALWAYS be available after the
    # first request, even after passenger cleans up idle ones
    PassengerMinInstances 3
    

    或者,如果你正在使用智能产卵(推荐) PassengerMaxPreloaderIdleTime 0 PassengerPreStart 以获得立即启动的额外好处。

    非常感谢英雄们 phusion.nl !

        2
  •  39
  •   Pritesh Jain    12 年前

    rails_spawn_method smart;
    rails_app_spawner_idle_time 0;
    rails_framework_spawner_idle_time 0;
    passenger_pool_idle_time 1000;
    

    rails_spawn_method 而是使用

    passenger_spawn_method smart; 
    

    到目前为止,其他一切都很好。

        3
  •  4
  •   Josh    14 年前
        4
  •  2
  •   Shuoling Liu    16 年前

    # Additionally keep a copy of the Rails framework in memory. If you're 
    # using multiple apps on the same version of Rails, this will speed up
    # the creation of new RailsAppSpawners. This isn't necessary if you're
    # only running one or 2 applications, or if your applications use
    # different versions of Rails.
    RailsFrameworkSpawnerIdleTime 0
    

    只是一些补充,可能有用。

    框架生成器超时无论如何都不会生效,除非您 显式地将spawn方法设置为“smart”。

    来源: http://groups.google.com/group/phusion-passenger/browse_thread/thread/c21b8d17cdb073fd?pli=1

        5
  •  1
  •   tim inman    16 年前

    如果你的主机是共享服务器,就像我的一样,你无法更改设置,只能执行cron作业。

        6
  •  1
  •   SteenhouwerD    13 年前
        7
  •  0
  •   j0k gauthamp    13 年前

    检查乘客的版本。这是RailsSpawnMethod <string>

    如果是这样(如果我没记错的话),请在所有配置指令中将Passenger替换为Rails,或者查找旧的Passenger文档以获取更多详细信息

    推荐文章