I found usefull info to tune your Rails app.
Problem
You want to use page-cache mechanism as much as possible. That can accelerate your rails app. But most of the pages aren’t cached, are they?
He says Ruby on Rails is slow because of views and routings processes are slow. So we want to use page-cache mechanism as much as possible. But many ‘non-personalized’ pages have actually personalized parts something like that: “Hello xxx(nickname) [Sign Out, Your Profile].” Any page containing such dynamic messages are not cached. Even if it’s just a one line message (hello foobar).
Solution
He proposes this combination
- Apache SSI (server side inclusion)
- PHP
- memcached
to prevent such slow processes. Apply page-cache to all ‘non-personalized’ pages. Use PHP and SSI to insert ‘hello foobar’ string by sharing session data with rails app.
As you know, PHP is faster than rails. Of course, it’s easier to write app code by rails than PHP. So you write your app code on rails, page-cache it, and insert(SSI) some simple dynamic strings (showing nickname or something) by PHP.
Note
Please check his blog entry for detail. There’s the code you can use.
If you have some difficulty reading his(Japanese) blog, please contact me.
You need to use it with care. Rails session data format is Marshal.dump by default. But he modifies it to JSON format to interchange with PHP. That causes a restriction. You can only store these data types as session data: number, string, hash, array, nonetheless, he says it’s not matter because he stores only ‘plain’ types of data into sessions.
——–
His next entry show another way (続・Railsの画面生成を10倍高速化する方法: フィルタ編).
It’s interesting, but in my humble opinion, dangerous way.