Jano Svitok
7/3/2007 9:22:00 AM
On 7/3/07, Zoltan Dezso <maildeliverysubs@freemail.hu> wrote:
> Hi everyone,
>
> We are running apache with eruby to server .rhtml files. Every apache
> process loads eruby, thus every access makes a huge dent on memory. We
> have tried using mod_ruby, and while memory usage got better, we had
> strange errors and performance didn't increase either. There is no
> documentation on the web (i don't regard a non-functioning forum and a
> jotted down bunch of notes from modruby.net documentation) and quite
> frankly noone seems too eager to share information about this.
>
> Our config is
> AddType application/x-httpd-eruby .rhtml
> Action application/x-httpd-eruby /cgi-bin/eruby
>
> Tried mod_ruby with this too
> RubyRequire apache/eruby-run
> RubyRequire apache/erb-run
> RubyRequire eruby
> <Files *.rhtml>
> SetHandler ruby-object
> RubyHandler Apache::ERubyRun.instance
> </Files>
>
> My company has just lost a server recently due to the high load (~8 per
> second, WTF?) Former company (with PHP and Java), we used to serve
> hundreds of pages and neither language is very light.
>
> We are not using rails, and unless rails is significantly changed to
> accommodate for japanese keitai sites, that is not going to change. FCGI
> is not entirely out of the question (although would mean a complete
> rewrite of the sites probably).
>
> Our options are: Eruby (is this even maintained anymore?), Mod_ruby (is
> this working well, is it performant?), FCGI (might work). What's not an
> option: Mongrel (no ssl breaks the deal), Rails, Do nothing (either we
> can make ruby make faster and more scalable, or bye-bye ruby -
> personally, i love this language, would be a heartbreak to see it go,
> but business is business).
>
> Any insights?
Just blind hints:
- FGCI will help you with the overhead of starting interpreter each
time (maybe mod ruby will do that as well)
- erubis is an ERB implementation in C that claims is much faster
- caching parsed templates can help a lot as in my experiences with
plain ERB parsing takes a significant part of running time (you may
use ruby-prof to find out whether it is the case). In my case, with
caching parsed templates time of a script dropped from 12 seconds to 6
(it was a standalone script, not a webpage). Obviojusly, it depends on
how many templates do you have, and how many times they are rendered.
- you should use mongrel behind something (apache, nginx,...) anyway,
so maybe you can work around ssl somehow.
Take these as ideas to look at, that might or might not be helpful. I
have not tested any of them, I even do not develop nor deploy webpages
;-)
J.