The document summarizes how caibangzi.com, a personal investment management tool and community, was built and evolved over time to handle increasing traffic demands. It started on a single server in 2007 but faced challenges with performance and bandwidth as daily pageviews reached 1 million. Key steps taken included upgrading hardware, separating application and database servers, adding a load balancer, implementing distributed computation solutions, and upgrading to Rails 2.0. Even at peak loads of 1 million daily pageviews and 160 requests per second, CPU usage never exceeded 30% due to these architectural improvements.
15. Load balancer
Slow actions block the others
with balancer:
by request Apach
e
by traffic HAproxy
round-robin
Nginx
Lighttpd
1.4
Note: Nginx fixed it with
fair balancer later
16. Caibangzi Choice of
Balancer
Lighttpd 1.5 beta
proxy-core.balancer = "sqf"
http://redmine.lighttpd.
net/issues/show/1362
For Rails application, choice of balancer
is sometimes more important than
choice of web server
17. More on Web Server
disable keep-alive
serve static files with web server instead
of mongrel
tune configurations according to your
web server documentations
18. Distributed solution
BackgrounDRB
based on Distributed Ruby (DRB)
use ruby thread
high overhead during context
switching
very slow when concurrent
connections higher than 10
20. Rails upgrading
Early of 2008, we upgraded to Rails 2.0
expired several plugins
refactory to be more RESTful
cookie session
multi view => wap.caibangzi.com
21. Open API
API Based on OAuth
integrate caibangzi into your own sites
Other APPs support several F8 clones
xiaonei.com, hainei.com, UCHome
23. With all that....
we handled:
pv/day 1M
rails req/day 1.8M
peak rails req/sec 160
total req/day 5M
peak req/sec 430
Its the fact. Not the capacity.
Our CPU usage never goes higher
than 30%