Tôi đã nhận thấy thời gian tải trang cực kỳ chậm với đường dẫn nội dung trong Rails 3.1. Mỗi nội dung (css/js/image) sẽ mất khoảng nửa giây và giây để tải. Điều này thực sự bắt đầu cản trở phát triển. Tôi không có vấn đề tương tự trong sản xuất.Tại sao đường dẫn nội dung bị chậm lại localhost trong Rails 3.1
Có giải pháp nào không? Các log file dưới đây cho thấy làm thế nào mỗi tài sản cá nhân đang tải trong 0,5-0,3 của một giây:
# load of page itself...
...
Completed 200 OK in 1231ms (Views: 933.0ms | ActiveRecord: 15.6ms)
Started GET "/assets/blueprint/screen.css?body=1" for 127.0.0.1 at 2012-01-15 15:53:00 +0000
Served asset /blueprint/screen.css - 304 Not Modified (0ms)
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-01-15 15:53:00 +0000
Served asset /application.css - 304 Not Modified (0ms)
Started GET "/assets/blueprint/print.css?body=1" for 127.0.0.1 at 2012-01-15 15:53:00 +0000
Served asset /blueprint/print.css - 304 Not Modified (0ms)
Started GET "/assets/universal/application.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:01 +0000
Served asset /universal/application.js - 304 Not Modified (2ms)
Started GET "/assets/universal/animate-color.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:01 +0000
Served asset /universal/animate-color.js - 304 Not Modified (0ms)
Started GET "/assets/universal/animate-shadow.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:02 +0000
Served asset /universal/animate-shadow.js - 304 Not Modified (0ms)
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:02 +0000
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
Started GET "/assets/universal/jquery.placehold.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:02 +0000
Served asset /universal/jquery.placehold.js - 304 Not Modified (0ms)
Started GET "/assets/universal/autoresize.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:03 +0000
Served asset /universal/autoresize.js - 304 Not Modified (0ms)
Started GET "/assets/universal/utilities.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:03 +0000
Served asset /universal/utilities.js - 304 Not Modified (0ms)
Started GET "/assets/universal/validators.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:03 +0000
Served asset /universal/validators.js - 304 Not Modified (0ms)
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-01-15 15:53:04 +0000
Served asset /jquery.js - 304 Not Modified (0ms)
Started GET "/assets/whitelabel/pingpanel/pingpanel.css?body=1" for 127.0.0.1 at 2012-01-15 15:53:04 +0000
Served asset /whitelabel/pingpanel/pingpanel.css - 304 Not Modified (0ms)
Started GET "/assets/logo.png" for 127.0.0.1 at 2012-01-15 15:53:05 +0000
Served asset /logo.png - 304 Not Modified (0ms)
Started GET "/assets/application_bar_background.png" for 127.0.0.1 at 2012-01-15 15:53:05 +0000
Served asset /application_bar_background.png - 304 Not Modified (0ms)
Started GET "/assets/linen-new.jpg" for 127.0.0.1 at 2012-01-15 15:53:06 +0000
Served asset /linen-new.jpg - 304 Not Modified (0ms)
Ảnh hưởng của suy thoái có thể được nhìn thấy rõ ràng hơn trong các phân tích mạng chrome:
'rails-dev-tweaks' đã làm một công việc tuyệt vời, cảm ơn bạn. Thời gian tải trang trung bình giảm từ 9 giây xuống 2,6 giây. –