Configuring LAMP for Ruby created web pages (not Rails). 2010

A

Adam Ms.

Hello,

I've used Rails on my own LAMPs with Phusion Passenger. Phusion really
is convenient.

Now I'd like to skip the framework and just do Ruby (think PHP
websites).

The servers run Ubuntu 10.04 and I have the freedom for any
configuration.

The problem I'm having is most of my Googles give me Rails hits and
out-of-date info. It appears that =E2=80=9Cmod_ruby=E2=80=9D is old-schoo=
l and is no
longer in use.

I'm seeing a mix of information for Phusion, Rack, and eRuby.

I would like to avoid out-of-date stuff and go with the most
up-to-date end-of-2010 way of configuring my LAMP servers to serve up
Ruby created web pages. It would be great if there was flexibility in
Ruby versions/VMs. Is JRuby a higher-performance direction? Would I need
a Java container for that (Tomcat?).

Thanks in advance for steering me in the right direction,
Adam.

Ps: Extra bonus points for not insisting that I use Rails. Rails is
great and I've been successful with it. This direction I'd like to
explore is not making a comment on Rails at all.

-- =

Posted via http://www.ruby-forum.com/.=
 
B

Brian Candler

Adam Ms. wrote in post #963574:
Now I'd like to skip the framework and just do Ruby (think PHP
websites).

Phusion Passenger is basically mod_rack. You can sit on top of it any
Rack-compatible framework. I'd take a close look at Sinatra if you want
something extremely lightweight.

It may still be possible to get Apache to render erb pages directly,
PHP-style, but I'd advise against it anyway. These days most people like
to separate out their logic from their templates.

Using Sinatra, you can start very close to PHP style, by mapping URLs to
templates:

get '/' do
erb :index
end

get '/posts/:id' do
@post = Post.find(id)
erb :show_post
end

but it encourages you to move your 'action' logic into the application,
where it is easier to test and refactor, rather than the templates.

Furthermore, you can easily choose a different template format, such as
HAML.
Is JRuby a higher-performance direction?

I tried running Rails directly under JRuby once - it took about 600MB of
VM for a simple app. But others have had more success, I believe.

Regards,

Brian.
 
C

Charles Oliver Nutter

I tried running Rails directly under JRuby once - it took about 600MB of
VM for a simple app. But others have had more success, I believe.

JRuby's default settings are to allow the memory size to grow up to
512MB, which is on top of whatever native memory the JVM allocates. As
a result, heavily-hit applications can sometimes grow to that size,
since generational GC performs better with a lot of "breathing room".

Also, if you are not running threadsafe Rails, most JRuby-based
servers will spin up multiple JRuby instances in the same process. So
that 600MB app you ran was actually equivalent to an entire cluster of
C Ruby servers. We generally do much better on memory use as the
number of required instances goes up.

And finally, if you run Rails in threadsafe mode or some other
threadsafe-by-default framework like Sinatra) you can easily run an
app in a single 100-200MB process that can saturate an entire machine,
across all cores.

- Charlie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top