Re: [問題] Lighttpd的設定方式

看板Ruby作者 (godfat 真常)時間14年前 (2009/10/15 21:13), 編輯推噓0(008)
留言8則, 2人參與, 最新討論串3/4 (看更多)
最近收了一堆信,信箱整個爆,來賺 p 幣買信箱... @@ : → ryudo:thin可靠嗎?我沒啥聽說有production的站在用 10/15 18 根據我之前的經驗,thin 沒有 mongrel 穩,mongrel 算是經過考驗的。 但是 thin 比 mongrel 快很多很多很多... 基本上我會建議用 thin, 除非你碰到不穩的問題,才考慮換 mongrel. heroku: http://heroku.com/ rails/rack hosting, 他們的 dyno 是用 thin 去改的。 根據他們的說法是,比 mongrel 快,比 mongrel 小,比 mongrel 穩。 我自己的經驗是比 mongrel 快很多很多,但其他的不見得。 另外很重要的是,mongrel 沒有直接支援 rack, 啟動 script 也不是很好用。這點 thin 也是大勝 mongrel. 不過我覺得這都是因為 mongrel 後來沒在發展了.... 如果 mongrel 繼續發展,不會輸 thin. 但現在我會說 mongrel 輸給 thin 不少。 : → ryudo:unicorn還是第一次聽到 10/15 18 這滿新的,作者是 Eric Wong, 是 mogilefs-client 的作者。 程式寫得相當漂亮,簡潔俐落,設計則是參考 UNIX/POSIX 的作法。 很明顯這不能用在 windows 上 XD 可以參考這頁: http://tomayko.com/writings/unicorn-is-unix 這邊則是一些設計上的考量: http://unicorn.bogomips.org/DESIGN.html http://unicorn.bogomips.org/PHILOSOPHY.html 好,我知道大家都很懶,不想自己看 XD 正好我今天大概看了一下。 簡單地說,unicorn 遵循 UNIX philosophy: 1. Write programs that do one thing and do it well. 2. Write programs to work together. 3. Write programs to handle text streams, because that is a universal interface. unicorn 不企圖做到每件事,他只對付快速的 client, 不做 buffer. 所以前端會需要有一個 reverse proxy, 例如 nginx. 你要用 apache 也不是不行啦,但就我所知沒什麼人在用 apache... 我指做這些事情。每個地方都在講 apache bloat bloat bloat, slow slow slow... memory leak leak leak... 他就只是很方便而已。 除此之外就是用 shared socket, select (or epoll?), 還有 prefork. 而慢速的 client? 用 Rainbows! 對付 http://rainbows.rubyforge.org/ 這是從 unicorn 切出來的。 我個人是覺得跟 passenger 架構有一點類似,只是 passenger 是整個包成一包, 但 unicorn 則是把最重要的核心拆出來。程式碼也很少,除了 http parser 外, 全部都是 ruby 寫成。http parser 是用 mongrel 的,用 ragel 寫,產生 c 程式 再去 compile 的。ragel 是 parser generator, 最近應該也滿流行的。 參考這篇留言: http://github.com/blog/517-unicorn#comment_3142 Now don't get me wrong, Passenger is great. Point it at your app and for the most part your are done. But if you need it to do something different, it's fairly inflexible, and it's here, I think, that Unicorn really shines. 當你想做點什麼手腳時,passenger 沒有這樣的空間讓你動; 然而 unicorn 只有最核心的部份,而且全部是 ruby, 你隨時可以改變什麼。 我覺得 unicorn 相當值得一試,雖然短時間內可能還是繼續用 passenger. 原因很簡單,目前我不需要對 passenger 動手腳 :p 而且針對 passenger 的 script 都寫好了,沒有重大問題前,也不用特別去換 但如果碰到什麼問題,我第一個決定試的肯定是 unicorn. 他沒什麼新東西,都是過去已知的概念,但我個人覺得是個突破。 就像 rails 其實也沒有什麼新東西,一個個看都沒什麼,放在一起就厲害了。 : → ryudo:passenger for nginx有比apache版好嗎? 10/15 18 核心是一樣的,所以這個問題近似 nginx 有比 apache 好嗎? 我會說這是肯定的。然 apache 好的地方在於他是老牌,工具很多, 文件很多,問題也都是已知的,所以你可以想辦法避開。 nginx 相較之下年輕很多,一開始又只有俄國人用,英文文件很少。 不過也許他們放在一起比較是不太公平的,畢竟 apache 是萬能型的, 他幾乎什麼都有... nginx 也沒有 mod_php, 你只能用 fast-cgi. 也有人說,如果你有 fast-cgi, 何必用 mod_php? 不過 apache mod_php 似乎做得非常好,足以跟 fast-cgi 相較, 而且用起來也比 fast-cgi 方便得多。 但跟 lighttpd 比較就很明顯了。lighttpd 發展近幾年太過遲緩, nginx 又快速蓬勃發展,使用者量早已超越 lighttpd 一大截了... 小、快、穩,nginx 大概是這幾個優點,可以取代 lighttpd, 但功能上並不容易取代 apache, 如果你需要很多 apache 的功能。 你要跑 php 的話可能還是用 apache 比較「方便」就是了。 否則 nginx 真的是好太多的選擇。 passenger 不支援 nginx 的話,我不會考慮 passenger, 會繼續使用 thin cluster (用了一陣子) -- #!/usr/bin/env ruby [露比] /Programming (Kn|N)ight/ 看板《Ruby》 # if a dog nailed extra legs that http://www.ptt.cc/bbs/Ruby/index.html # walks like an octopus, and Welcome ~Ruby@ptt~ # talks like an octopus, then ◢█◣ http://www.ruby-lang.org/ # we are happy to treat it as http://www.ruby-doc.org/ # if it were an octopus. http://www.rubyforge.org/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.28.18

10/19 14:24, , 1F
要多寫額外的init script是最不能接受之處
10/19 14:24, 1F

10/19 14:27, , 2F
哪一個 init script?
10/19 14:27, 2F

10/19 14:40, , 3F
mongrel或thin要啟動不是都要自己寫init script?
10/19 14:40, 3F

10/19 14:53, , 4F
寫 config 就可以了啊..
10/19 14:53, 4F

10/19 15:02, , 5F
nginx可以不用額外寫mongrel cluster的init script?
10/19 15:02, 5F

10/19 15:34, , 6F
nginx+passenger就nginx config,thin/mongrel也是config可
10/19 15:34, 6F

10/19 16:29, , 7F
nginx+php(fastcgi)的話呢?
10/19 16:29, 7F

10/19 16:43, , 8F
php 的 fast-cgi 就是另一回事了,那跟 nginx 沒直接關係
10/19 16:43, 8F
文章代碼(AID): #1Arn_WrF (Ruby)
文章代碼(AID): #1Arn_WrF (Ruby)