How is rails different from PHP from Apache's view?

Hi,

I love rails much better than php.
(I’m not a php expert, though.)
However, when I use rails with apache, it’s painful.
(I use Dreamhost as my web hosting server, by the way)

I know that I can’t compare rails with php because rails is a framework
and php is a language.
Let’s just think that rails is a ruby with some libraries.
Then it’s comparison between php and ruby, right?

Why is rails so difficult to deploy while php is easy?
Can we make rails as easy as php for apache, or is it fundamentally
impossible?

This is not a rant but pure curiosity.

Thanks.

Sam

On Dec 23, 2007, at 9:41 PM, Sam K. wrote:

I know that I can’t compare rails with php because rails is a
framework
and php is a language.
Let’s just think that rails is a ruby with some libraries.
Then it’s comparison between php and ruby, right?

PHP runs on most servers as an Apache module. That means you can get
PHP cobbled into Apache with little effort and every Web host on the
planet does this for you. Ruby does not run (well) as an Apache
module. That means you have to manage the efficiencies of
instantiating the Ruby interpreter as infrequently as possible. This
is normally done by running Rails inside mongrel as a long running
process.

The deployment difficulty is simply that of taking the mongrels down
and pointing them at new code. Once you’ve done a few deployments, it
will seem a lot easier. Oh, and Capistrano make it almost automatic
for many cases.

Hi Steve,

Steve R. wrote:

On Dec 23, 2007, at 9:41 PM, Sam K. wrote:

I know that I can’t compare rails with php because rails is a
framework
and php is a language.
Let’s just think that rails is a ruby with some libraries.
Then it’s comparison between php and ruby, right?

PHP runs on most servers as an Apache module. That means you can get
PHP cobbled into Apache with little effort and every Web host on the
planet does this for you. Ruby does not run (well) as an Apache
module. That means you have to manage the efficiencies of
instantiating the Ruby interpreter as infrequently as possible. This
is normally done by running Rails inside mongrel as a long running
process.

Is it possible to make an Apache module for rails?
If so, why hasn’t it be made yet?
If not, why?

The deployment difficulty is simply that of taking the mongrels down
and pointing them at new code. Once you’ve done a few deployments, it
will seem a lot easier. Oh, and Capistrano make it almost automatic
for many cases.

Yes.
But some web hosting servers like Dreamhost don’t support mongrel.:frowning:

Thanks.
Sam

Steve R. wrote:

Is it possible to make an Apache module for rails?
If so, why hasn’t it be made yet?
If not, why?

mod_ruby is not completely reentrant and that makes it problematic for
long running Web applications like Rails. There may be other issues
I’m not aware of, but I’ve not heard much about people using mod_ruby.

Hmmm, I see.

Yes.
But some web hosting servers like Dreamhost don’t support mongrel.:frowning:

I don’t host anything on Dreamhost, but a quick Google turned this up:

http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=96032

There are 2 problems with that.

  1. It uses Premium Service.
  2. Even with that, the writer has a problem that the process is being
    killed, which happens a lot in Dreamhost.

Maybe it’s of some help.

I appreciate your help.

Sam

On 24 Dec 2007, at 08:05, Sam K. wrote:

The deployment difficulty is simply that of taking the mongrels down
and pointing them at new code. Once you’ve done a few deployments, it
will seem a lot easier. Oh, and Capistrano make it almost automatic
for many cases.

Yes.
But some web hosting servers like Dreamhost don’t support mongrel.:frowning:

One good reason not to use a shared host for rails hosting,
especially the really cheap ones (except maybe one or two exceptions
that confirm the rule).

Best regards

Peter De Berdt

Is it possible to make an Apache module for rails?
If so, why hasn’t it be made yet?
If not, why?

mod_ruby is not completely reentrant and that makes it problematic for
long running Web applications like Rails. There may be other issues
I’m not aware of, but I’ve not heard much about people using mod_ruby.

Yes.
But some web hosting servers like Dreamhost don’t support mongrel.:frowning:

I don’t host anything on Dreamhost, but a quick Google turned this up:

http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=96032

Maybe it’s of some help.

On Dec 23, 2007, at 11:41 PM, Sam K. wrote:

Hi,

I love rails much better than php.

I do, too.

(I’m not a php expert, though.)

I’m not either.

However, when I use rails with apache, it’s painful.

Very.

(I use Dreamhost as my web hosting server, by the way)

Sorry to hear that. I was involved in a project that tried to deploy
to DreamHost. I had nothing but problems. And it was very slow.
Even SSHing to the command line was like frozen syrup. I would advise
searching for a host that is dedicated to Rails deployments, not one
that just tacks it on.

I know that I can’t compare rails with php because rails is a
framework
and php is a language.
Let’s just think that rails is a ruby with some libraries.
Then it’s comparison between php and ruby, right?

Right, you’d want to compare PHP to Ruby. It’s a matter of
preference. I like Ruby. I remember when I was making a decision
between Python and Ruby, I read an article that offered a very sound
piece of advice. It went something like this: both Python and Ruby
are great and you can accomplish whatever you need to in them, but
they feel different. Try both out and go with the one that “feels
better” to you. I did that, and I like the feel of Ruby. I also
like the feel of Rails.

Why is rails so difficult to deploy while php is easy?
Can we make rails as easy as php for apache, or is it fundamentally
impossible?

