I don’t do any heavy image-processing, I don’t have any
killer-algorithms with a time complexity on O(n^n), and I don’t use any
major hacks.
The only “stupid” thing i really do is an “ORDER BY RAND()” on a table
with 8000 rows, which is quite heavy, but it shouldn’t take that long,
and i do the same in PHP which works fine.
I then signed up for a new (free) webhost and installed my application
there to see if my host was the problem. It performs a bit better on the
free one, but is still really slow http://94383.hostmyapplications.com/
On Sun, 2006-08-06 at 23:53 +0200, Anders wrote:
…
The only “stupid” thing i really do is an “ORDER BY RAND()” on a table
with 8000 rows, which is quite heavy, but it shouldn’t take that long,
and i do the same in PHP which works fine.
Is your database schema the same as in PHP version? I believe ORDER BY
RAND() looks at all your data in each row; the bigger the amount of data
the more to look at. So if you added more columns, like descriptions,
etc., it would be slower. I guess paging with LIMIT is not an option as
you may get repeats, right?
On Sun, 2006-08-06 at 23:53 +0200, Anders wrote:
…
The only “stupid” thing i really do is an “ORDER BY RAND()” on a table
with 8000 rows, which is quite heavy, but it shouldn’t take that long,
and i do the same in PHP which works fine.
Is your database schema the same as in PHP version? I believe ORDER BY
RAND() looks at all your data in each row; the bigger the amount of data
the more to look at. So if you added more columns, like descriptions,
etc., it would be slower. I guess paging with LIMIT is not an option as
you may get repeats, right?
Ed
Almost - but not quite the same schema. However - the rails-version is
smaller since i made a proper database design here. Also - I only do
ORDER BY RAND() on the front page. When you go into a category it dosn’t
sort by random anymore (but by the numbers of views).
And no - I’m not in production mode. Do that really help that much? I
tried tweeking “development.rb” with caching and such - but that didn’t
really help.
running under webrick or via plain CGI instead of fastcgi, and/or
with lighttpd, with mongrel, etc.
It’s not runing under webrick, and since i forund mod_fastcgi under
loaded modules in a phpinfo()-file I assume (can I do that) that fastcgi
also is available for rails
running in development mode instead of production mode
Okey - that might be the problem. How do I ten go into production mode?
I don’t have SSH-access, and uncommenting “ENV[‘RAILS_ENV’] ||=
‘production’” just kills my application with an error500
may be you should tell something about the content you are linking to.
Someone might be offended!
Cheers,
Jan
argghh - I’m really sorry. Actually the script should only show worksafe
images on the front page (like notdotnet.net), but since i havn’t
“marked” the images yet, that feature dosn’t work.
It’s not runing under webrick, and since i forund mod_fastcgi under
loaded modules in a phpinfo()-file I assume (can I do that) that fastcgi
also is available for rails
You need to make sure that public/.htaccess makes connection to
dispatch.fcgi instead of dispatch.cgi.
running in development mode instead of production mode
Okey - that might be the problem. How do I ten go into production mode?
I don’t have SSH-access, and uncommenting “ENV[‘RAILS_ENV’] ||=
‘production’” just kills my application with an error500
That sounds like a rights issue. Make sure that /log/* and /tmp* are
writeable. You can test this by simply making all these chmod 777
running under webrick or via plain CGI instead of fastcgi, and/or
with lighttpd, with mongrel, etc.
It’s not runing under webrick, and since i forund mod_fastcgi under
loaded modules in a phpinfo()-file I assume (can I do that) that
fastcgi
also is available for rails
No that definitely does not mean that your rails app will just work
with fcgi. It means more then likely you are running in cgi mode
which is really slow because it has to load the entire framework into
memory from disk on each requests. Also there is a huge difference
between development and production mode.
So you need to switch to production mode and verify your server
config to make sure you are using fcgi instead of cgi.
Instead of saying “slow,” it would be helpful if you benchmarked the
site, running in production mode on a server, not desktop machine. Most
people use ab or httperf to find out how many requests/sec their site
can serve.
An average rails site in production mode with no caching enabled may
serve as few as 20 r/s or as many as 120 r/s. If you begin to enable any
of the caching features, your pages served increase dramatically.
If you just did this rewrite, isn’t it a bit early to be worrying about
performance? It sounds like you should research your deployment options.
Many have been using lighttpd/fastcgi to serve dynamic content, but more
and more, people are using Mongrel clusters.
Note: Just because your phpinfo() says that mod_fcgi is installed does not mean you’ve set up rails to work with it.
No that definitely does not mean that your rails app will just work
with fcgi.
Right
It means more then likely you are running in cgi mode
which is really slow because it has to load the entire framework into
memory from disk on each requests. Also there is a huge difference
between development and production mode.
Yes - I learned that now. Right now I’m running in production mode, and
the speed is much better.
However - I’m almostsure that I’m not running in fcgi mode. What I’m
trying to figure out now is:
Can i setmy application up in fcgi mode (without talking to the
support and get them to change something on the server).
If I can - how do i do it?
As I said i changed “RewriteRule ^(.)$ dispatch.cgi [QSA,L]" to
"RewriteRule ^(.)$ dispatch.fcgi [QSA,L]” in my .htaccess-file. But
that just resulted in that the server didn’t response, no errors - no
logs.
As I said i changed “RewriteRule ^(.)$ dispatch.cgi [QSA,L]" to
"RewriteRule ^(.)$ dispatch.fcgi [QSA,L]” in my .htaccess-file. But
that just resulted in that the server didn’t response, no errors - no
logs.
thanks in advance
It sounds like you need the appropriate apache config bits.
If you just did this rewrite, isn’t it a bit early to be worrying about
performance? It sounds like you should research your deployment options.
Many have been using lighttpd/fastcgi to serve dynamic content, but more
and more, people are using Mongrel clusters.
Running Mongrel with Apache?
I’m frighteningly new to Rails (with about 6 months of Ruby) and have
some really simple questions about Rails based on some past experiences
I’ve had with other (perl) frameworks.
First, how do you manage static pages? In another world I would just
use Template under perl and build static HTML. Under perls HTML::Mason
I would set the cache and have no refresh (or weekly).
Is this essentially the approach you have under Rails – cache for days?
You can use mod_proxy to forward given ports to your mongrels. You can
use
mongrel_cluster to start multiple mongrels at a time. Mongrel can serve
static content, although I’m not sure what the efficiency of that is.
Maybe
Zed can weigh in on a good configuration.
Tom A. wrote:
Is this essentially the approach you have under Rails – cache for days?
You can cache pages if you like. You can’t controller actions on that
page
tho.
IMHO the caching options are quite flexible. At least, they’re flexible
enough for me at the moment.
Basically if rails finds a request with a document that exists under the
public folder (or subfolder) it will serve it (or maybe the webserver
does?). Otherwise it will look in routes and act accordingly. At least
this
is my understanding of it.
I wasn’t planning on starting a cluster of application servers.
I was just wondering what might be effective for splitting static and
dynamic pages apart.
But you mentioned mod_proxy as one way of getting speed which would be
quite effective. I supposed lighttpd does not do this?
I wasn’t planning on starting a cluster of application servers.
I was just wondering what might be effective for splitting static and
dynamic pages apart.
But you mentioned mod_proxy as one way of getting speed which would be
quite effective. I supposed lighttpd does not do this?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.