Topic: Basic tipps for improving performance?!


as I am currently developing rUBBy (rails based UBB with all the fancy stuff like InPlaceEdit, templates, individual-style customization etc...) I am curious about boosting it's performance.
As this is my bachelor thesis I am very sorry that I can't provide any source (fear of plagiarism, even tough I am the author ... *sigh*).

Currently I am done with setting up the basics (Relations, needed functions and so on)... Now it's time for refactoring my code while thinking about performance.

I am using MySQL, Rails 2.2 with no plug-ins so far (and I intend on keeping it that way, at least until my work gets graded smile) on an apache server.

Up to this point, I am a total noob if it comes to boosting performance. I am familiar with all the mathematical stuff for recursive time equations and always try to keep all my loops and other stuff within the O(n) (as a worst case) range.

Even tough... I am relying quite a lot on habtm relations, which isn't very "pro performance".
For example: If a user visits rUBBy, every thread he has already read is stored in a habtm (User habtm Threads). I figured, that this was the easiest way of doing the "already read" thing (I was not sure about storing this info in the DB or via Cookie and Timestamps...).
The DB approach won, as the Cookie-Version is kind of "sluggish" and relies to much (in my oppinion) on the User.

If you have any ideas or tipps for prepping performance, please let me know. This goes from simple "try to avoid nested if clauses" to "if you need an habtm relation, always keep in mind that .....". The only thing I definitly won't need is "apache alternatives". So you should, if possible, please concentrate on Ruby/Mysql/Code and not "third party" software like apache.

If you don't get what I am talking about, you could visit my showcase site for rUBBy [1] and if you have some spontaneous thoughts, feel free to tell me. smile

Would love to get a "big" discussion started with a few resources about basic rails performance, how to test performance and how to boost it!

cya Simon


Re: Basic tipps for improving performance?!

i suggest you look at for server side performance, and Yslow! and firebug for client side browser rendering performance.

new relic will tell you which controller methods are slow, Yslow will tell you how to optimize your pages, and the Net tab of firebug will show you graphically what the heck is taking so long.

Even these numbers you get, at the start, will become your benchmark, as i'm sure you are aware.

lastly, check out the scaling rails screencast series by rails envy & new relic.  some good stuff, which is inline with this post topic.

Good luck.

Re: Basic tipps for improving performance?!

Wow... newrelic is really helpful.
Up to now I used only firebug to measure the response times.

I am wondering right now, why I have never heard of newrelic before...

cya Simon