I don’t know any of the details, but Ruby 1.9 is just around the
corner. I read somewhere that performance is at least 2.5 times
better. I’ve also read somewhere about a different Ruby VM that will
hopefully make it faster. While none of this is reality today, it
does bring some hope. Until then, you do have options. I use
LiteSpeed. Even though it’s not open source, the standard version
(32 bit, one CPU) is free. It’s pretty snappy. They wrote their own
Ruby API and it’s supposed to be the fastest way to run Rails apps.
They also support PHP, and claim it can be 5 times faster than
mod_php. I have not done any benchmarks, so I can’t say if their
claims are true. This is what I do know from my own personal
experience: It’s easy and it seems to perform well. I like it.
www.litespeedtech.com. [I’m not affiliated with them in any way!]

Before I switched to LiteSpeed, I used Mongrel behind Apache. And
while this works fine, there are some aspects of it that I don’t
like. You have to run a Mongrel process listening on a dedicated
port. So if you have a cluster of three Mongrels, they are listening
on three ports. When you have a lot of apps on your server, you have
to remember which ports are taken. It can become a headache
quickly. With LiteSpeed, you can have multiple listeners if you
want, or you can have just one (in which case it works basically like
Apache and a mod). Also, each of those three Mongrel processes are
running a Ruby process and taking up RAM, the amount depends on the
size of your application. I’ve read that a decent sized application
can occupy 40M, but again, I don’t know if that’s true. I’ve not yet
bothered to check as I’m still in development and my server is a
sandbox. And to be fair, I don’t know exactly how LiteSpeed manages
memory. The configuration for LiteSpeed is also a lot easier than
Apache/Mongrel as well. I don’t have to futz with configuration
files. LiteSpeed comes with a template preconfigured for Rails apps,
so adding a new app is as easy as a couple of clicks and filling in
three values.

Your mileage may vary. I used to think that I liked flexibility. I
have come to realize that I actually prefer ease and productivity.
That’s why I use a Mac, and that’s why I like Rails.

This is not a rant but pure curiosity.

Haven’t you ever heard the saying that “curiosity killed the cat”? :wink:

Thanks.

Sam

Peace,
Phillip

On Dec 24, 2007, at 5:37 AM, Phillip K. wrote:

I would advise
searching for a host that is dedicated to Rails deployments, not one
that just tacks it on.

+1

I don’t know any of the details, but Ruby 1.9 is just around the
corner. I read somewhere that performance is at least 2.5 times
better.

Count on 1.8.6 for near-term production work. 1.9 is still an unknown.
The VMs (Rubinius, YARV, and JRuby) may or may not fill your need. I
know of at least one company who are using JRuby for production, but
it’s still bleeding edge.

The speed issue is pretty much moot in all but the most successful
cases. OP, raise your hand if you think you are getting close to the
limits of what PHP can serve. If your hand is still down, you will
probably not need a faster Rails solution than what’s currently
available.

When you have a lot of apps on your server, you have
to remember which ports are taken.

If performance is becoming an issue, you won’t be running a lot of
apps on the same server. Besides, whatever you are using as a front-
end load-balancer, whether Apache, Pound, Pen, ngnix, or something
else, will have a config file with all the ports listed.

Also, each of those three Mongrel processes are
running a Ruby process and taking up RAM, the amount depends on the
size of your application. I’ve read that a decent sized application
can occupy 40M

Memory can be an issue. 40M is not unusual and that’s excluding the
amount of RAM required for the database server.

My recommendation: Deploy the app, see if it’s serving enough pages,
then try to optimize.

Steve R. wrote:

On Dec 24, 2007, at 5:37 AM, Phillip K. wrote:

I would advise
searching for a host that is dedicated to Rails deployments, not one
that just tacks it on.

+1

I don’t know any of the details, but Ruby 1.9 is just around the
corner. I read somewhere that performance is at least 2.5 times
better.

Count on 1.8.6 for near-term production work. 1.9 is still an unknown.
The VMs (Rubinius, YARV, and JRuby) may or may not fill your need. I
know of at least one company who are using JRuby for production, but
it’s still bleeding edge.

The speed issue is pretty much moot in all but the most successful
cases. OP, raise your hand if you think you are getting close to the
limits of what PHP can serve. If your hand is still down, you will
probably not need a faster Rails solution than what’s currently
available.

I’m the OP.
Read my posting.
I never mentioned anything about performance.:slight_smile:
I was just saying that deployment is painful compared to PHP especially
on Dreamhost which doesn’t support mongrel.

Sam

When you have a lot of apps on your server, you have
to remember which ports are taken.

If performance is becoming an issue, you won’t be running a lot of
apps on the same server. Besides, whatever you are using as a front-
end load-balancer, whether Apache, Pound, Pen, ngnix, or something
else, will have a config file with all the ports listed.

Also, each of those three Mongrel processes are
running a Ruby process and taking up RAM, the amount depends on the
size of your application. I’ve read that a decent sized application
can occupy 40M

Memory can be an issue. 40M is not unusual and that’s excluding the
amount of RAM required for the database server.

My recommendation: Deploy the app, see if it’s serving enough pages,
then try to optimize.

On Dec 24, 2007, at 4:24 PM, s.ross wrote:

When you have a lot of apps on your server, you have
to remember which ports are taken.

If performance is becoming an issue, you won’t be running a lot of
apps on the same server. Besides, whatever you are using as a front-
end load-balancer, whether Apache, Pound, Pen, ngnix, or something
else, will have a config file with all the ports listed.

My point was more toward ease, not performance. I have a server that
is not even close to performance limits, but I’m running a number of
different things on it. Sure, I can open up the apache config files
to see what’s on a port, but it’s a hassle. For me, it’s just so
much nicer to not have to even bother with that. Rails makes
development easier. LiteSpeed makes deployment easier.

Peace,
Phillip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs