SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
How we built
Caibangzi.com
 Robin Lu (caibangzi.com)
Introduction
Personal Investment Management. Tool
+ Community
Founders: We are engineers!
Technology:
  Ruby On Rails
  MySQL,Linux,Lighttpd ...
Topics
Problems we are facing
Architecture evolution of caibangzi
Maintenance
Q&A
Peaks!


High Peak
Heavy Computation
Visiting Peak, Computation Peak and Cache
expiration Peak are in the same time. :...(
Evolution - Start
Launched at March, 2007
Hardware: 1 x 1U server
  1xAMD Opteron 250, 2G Memory,
  250G SATA, RAID 1
Bandwidth
  Shared
  less than 3Mbps
Evolution - Start
            Apache 2 + mod_proxy_balancer



                     mongrel x 8

                                            All in
memcached             caibangzi
                                            one
                                            box

                      rails 1.1.6



                      MySQL 5
First Challenge
May, 2007
Extremely time consuming actions
blocked the site.
Performance tuning
Optimize Rails cache
Second Challenge
August, 2007
We were running out of bandwidth
Solution:
  Money
  upgrade to 5Mbps
Server upgrading
High growth rate after August, 2007
Hardware upgrading in Sept. 2007
  still 1 x 1U
  2 x AMD 2214 2.2GHz
  4G RAM
Until Sept. 2007
            Apache 2 + mod_proxy_balancer



                    mongrel x 20

                                            Still in
memcached             caibangzi
                                             one
                                             box

                      rails 1.1.6



                      MySQL 5
Something happened
   in Oct. 2007
Stock Index reached 6000
Daily pv reached 1 million
Bigger challenge came
Several Changes We
       Made
Upgrade bandwidth to 10Mbps
Separate APP server and DB server
Load Balancer
Distributed Computation
2 Boxes
                Web Server



            event mongrel x 30


                                    AP
memcached        caibangzi           P

                   rails



                 MySQL 5
                                 Tianyuanji
                                     a
Load balancer

            Run with
           2 mongrels
             behind
            balancer
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
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
More on Web Server
disable keep-alive
serve static files with web server instead
of mongrel
tune configurations according to your
web server documentations
Distributed solution
BackgrounDRB
  based on Distributed Ruby (DRB)
    use ruby thread
    high overhead during context
    switching
    very slow when concurrent
    connections higher than 10
Distributed solution
FastBackground
  our own distributed computation
  solution
  based on Eventmachine
  simple, but fast and works for us
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
Open API
API Based on OAuth
  integrate caibangzi into your own sites
Other APPs support several F8 clones
  xiaonei.com, hainei.com, UCHome
Maintenance
Munin
  easy to use and extend
Monit
Crontab
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

   It’s the fact. Not the capacity.
 Our CPU usage never goes higher
               than 30%
Q&A

Mais conteúdo relacionado

Mais procurados

Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityOSSCube
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Corporation
 
Galera 3.0 Webinar Slides: Galera Monitoring & Management
Galera 3.0 Webinar Slides: Galera Monitoring & ManagementGalera 3.0 Webinar Slides: Galera Monitoring & Management
Galera 3.0 Webinar Slides: Galera Monitoring & ManagementSeveralnines
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStackTesora
 
Failover or not to failover
Failover or not to failoverFailover or not to failover
Failover or not to failoverHenrik Ingo
 
Scylla operator is finally generally available
Scylla operator is finally generally availableScylla operator is finally generally available
Scylla operator is finally generally availableScyllaDB
 
Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016Sakari Keskitalo
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave databaseWipro
 
MySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsMySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsSimon J Mudd
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Severalnines
 
SUSE Manager with Salt - Deploy and Config Management for MariaDB
SUSE Manager with Salt - Deploy and Config Management for MariaDBSUSE Manager with Salt - Deploy and Config Management for MariaDB
SUSE Manager with Salt - Deploy and Config Management for MariaDBMariaDB plc
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialColin Charles
 
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
High Availability with Galera Cluster - SkySQL Road Show 2013 in BerlinHigh Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
High Availability with Galera Cluster - SkySQL Road Show 2013 in BerlinMariaDB Corporation
 
InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)Mydbops
 
Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013MariaDB Corporation
 

Mais procurados (20)

Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly Available
 
Galera 3.0 Webinar Slides: Galera Monitoring & Management
Galera 3.0 Webinar Slides: Galera Monitoring & ManagementGalera 3.0 Webinar Slides: Galera Monitoring & Management
Galera 3.0 Webinar Slides: Galera Monitoring & Management
 
