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

Discussion in 'Ruby' started by Adam Ms., Nov 24, 2010.

  1. Adam Ms.

    Adam Ms. Guest

    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/.=
    Adam Ms., Nov 24, 2010
    #1
    1. Advertising

  2. 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.

    --
    Posted via http://www.ruby-forum.com/.
    Brian Candler, Nov 24, 2010
    #2
    1. Advertising

  3. On Wed, Nov 24, 2010 at 8:53 AM, Brian Candler <> wrote:
    >> 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.


    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
    Charles Oliver Nutter, Dec 5, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ross M. Greenberg

    LAMP & J2EE as opposed to LAMP vs J2EE

    Ross M. Greenberg, Dec 12, 2004, in forum: Java
    Replies:
    6
    Views:
    1,371
    Robert kebernet Cooper
    Dec 24, 2004
  2. Sabri Pllana
    Replies:
    0
    Views:
    630
    Sabri Pllana
    Aug 20, 2009
  3. Sabri Pllana
    Replies:
    0
    Views:
    604
    Sabri Pllana
    Aug 20, 2009
  4. wce_2009
    Replies:
    1
    Views:
    1,733
    gandhini
    Sep 17, 2010
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,287
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page