創建一個新的Rails 3.0.5項目使用Ruby 1.9.2,然後我用ab
來測試它:爲什麼Rails以30ms和60ms交替渲染頁面?
ab -n 10 http://127.0.0.1:3000/
我發現視圖的完成時間爲30ms和60ms的之間交替的10結果。爲什麼Rails的行爲像這樣,而不是更一致的渲染時間?
Started GET "/" for 127.0.0.1 at 2011-03-25 06:40:26 -0700
Processing by ProductsController#index as
Rendered products/index.html.haml within layouts/application (15.3ms)
Completed 200 OK in 31ms (Views: 30.6ms | ActiveRecord: 0.0ms)
Started GET "/" for 127.0.0.1 at 2011-03-25 06:40:26 -0700
Processing by ProductsController#index as
Rendered products/index.html.haml within layouts/application (47.7ms)
Completed 200 OK in 63ms (Views: 63.0ms | ActiveRecord: 0.0ms)
[ repeat for total 10 times ]
它是Mac OS X Snow Leopard – 2011-03-25 15:58:45
你使用什麼網絡服務器?乘客?雜種?瘦?獨角獸? 第二個問題 - 您運行多少個Web服務器實例?只有一兩個或更多? 第三個問題,你使用緩存? 第四個問題 - 您是使用生產模式還是開發? – 2011-03-25 19:55:18
它是最基本的Rails 3.0.5:WEBrick和開發模式。 (1 WEBrick的實例...你怎麼有2或3?) – 2011-03-26 16:22:50