Galera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replicationGalera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replication
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStack
 
Failover or not to failover
Failover or not to failoverFailover or not to failover
Failover or not to failover
 
Scylla operator is finally generally available
Scylla operator is finally generally availableScylla operator is finally generally available
Scylla operator is finally generally available
 
Introducing Galera 3.0
Introducing Galera 3.0Introducing Galera 3.0
Introducing Galera 3.0
 
Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016
 
Galera Cluster 3.0 Features
Galera Cluster 3.0 FeaturesGalera Cluster 3.0 Features
Galera Cluster 3.0 Features
 
Running Galera Cluster on Microsoft Azure
Running Galera Cluster on Microsoft AzureRunning Galera Cluster on Microsoft Azure
Running Galera Cluster on Microsoft Azure
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave database
 
MySQL 5.7 - the first few months
MySQL 5.7 - the first few monthsMySQL 5.7 - the first few months
MySQL 5.7 - the first few months
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
 
SUSE Manager with Salt - Deploy and Config Management for MariaDB
SUSE Manager with Salt - Deploy and Config Management for MariaDBSUSE Manager with Salt - Deploy and Config Management for MariaDB
SUSE Manager with Salt - Deploy and Config Management for MariaDB
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability Tutorial
 
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
High Availability with Galera Cluster - SkySQL Road Show 2013 in BerlinHigh Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
 
InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)InnoDB Cluster Experience (MySQL User Camp)
InnoDB Cluster Experience (MySQL User Camp)
 
Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013Galera cluster - SkySQL Paris Meetup 17.12.2013
Galera cluster - SkySQL Paris Meetup 17.12.2013
 

Destaque

Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESB
Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESBGrey tower and NetIQ - Identity Manager Integration with MuleSoft ESB
Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESBWilliam Brant
 
Greytower identity Overview
Greytower identity  OverviewGreytower identity  Overview
Greytower identity OverviewWilliam Brant
 
Хостеры и регистраторы - операторы персональных данных
Хостеры и регистраторы - операторы персональных данныхХостеры и регистраторы - операторы персональных данных
Хостеры и регистраторы - операторы персональных данныхwebdrv
 
Blocks & Grand Central Dispatch
Blocks & Grand Central DispatchBlocks & Grand Central Dispatch
Blocks & Grand Central DispatchRobin Lu
 
Technologypowerpoint
TechnologypowerpointTechnologypowerpoint
Technologypowerpointguest242124f
 
Project Slide Show
Project Slide ShowProject Slide Show
Project Slide Showonite
 
Professional Work
Professional WorkProfessional Work
Professional Workonite
 
Домен .tel - новый способ коммуникации
Домен .tel - новый способ коммуникацииДомен .tel - новый способ коммуникации
Домен .tel - новый способ коммуникацииwebdrv
 
Ruby On Rails Pitfalls
Ruby On Rails PitfallsRuby On Rails Pitfalls
Ruby On Rails PitfallsRobin Lu
 
High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS developmentRobin Lu
 
Cocoa Design Patterns
Cocoa Design PatternsCocoa Design Patterns
Cocoa Design PatternsRobin Lu
 
Orient Advertising, Profile
Orient Advertising, ProfileOrient Advertising, Profile
Orient Advertising, ProfileHenna Shaykh
 
Khi internation food fest 2012 - for media partner
Khi internation food fest   2012 - for media partnerKhi internation food fest   2012 - for media partner
Khi internation food fest 2012 - for media partnerHenna Shaykh
 
Orient Advertising - Profile
Orient Advertising - ProfileOrient Advertising - Profile
Orient Advertising - ProfileHenna Shaykh
 
Symfony2 per utenti Symfony 1.x: Architettura, modelli ed esempi
Symfony2  per utenti Symfony 1.x: Architettura, modelli ed esempiSymfony2  per utenti Symfony 1.x: Architettura, modelli ed esempi
Symfony2 per utenti Symfony 1.x: Architettura, modelli ed esempiFilippo De Santis
 
Grey tower technical capablities
Grey tower  technical capablitiesGrey tower  technical capablities
Grey tower technical capablitiesWilliam Brant
 
Suggestions and Ideas for DigitalOcean
Suggestions and Ideas for DigitalOceanSuggestions and Ideas for DigitalOcean
Suggestions and Ideas for DigitalOceanKaan Caliskan
 
