Topic: Super Slow App

I'm running an app for basic user registration at the moment, but it is extremely slow to load.  I'm fairly certain that I'm using the fast cgi dispatch file, but want to make sure I'm not doing something dumb that will slow it down, below is the contents of my .htaccess file, am I don't it right?

# General Apache options
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)/!$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
ErrorDocument 500 "Application error Application failed to start properly"


Re: Super Slow App

I don't know much about the htaccess file but I do know there are a lot of other factors that contribute to performance. SQL queries can be a huge one depending how many records you have and how you go about querying things. For instance, in a scaffold default it will generate

def index
   @something = Something.all

If you have thousands of records you just spent the time and memory resources to grab everyone, very bad.

Indexing your tables and queries can be a big performance boost too.

Also, a very overlooked issue, but front end performance. As the majority of my experience is on the front end I see people loading in 5-10 external JS files and a few stylesheets all in the head of the browser. It could easily take one hole second (depending on server resources and traffic) to load all of that before the user even sees the page start rendering. Keep JS external and load the scripts right before you close the body tag for much faster page loading. Concatenate scripts and put them in the same files, saves a  lot of memory. Same with stylesheets. Compress images (photoshop save for web and device) and use sprites where appropriate.

I'm sorry if I didn't help you at all but there are a lot of people who have no idea that these things cause a performance decrease. Maintaining a lightweight front end properly can certainly shave some time off load times.

Also the web server. I like phusion passenger and if you use REE with it you can save up to 33% memory.

Last edited by RailsRhino (2011-03-06 17:22:56)

- Ben