[問題] development時webrick很慢

看板Ruby作者 (raison detre)時間9年前 (2015/02/04 15:00), 編輯推噓1(107)
留言8則, 5人參與, 最新討論串1/1
我在development開發時webrick每開啟一個網頁都很慢 但是佈署到production時就沒有這樣問題了 我目前推測是因為我的js數量太多 特別是amchart這個library的數量 但是由於production時rails本身提供的一些機制 precompile等 所以不會有這樣的問題 請問是否有建議的方式可以改善我在開發時候的效能 以下是我執行時期的一些log Started GET "/assets/amcharts/lang/pl.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:46 +0800 Started GET "/assets/amcharts/lang/pt.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:46 +0800 Started GET "/assets/amcharts/lang/ro.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:46 +0800 Started GET "/assets/amcharts/lang/ru.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:47 +0800 Started GET "/assets/amcharts/lang/rw.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:47 +0800 Started GET "/assets/amcharts/lang/sk.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:47 +0800 Started GET "/assets/amcharts/lang/so.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:48 +0800 Started GET "/assets/amcharts/lang/th.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:48 +0800 Started GET "/assets/amcharts/lang/tr.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:48 +0800 Started GET "/assets/amcharts/pie.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:49 +0800 Started GET "/assets/amcharts/radar.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:49 +0800 Started GET "/assets/amcharts/serial.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:49 +0800 Started GET "/assets/amcharts/themes/black.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:50 +0800 Started GET "/assets/amcharts/themes/chalk.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:50 +0800 Started GET "/assets/amcharts/themes/dark.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:50 +0800 Started GET "/assets/amcharts/themes/light.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:50 +0800 Started GET "/assets/amcharts/themes/patterns.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:51 +0800 Started GET "/assets/amcharts/xy.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:51 +0800 Started GET "/assets/fancybox/jquery.fancybox.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:51 +0800 Started GET "/assets/fancybox/jquery.fancybox.pack.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:52 +0800 Started GET "/assets/jquery.cookie.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:52 +0800 Started GET "/assets/jquery.mousewheel-3.0.6.pack.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:52 +0800 Started GET "/assets/jquery.transit.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:53 +0800 Started GET "/assets/list.js?body=1" for 127.0.0.1 at 2015-02-04 14:52:53 +0800 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.250.12.50 ※ 文章網址: https://www.ptt.cc/bbs/Ruby/M.1423033255.A.E4C.html

02/04 18:39, , 1F
可以試試看其他server如unicorn/thin等
02/04 18:39, 1F

02/04 18:39, , 2F
我自己在Windows上是用thin
02/04 18:39, 2F

02/04 20:26, , 3F
試試 passenger standalone 裝好打 passenger start 即可
02/04 20:26, 3F

02/05 02:55, , 4F
你的assets js 的部分 少用 require_tree .
02/05 02:55, 4F

02/05 02:55, , 5F
引入會用到東西就好
02/05 02:55, 5F

02/12 11:43, , 6F
除了 assets 以外 Rack::Lock 這層 middleware 我覺得也
02/12 11:43, 6F

02/12 11:43, , 7F
差滿多的
02/12 11:43, 7F

02/17 11:35, , 8F
謝謝大家的意見,正在逐一嘗試中
02/17 11:35, 8F
文章代碼(AID): #1KqSEdvC (Ruby)
文章代碼(AID): #1KqSEdvC (Ruby)