Arquitectura I Escultura Grega
Arquitectura I Escultura GregaArquitectura I Escultura Grega
Arquitectura I Escultura Gregaguestd4825b
 
Digitaalinen turvallisuus muuttuvassa ympäristössä
Digitaalinen turvallisuus muuttuvassa ympäristössäDigitaalinen turvallisuus muuttuvassa ympäristössä
Digitaalinen turvallisuus muuttuvassa ympäristössäjapijapi
 

Destaque (20)

Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESB
Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESBGrey tower and NetIQ - Identity Manager Integration with MuleSoft ESB
Grey tower and NetIQ - Identity Manager Integration with MuleSoft ESB
 
Greytower identity Overview
Greytower identity  OverviewGreytower identity  Overview
Greytower identity Overview
 
Хостеры и регистраторы - операторы персональных данных
Хостеры и регистраторы - операторы персональных данныхХостеры и регистраторы - операторы персональных данных
Хостеры и регистраторы - операторы персональных данных
 
Blocks & Grand Central Dispatch
Blocks & Grand Central DispatchBlocks & Grand Central Dispatch
Blocks & Grand Central Dispatch
 
Technologypowerpoint
TechnologypowerpointTechnologypowerpoint
Technologypowerpoint
 
Project Slide Show
Project Slide ShowProject Slide Show
Project Slide Show
 
Professional Work
Professional WorkProfessional Work
Professional Work
 
Домен .tel - новый способ коммуникации
Домен .tel - новый способ коммуникацииДомен .tel - новый способ коммуникации
Домен .tel - новый способ коммуникации
 
Ruby On Rails Pitfalls
Ruby On Rails PitfallsRuby On Rails Pitfalls
Ruby On Rails Pitfalls
 
High quality iOS development
High quality iOS developmentHigh quality iOS development
High quality iOS development
 
Cocoa Design Patterns
Cocoa Design PatternsCocoa Design Patterns
Cocoa Design Patterns
 
Orient Advertising, Profile
Orient Advertising, ProfileOrient Advertising, Profile
Orient Advertising, Profile
 
Khi internation food fest 2012 - for media partner
Khi internation food fest   2012 - for media partnerKhi internation food fest   2012 - for media partner
Khi internation food fest 2012 - for media partner
 
Orient Advertising - Profile
Orient Advertising - ProfileOrient Advertising - Profile
Orient Advertising - Profile
 
Gastcollege CHE
Gastcollege CHEGastcollege CHE
Gastcollege CHE
 
Symfony2 per utenti Symfony 1.x: Architettura, modelli ed esempi
Symfony2  per utenti Symfony 1.x: Architettura, modelli ed esempiSymfony2  per utenti Symfony 1.x: Architettura, modelli ed esempi
Symfony2 per utenti Symfony 1.x: Architettura, modelli ed esempi
 
Grey tower technical capablities
Grey tower  technical capablitiesGrey tower  technical capablities
Grey tower technical capablities
 
Suggestions and Ideas for DigitalOcean
Suggestions and Ideas for DigitalOceanSuggestions and Ideas for DigitalOcean
Suggestions and Ideas for DigitalOcean
 
Arquitectura I Escultura Grega
Arquitectura I Escultura GregaArquitectura I Escultura Grega
Arquitectura I Escultura Grega
 
Digitaalinen turvallisuus muuttuvassa ympäristössä
Digitaalinen turvallisuus muuttuvassa ympäristössäDigitaalinen turvallisuus muuttuvassa ympäristössä
Digitaalinen turvallisuus muuttuvassa ympäristössä
 

Semelhante a How we build caibangzi.com

A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesInsight Technology, Inc.
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Serverswebhostingguy
 
Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web ServiceLeon Ho
 
High Performance Drupal Sites
High Performance Drupal SitesHigh Performance Drupal Sites
High Performance Drupal SitesAbayomi Ayoola
 
Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)Ontico
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackMatt Lord
 
Blue host openstacksummit_2013
Blue host openstacksummit_2013Blue host openstacksummit_2013
Blue host openstacksummit_2013Jun Park
 
Blue host using openstack in a traditional hosting environment
Blue host using openstack in a traditional hosting environmentBlue host using openstack in a traditional hosting environment
Blue host using openstack in a traditional hosting environmentOpenStack Foundation
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStackKamesh Pemmaraju
 
Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3epee
 
My Sql Performance In A Cloud
My Sql Performance In A CloudMy Sql Performance In A Cloud
My Sql Performance In A CloudSky Jian
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutSander Temme
 
My Sql Performance On Ec2
My Sql Performance On Ec2My Sql Performance On Ec2
My Sql Performance On Ec2MySQLConference
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring RailsJonathan Weiss
 
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...varien
 
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...MagentoImagine
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...javier ramirez
 
Open stack ha design & deployment kilo
Open stack ha design & deployment   kiloOpen stack ha design & deployment   kilo
Open stack ha design & deployment kiloSteven Li
 

Semelhante a How we build caibangzi.com (20)

A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Servers
 
Scaling a Web Service
Scaling a Web ServiceScaling a Web Service
Scaling a Web Service
 
High Performance Drupal Sites
High Performance Drupal SitesHigh Performance Drupal Sites
High Performance Drupal Sites
 
Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStack
 
Blue host openstacksummit_2013
Blue host openstacksummit_2013Blue host openstacksummit_2013
Blue host openstacksummit_2013
 
Blue host using openstack in a traditional hosting environment
Blue host using openstack in a traditional hosting environmentBlue host using openstack in a traditional hosting environment
Blue host using openstack in a traditional hosting environment
 
High Availability for OpenStack
High Availability for OpenStackHigh Availability for OpenStack
High Availability for OpenStack
 
Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3Mysql 2007 Tech At Digg V3
Mysql 2007 Tech At Digg V3
 
My Sql Performance In A Cloud
My Sql Performance In A CloudMy Sql Performance In A Cloud
My Sql Performance In A Cloud
 
Deployment de Rails
Deployment de RailsDeployment de Rails
Deployment de Rails
 
MySQL 5.7 what's new
MySQL 5.7 what's newMySQL 5.7 what's new
MySQL 5.7 what's new
 
Apache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling OutApache Performance Tuning: Scaling Out
Apache Performance Tuning: Scaling Out
 
My Sql Performance On Ec2
My Sql Performance On Ec2My Sql Performance On Ec2
My Sql Performance On Ec2
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
 
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
Magento Imagine eCommerce Conference February 2011: Optimizing Magento For Pe...
 
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
Magento's Imagine eCommerce Conference 2011 - Hosting Magento: Performance an...
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
 
Open stack ha design & deployment kilo
Open stack ha design & deployment   kiloOpen stack ha design & deployment   kilo
Open stack ha design & deployment kilo
 

How we build caibangzi.com

  • 1. How we built Caibangzi.com Robin Lu (caibangzi.com)
  • 2. Introduction Personal Investment Management. Tool + Community Founders: We are engineers! Technology: Ruby On Rails MySQL,Linux,Lighttpd ...
  • 3. Topics Problems we are facing Architecture evolution of caibangzi Maintenance Q&A
  • 4. Peaks! High Peak Heavy Computation Visiting Peak, Computation Peak and Cache expiration Peak are in the same time. :...(
  • 5. Evolution - Start Launched at March, 2007 Hardware: 1 x 1U server 1xAMD Opteron 250, 2G Memory, 250G SATA, RAID 1 Bandwidth Shared less than 3Mbps
  • 6. Evolution - Start Apache 2 + mod_proxy_balancer mongrel x 8 All in memcached caibangzi one box rails 1.1.6 MySQL 5
  • 7. First Challenge May, 2007 Extremely time consuming actions blocked the site. Performance tuning Optimize Rails cache
  • 8. Second Challenge August, 2007 We were running out of bandwidth Solution: Money upgrade to 5Mbps
  • 9. Server upgrading High growth rate after August, 2007 Hardware upgrading in Sept. 2007 still 1 x 1U 2 x AMD 2214 2.2GHz 4G RAM
  • 10. Until Sept. 2007 Apache 2 + mod_proxy_balancer mongrel x 20 Still in memcached caibangzi one box rails 1.1.6 MySQL 5
  • 11. Something happened in Oct. 2007 Stock Index reached 6000 Daily pv reached 1 million Bigger challenge came
  • 12. Several Changes We Made Upgrade bandwidth to 10Mbps Separate APP server and DB server Load Balancer Distributed Computation
  • 13. 2 Boxes Web Server event mongrel x 30 AP memcached caibangzi P rails MySQL 5 Tianyuanji a
  • 14. Load balancer Run with 2 mongrels behind balancer
  • 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
  • 19. Distributed solution FastBackground our own distributed computation solution based on Eventmachine simple, but fast and works for us
  • 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
  • 22. Maintenance Munin easy to use and extend Monit Crontab
  • 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 It’s the fact. Not the capacity. Our CPU usage never goes higher than 30%
  • 24. Q&A