SlideShare a Scribd company logo
Breakthrough Scalability
  for Ruby on Rails with MySQL


      How the Clustrix Database scales Ruby on Rails


      Neil Harkins                            Clayton Cole

Performance Test Engineer             Software Deployment Engineer

        Clustrix                                Clustrix
What is Clustrix?


Clustrix is NewSQL:                   PLUS…
• Scalablility and Fault-Tolerance…    Distributed query processing
  without sacrificing ACID             Online schema changes
  compliance.
                                       Multi-master replication slave
• Drop-in scalable replacement for     Multi-binlog replication master
  MySQL (dump, restore, change the
  ip address!)                         Fast Parallel Backup/Restore

    “Radical Scalability, Radical     And now…
             Simplicity”               DBaaS via partnerships with
                                        multiple Cloud/Hosting Providers


                                                                           2
The Clustrix Database: Previous Benchmarks


October, 2011:
Percona-Clustrix TPC-C Evaluation


Compared:
• Clustrix 3/6/9 nodes
• MySQL w/ Intel SSD
• MySQL w/ FusionIO
Demonstrated how Clustrix provides
linear scale:

more nodes = more performance
Ruby on Rails: A popular web application framework


• Open-source “full-stack” web app framework
   for the Ruby programming language.
• Uses Model-View-Controller (MVC) paradigm,
   abstracts data store behind ORM (“ActiveRecord”)
   lets you focus on your webapp’s features, not infrastructure.
• Philosophy:
         •   Convention over Configuration
         •   Don’t Repeat Yourself
         •   Quick Turnaround / Short Development Cycle
• Promises prototype -> full-featured website in record time
   …and delivers.
• As of Feb 2012, Gartner estimates >235k websites use Rails!
What’s the catch? Does Rails scale?


“By various metrics Twitter is the biggest Rails site on the net right now.

… The common wisdom in the Rails community at this time
is that scaling Rails is a matter of cost: just throw more CPUs at it.
The problem is that more instances of Rails means more requests to your database.

… Once you hit a certain threshold of traffic, either you need to strip out
all the costly neat stuff that Rails does for you (RJS, ActiveRecord, ActiveSupport, etc.)
or move the slow parts of your application out of Rails, or both.”

- Twitter Developer Alex Payne, 2007-03-29
                http://tumblr.yasulab.jp/post/10271634919/5-question-interview-with-twitter-developer-alex-payne




                             The Answer lies in whether your database can scale
                                                                                                                   5
Our Goal: Prove that Rails can Scale


To run a performance benchmark that…

• Allows us to observe the database workload from a real-world webapp
  “scenarios” written in Ruby on Rails,

• At a commercial Rails-hosting environment,
• Against both a standard MySQL server offered by that service, and the same
  Clustrix nodes used by our various DBaaS partners.

…does such a benchmark already exist?

Our search resulted only in modules which could be used to measure timing, but
we did not find a comprehensive RoR simulation comparable to a TPC
benchmark.
Designing the Benchmark – keeping it real


Tacit Knowledge supplied some Ruby        • BlueBox was our Rails-hosting
coders to write the benchmark in “The         service offering physical MySQL
Rails Way”.                                   servers and virtual Rails servers
 Cut out the View and Controller,        •   We then engaged with Percona to
   concentrate solely on the Model            review that the MySQL server
 Avoids complexities and latencies           configuration is optimal.
   associated with HTTP load testing
 Still uses the Rails “core”, in
   particular ActiveRecord
 Tacit added a lot of “knobs” in order
   to test different ratios of scenario
   “ingredients”, etc.
Sample Scenarios used in the Benchmark


Tacit took the data model          • Create User, optionally with metadata
                                       located in other tables.
we created for an auction          •   Create Auction, optionally with url to a
application and created                picture.
                                   •   View Auction with its most recent
13 scenarios for how                   comments.
user might interact with           •   Add Tags and/or Comments to an
                                       Auction.
the site
                                   •   Bid on an Auction, Determine current
                                       highest bidder.
                                   •   Generate “tag cloud” for items
                                       recently commented upon.
                                   •   etc..                               8
Sample Schema for a Social-Media Auction website




                                                   This is the
                                                   relational database
                                                   model used to back
                                                   the site used for
                                                   this benchmark. All
                                                   relational, all ACID.
Sample Scenario: Ruby code snippet for creating a user

Ruby
lib/benchmark/scenarios.rb                            Sample SQL generated
# Create User with 2 Phones                           BEGIN;

 def scenario_3                                       INSERT INTO users (created_at, email, first, last,
                                                                  login, status, updated_at)
    user = User.new(login:                            VALUES ('2012-04-17 22:08:01', 'bill@walker.biz',
"#{Faker::Internet.user_name}_#{Random.rand(65536)}               'Dillan', 'Hamill',
_#{Faker::Internet.user_name.reverse}", email:                    'harrison_34356_ztem_sivart', 0,
Faker::Internet.email, first:
Faker::Name.first_name, last:                                     '2012-04-17 22:08:01');
Faker::Name.last_name, status: Random.rand(0..5))
                                                      INSERT INTO user_phones (number, phone_type, user_id)
    user.user_phones << UserPhone.new(phone_type:     VALUES ('530-209-0599', 1, 4426);
Random.rand(0..1), number:
                                                      INSERT INTO user_phones (number, phone_type, user_id)
Faker::PhoneNumber.phone_number)
                                                      VALUES ('1-978-714-2317', 1, 4426);
    user.user_phones << UserPhone.new(phone_type:
                                                      COMMIT;
Random.rand(0..1), number:
Faker::PhoneNumber.phone_number)

   user.save

 end

                                                                                                          10
Test Hardware Setup: Clustrix vs MySQL

          Clustrix                                  MySQL Instance
CLX 4110 nodes that we                         •   8 cores (Quantity 2 of
formed into 3-node and 6-                          Intel Xeon 5450
node clusters, each with                           (3GHz, 12MB
     • 8 Cores                                     Cache))
     • 48GB RAM                                •   128GB RAM
     • 896GB SSD                               •   1.6TB of spinning
     • 600GB HDD                                   HDD space (12 x
     • Clustrix VIP                                300GB Seagate 15k
         (software load                            RPM SAS)
         balancer)                             •   Hardware RAID 10
                                               •   Running Scientific
                                                   Linux 6.2
                                               •   MySQL version
                                                   5.1.61
                                                     • Settings tuned
         H                                                by Percona
         o
         s
Test Sequence


                          Ruby on Rails Benchmark

                • Starts desired number of threads, connects
                   each to target DB system

                • Each thread begins running the prescribed
                   workload during a warm-up period

                • After warm-up, statistics collection is turned
                   on and test runs for a set time (10 minutes)

                • Results of test are saved locally as a JSON
                   file
Benchmark Results: MySQL only

                                             Summary:
                                             • This graph shows throughput (TPS)
                                               over a range of concurrencies
          5,000 – 6,000 TPS @ 256 Threads    • MySQL maxes out around a TPS of 5-
                                               6k at concurrency of 256
                                                 • This drops down to 3-4k as TPS
          3,000 – 4,000 TPS @ 1024 Threads
                                                    concurrency approaches 1024, a
                                                    1/3 decrease in performance

                                             Put in perspective:
                                             • 256 threads might represent a small
                                                and growing organization
                                             • 1024 threads might represent when
                                                that site starts getting more popular
Benchmark Results: 3-Node Clustrix v. MySQL



                                                •   Same graph as before, now adding
                                                    Clustrix database
                                                •   Same axis, with greater scale
                                                    because Clustrix outperforms MySQL
                                                •   At 256 threads (MySQL’s peak),
      8x TPS Performance @ 1024 Threads             Clustrix performs 2.5x faster
                                                •   At 1024 threads, a 3-node Clustrix
                              Clustrix 3-Node
                                                    database achieves peak performance
                                                    of 30,000 TPS
      2.5x TPS Performance @ 256 Threads
                                MySQL
                                                          But wait! There is more
Benchmark Results: Clustrix 6-Node, 3-Node, MySQL



                                Clustrix 6-Node      •   Again, same graph as before, now
                                                         adding a 6 node Clustrix database
                                                     •   Clustrix has 15x performance of
                                                         MySQL at 1024 threads
            15x TPS Performance @ 1024 Threads
                                                     •   Concurrency reaches 45,000 TPS as
                                                         concurrency reaches 10,000

                                                               How’s that for scale?

                                   Clustrix 3-Node

                                   MySQL
Average Scenario Execution Time: 6-Node, 3-Node, MySQL




                                                                                             7 – 8 seconds @ ~9,250 Threads


                             2 – 3 seconds @ 1024 Threads



                                                            MySQL




                                                                Clustrix 3-Node
                                        ~0.1 seconds @ 1024 Threads                     ~0.7 seconds @ ~9,250 Threads

~0.1 seconds @ 256 Threads                                            Clustrix 6-Node
Conclusion

• Ruby on Rails: Great rapid development framework for
    the web
•   MySQL & Rails: frequent development strategy
•   Scaling limits for Rails = Scaling limits for MySQL
•   The Clustrix database breaks through traditional Rails
    limitations by providing:
        Linear scalability
        Drop-in replacement for MySQL
        Superior performance
        High availability and inherent fault tolerance
Breakthrough Scalability
for Ruby on Rails with MySQL



   Thank you!

             info@clustrix.com

More Related Content

What's hot (20)

PPTX
Cassandra
exsuns
 
PDF
Run Cloud Native MySQL NDB Cluster in Kubernetes
Bernd Ocklin
 
PPTX
Message Queuing on a Large Scale: IMVUs stateful real-time message queue for ...
Jon Watte
 
PDF
Mysteries of the binary log
Mats Kindahl
 
PDF
Methods of NoSQL database systems benchmarking
Транслируем.бел
 
PDF
High-Performance Storage Services with HailDB and Java
sunnygleason
 
PDF
Cassandra Introduction & Features
Phil Peace
 
PDF
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Severalnines
 
PDF
keyvi the key value index @ Cliqz
Hendrik Muhs
 
PDF
MaxScale - The Pluggable Router
MariaDB Corporation
 
PDF
Scaling Hibernate with Terracotta
Alex Miller
 
PDF
Codemotion 2015 Infinispan Tech lab
Ugo Landini
 
PDF
Advanced Cassandra
DataStax Academy
 
PDF
MaxScale for Effective MySQL Meetup NYC - 14.01.21
Ivan Zoratti
 
PDF
Building better Node.js applications on MariaDB
MariaDB plc
 
PPT
Hazelcast
Jeevesh Pandey
 
PPT
NYJavaSIG - Big Data Microservices w/ Speedment
Speedment, Inc.
 
PPTX
MariaDB Galera Cluster
Abdul Manaf
 
PDF
Galera cluster for high availability
Mydbops
 
PPTX
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
Malin Weiss
 
Cassandra
exsuns
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Bernd Ocklin
 
Message Queuing on a Large Scale: IMVUs stateful real-time message queue for ...
Jon Watte
 
Mysteries of the binary log
Mats Kindahl
 
Methods of NoSQL database systems benchmarking
Транслируем.бел
 
High-Performance Storage Services with HailDB and Java
sunnygleason
 
Cassandra Introduction & Features
Phil Peace
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Severalnines
 
keyvi the key value index @ Cliqz
Hendrik Muhs
 
MaxScale - The Pluggable Router
MariaDB Corporation
 
Scaling Hibernate with Terracotta
Alex Miller
 
Codemotion 2015 Infinispan Tech lab
Ugo Landini
 
Advanced Cassandra
DataStax Academy
 
MaxScale for Effective MySQL Meetup NYC - 14.01.21
Ivan Zoratti
 
Building better Node.js applications on MariaDB
MariaDB plc
 
Hazelcast
Jeevesh Pandey
 
NYJavaSIG - Big Data Microservices w/ Speedment
Speedment, Inc.
 
MariaDB Galera Cluster
Abdul Manaf
 
Galera cluster for high availability
Mydbops
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
Malin Weiss
 

Viewers also liked (12)

PDF
Why Traditional Databases Fail so Miserably to Scale with E-Commerce Site Growth
Clustrix
 
PDF
E-Commerce Success is a Balancing Act. Ensure Success with ClustrixDB.
Clustrix
 
PPTX
Clustrix Database Overview
Clustrix
 
PDF
ClustrixDB 7.5 Announcement
Clustrix
 
PPTX
Moving an E-commerce Site to AWS. A Case Study
Clustrix
 
PDF
Achieve new levels of performance for Magento e-commerce sites.
Clustrix
 
PPTX
Scaling Techniques to Increase Magento Capacity
Clustrix
 
PDF
Db performance optimization with indexing
Rajeev Kumar
 
PDF
Clusterix at VDS 2016
Eamonn Maguire
 
PPTX
Database Architecture & Scaling Strategies, in the Cloud & on the Rack
Clustrix
 
PPTX
Presto: Distributed sql query engine
kiran palaka
 
PDF
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Hakka Labs
 
Why Traditional Databases Fail so Miserably to Scale with E-Commerce Site Growth
Clustrix
 
E-Commerce Success is a Balancing Act. Ensure Success with ClustrixDB.
Clustrix
 
Clustrix Database Overview
Clustrix
 
ClustrixDB 7.5 Announcement
Clustrix
 
Moving an E-commerce Site to AWS. A Case Study
Clustrix
 
Achieve new levels of performance for Magento e-commerce sites.
Clustrix
 
Scaling Techniques to Increase Magento Capacity
Clustrix
 
Db performance optimization with indexing
Rajeev Kumar
 
Clusterix at VDS 2016
Eamonn Maguire
 
Database Architecture & Scaling Strategies, in the Cloud & on the Rack
Clustrix
 
Presto: Distributed sql query engine
kiran palaka
 
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Hakka Labs
 
Ad

Similar to Clustrix Database Percona Ruby on Rails benchmark (20)

PDF
Modernización del manejo de datos con v fabric
Software Guru
 
PDF
Your backend architecture is what matters slideshare
Colin Charles
 
PDF
Scaling Social Games
Paolo Negri
 
PPTX
EEDC 2010. Scaling Web Applications
Expertos en TI
 
ODP
redis
hazzaz
 
PPS
Web20expo Scalable Web Arch
mclee
 
PPS
Web20expo Scalable Web Arch
guest18a0f1
 
PPS
Web20expo Scalable Web Arch
royans
 
PDF
My Sql And Search At Craigslist
MySQLConference
 
PDF
Yet Another Replication Tool: RubyRep
Denish Patel
 
PPS
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Cal Henderson
 
PDF
Scalarium and CouchDB
Jonathan Weiss
 
PDF
Advanced Deployment
Jonathan Weiss
 
KEY
How to Build a SaaS App With Twitter-like Throughput on Just 9 Servers
New Relic
 
PDF
Python Load Testing - Pygotham 2012
Dan Kuebrich
 
PPTX
Couchbase presentation
sharonyb
 
ZIP
mtl_rubykaigi
Hirotomo Oi
 
PPTX
Scalability
felho
 
PDF
Scaling data on public clouds
Liran Zelkha
 
PDF
Scaling the Rails
elliando dias
 
Modernización del manejo de datos con v fabric
Software Guru
 
Your backend architecture is what matters slideshare
Colin Charles
 
Scaling Social Games
Paolo Negri
 
EEDC 2010. Scaling Web Applications
Expertos en TI
 
redis
hazzaz
 
Web20expo Scalable Web Arch
mclee
 
Web20expo Scalable Web Arch
guest18a0f1
 
Web20expo Scalable Web Arch
royans
 
My Sql And Search At Craigslist
MySQLConference
 
Yet Another Replication Tool: RubyRep
Denish Patel
 
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Cal Henderson
 
Scalarium and CouchDB
Jonathan Weiss
 
Advanced Deployment
Jonathan Weiss
 
How to Build a SaaS App With Twitter-like Throughput on Just 9 Servers
New Relic
 
Python Load Testing - Pygotham 2012
Dan Kuebrich
 
Couchbase presentation
sharonyb
 
mtl_rubykaigi
Hirotomo Oi
 
Scalability
felho
 
Scaling data on public clouds
Liran Zelkha
 
Scaling the Rails
elliando dias
 
Ad

More from Clustrix (8)

PPTX
Tech Talk Series, Part 4: How do you achieve high availability in a MySQL env...
Clustrix
 
PPTX
Tech Talk Series, Part 3: Why is your CFO right to demand you scale down MySQL?
Clustrix
 
PPTX
Tech Talk Series, Part 2: Why is sharding not smart to do in MySQL?
Clustrix
 
PPTX
Demystifying Benchmarks: How to Use Them To Better Evaluate Databases
Clustrix
 
PPTX
Beyond Aurora. Scale-out SQL databases for AWS
Clustrix
 
PPTX
Benchmark Showdown: Which Relational Database is the Fastest on AWS?
Clustrix
 
PDF
Benchmark: Beyond Aurora. Scale-out SQL databases for AWS.
Clustrix
 
PPTX
Supersizing Magento
Clustrix
 
Tech Talk Series, Part 4: How do you achieve high availability in a MySQL env...
Clustrix
 
Tech Talk Series, Part 3: Why is your CFO right to demand you scale down MySQL?
Clustrix
 
Tech Talk Series, Part 2: Why is sharding not smart to do in MySQL?
Clustrix
 
Demystifying Benchmarks: How to Use Them To Better Evaluate Databases
Clustrix
 
Beyond Aurora. Scale-out SQL databases for AWS
Clustrix
 
Benchmark Showdown: Which Relational Database is the Fastest on AWS?
Clustrix
 
Benchmark: Beyond Aurora. Scale-out SQL databases for AWS.
Clustrix
 
Supersizing Magento
Clustrix
 

Recently uploaded (20)

PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 

Clustrix Database Percona Ruby on Rails benchmark

  • 1. Breakthrough Scalability for Ruby on Rails with MySQL How the Clustrix Database scales Ruby on Rails Neil Harkins Clayton Cole Performance Test Engineer Software Deployment Engineer Clustrix Clustrix
  • 2. What is Clustrix? Clustrix is NewSQL: PLUS… • Scalablility and Fault-Tolerance…  Distributed query processing without sacrificing ACID  Online schema changes compliance.  Multi-master replication slave • Drop-in scalable replacement for  Multi-binlog replication master MySQL (dump, restore, change the ip address!)  Fast Parallel Backup/Restore “Radical Scalability, Radical And now… Simplicity”  DBaaS via partnerships with multiple Cloud/Hosting Providers 2
  • 3. The Clustrix Database: Previous Benchmarks October, 2011: Percona-Clustrix TPC-C Evaluation Compared: • Clustrix 3/6/9 nodes • MySQL w/ Intel SSD • MySQL w/ FusionIO Demonstrated how Clustrix provides linear scale: more nodes = more performance
  • 4. Ruby on Rails: A popular web application framework • Open-source “full-stack” web app framework for the Ruby programming language. • Uses Model-View-Controller (MVC) paradigm, abstracts data store behind ORM (“ActiveRecord”) lets you focus on your webapp’s features, not infrastructure. • Philosophy: • Convention over Configuration • Don’t Repeat Yourself • Quick Turnaround / Short Development Cycle • Promises prototype -> full-featured website in record time …and delivers. • As of Feb 2012, Gartner estimates >235k websites use Rails!
  • 5. What’s the catch? Does Rails scale? “By various metrics Twitter is the biggest Rails site on the net right now. … The common wisdom in the Rails community at this time is that scaling Rails is a matter of cost: just throw more CPUs at it. The problem is that more instances of Rails means more requests to your database. … Once you hit a certain threshold of traffic, either you need to strip out all the costly neat stuff that Rails does for you (RJS, ActiveRecord, ActiveSupport, etc.) or move the slow parts of your application out of Rails, or both.” - Twitter Developer Alex Payne, 2007-03-29 http://tumblr.yasulab.jp/post/10271634919/5-question-interview-with-twitter-developer-alex-payne The Answer lies in whether your database can scale 5
  • 6. Our Goal: Prove that Rails can Scale To run a performance benchmark that… • Allows us to observe the database workload from a real-world webapp “scenarios” written in Ruby on Rails, • At a commercial Rails-hosting environment, • Against both a standard MySQL server offered by that service, and the same Clustrix nodes used by our various DBaaS partners. …does such a benchmark already exist? Our search resulted only in modules which could be used to measure timing, but we did not find a comprehensive RoR simulation comparable to a TPC benchmark.
  • 7. Designing the Benchmark – keeping it real Tacit Knowledge supplied some Ruby • BlueBox was our Rails-hosting coders to write the benchmark in “The service offering physical MySQL Rails Way”. servers and virtual Rails servers  Cut out the View and Controller, • We then engaged with Percona to concentrate solely on the Model review that the MySQL server  Avoids complexities and latencies configuration is optimal. associated with HTTP load testing  Still uses the Rails “core”, in particular ActiveRecord  Tacit added a lot of “knobs” in order to test different ratios of scenario “ingredients”, etc.
  • 8. Sample Scenarios used in the Benchmark Tacit took the data model • Create User, optionally with metadata located in other tables. we created for an auction • Create Auction, optionally with url to a application and created picture. • View Auction with its most recent 13 scenarios for how comments. user might interact with • Add Tags and/or Comments to an Auction. the site • Bid on an Auction, Determine current highest bidder. • Generate “tag cloud” for items recently commented upon. • etc.. 8
  • 9. Sample Schema for a Social-Media Auction website This is the relational database model used to back the site used for this benchmark. All relational, all ACID.
  • 10. Sample Scenario: Ruby code snippet for creating a user Ruby lib/benchmark/scenarios.rb Sample SQL generated # Create User with 2 Phones BEGIN; def scenario_3 INSERT INTO users (created_at, email, first, last, login, status, updated_at) user = User.new(login: VALUES ('2012-04-17 22:08:01', '[email protected]', "#{Faker::Internet.user_name}_#{Random.rand(65536)} 'Dillan', 'Hamill', _#{Faker::Internet.user_name.reverse}", email: 'harrison_34356_ztem_sivart', 0, Faker::Internet.email, first: Faker::Name.first_name, last: '2012-04-17 22:08:01'); Faker::Name.last_name, status: Random.rand(0..5)) INSERT INTO user_phones (number, phone_type, user_id) user.user_phones << UserPhone.new(phone_type: VALUES ('530-209-0599', 1, 4426); Random.rand(0..1), number: INSERT INTO user_phones (number, phone_type, user_id) Faker::PhoneNumber.phone_number) VALUES ('1-978-714-2317', 1, 4426); user.user_phones << UserPhone.new(phone_type: COMMIT; Random.rand(0..1), number: Faker::PhoneNumber.phone_number) user.save end 10
  • 11. Test Hardware Setup: Clustrix vs MySQL Clustrix MySQL Instance CLX 4110 nodes that we • 8 cores (Quantity 2 of formed into 3-node and 6- Intel Xeon 5450 node clusters, each with (3GHz, 12MB • 8 Cores Cache)) • 48GB RAM • 128GB RAM • 896GB SSD • 1.6TB of spinning • 600GB HDD HDD space (12 x • Clustrix VIP 300GB Seagate 15k (software load RPM SAS) balancer) • Hardware RAID 10 • Running Scientific Linux 6.2 • MySQL version 5.1.61 • Settings tuned H by Percona o s
  • 12. Test Sequence Ruby on Rails Benchmark • Starts desired number of threads, connects each to target DB system • Each thread begins running the prescribed workload during a warm-up period • After warm-up, statistics collection is turned on and test runs for a set time (10 minutes) • Results of test are saved locally as a JSON file
  • 13. Benchmark Results: MySQL only Summary: • This graph shows throughput (TPS) over a range of concurrencies 5,000 – 6,000 TPS @ 256 Threads • MySQL maxes out around a TPS of 5- 6k at concurrency of 256 • This drops down to 3-4k as TPS 3,000 – 4,000 TPS @ 1024 Threads concurrency approaches 1024, a 1/3 decrease in performance Put in perspective: • 256 threads might represent a small and growing organization • 1024 threads might represent when that site starts getting more popular
  • 14. Benchmark Results: 3-Node Clustrix v. MySQL • Same graph as before, now adding Clustrix database • Same axis, with greater scale because Clustrix outperforms MySQL • At 256 threads (MySQL’s peak), 8x TPS Performance @ 1024 Threads Clustrix performs 2.5x faster • At 1024 threads, a 3-node Clustrix Clustrix 3-Node database achieves peak performance of 30,000 TPS 2.5x TPS Performance @ 256 Threads MySQL But wait! There is more
  • 15. Benchmark Results: Clustrix 6-Node, 3-Node, MySQL Clustrix 6-Node • Again, same graph as before, now adding a 6 node Clustrix database • Clustrix has 15x performance of MySQL at 1024 threads 15x TPS Performance @ 1024 Threads • Concurrency reaches 45,000 TPS as concurrency reaches 10,000 How’s that for scale? Clustrix 3-Node MySQL
  • 16. Average Scenario Execution Time: 6-Node, 3-Node, MySQL 7 – 8 seconds @ ~9,250 Threads 2 – 3 seconds @ 1024 Threads MySQL Clustrix 3-Node ~0.1 seconds @ 1024 Threads ~0.7 seconds @ ~9,250 Threads ~0.1 seconds @ 256 Threads Clustrix 6-Node
  • 17. Conclusion • Ruby on Rails: Great rapid development framework for the web • MySQL & Rails: frequent development strategy • Scaling limits for Rails = Scaling limits for MySQL • The Clustrix database breaks through traditional Rails limitations by providing:  Linear scalability  Drop-in replacement for MySQL  Superior performance  High availability and inherent fault tolerance
  • 18. Breakthrough Scalability for Ruby on Rails with MySQL Thank you! [email protected]

Editor's Notes

  • #11: Here’s code for one of the scenariosPretty simpleUses a Ruby gem to create fake user information and 2 telephone numbersThis function takes arguments from the controller and stores them durably (we hope).Describe MVC single-page “form” -&gt; might be writing to multiple normalized objects in the backend
  • #12: You can see the Clustrix 4110 nodes off to the right in orange{These were formed into 3-node and 6-node cluster configurations}Each of these nodes had:8Cores48GBRAMMade use of the Clustrix VIP…(software load balancer built into the product)…to evenly distribute queries to all of the nodes
  • #13: Now both parts of the automation are in place and runningThe master client has started the slavesand the slaves have launched their Ruby benchmark instances{Each of these Ruby instances}{connects several threads to the database being tested}[CLICK] A warm-up period is provided to allow time for all these threads to connect to the database…and to start running the actual workload but with statistics collection turned off{When this warm-up ends, stats collection is turned back on and the benchmark runs for 10 minutes}{At the end the results are written to a JSON file}
  • #14: So let’s take a look at the results of the benchmark run against MySQLThis graph shows performance in terms of TPS over a range of concurrenciesX-axis: threadsUnlike graph from earlier, this and all following graphs use a linear scaleY-axis: Transactions per Second, TPSFor this and for each following group of curves, 2 representative runs are shownHere we see two runs of the benchmark for MySQLLet’s look at the data[CLICK] MySQL maxes out around 5000 or 6000 TPS at concurrency of 256[CLICK] Drops down to about 3,000 or 4,000 TPS as concurrency hits 1024About 1/3rd decrease in performanceBeyond that, performance decays steadily as concurrency increasesNote also, that it makes it out to ~9,000 connections but not all the way to 10,000Could not complete the test at that concurrency because the Ruby instances hung on the clientsPut in perspective…256 threads might represent point where a small and growing organization, such as a company running our demo auction website, has established itself1024 threads would be where that company has started to become more popularSo right as users are starting to pay attention, it’s becoming tougher to meet their demandsNow I’m going to add 2 more lines to this same graph…
  • #15: Same graph as before… exact same x-axis and…same y-axis except with greater scaleMySQL lines are now compressed down because the scale has increasedAnd we’ve added 2 new lines, each representing separate runs of a 3-node Clustrix cluster[CLICK] At 256 threads, MySQL’s peak performance,Clustrix has about 2.5x performance advantage[CLICK] But, at 1024 threads, the 3-node cluster is hitting its peak performance of around 30,000 TPSAnd now, I’m going to add the last 2 lines to this graph…
  • #16: Again, same graph as before, with the addition of a pair of lines, each representing a run of a 6-node Clustrix cluster[CLICK]Clustrix has 15x performance of MySQL @ 1024 threadsReaches peak of ~55,000 TPSDrops very gently down to ~45,000 TPS as concurrency reaches all the way out to 10,000
  • #17: So let’s look at those same test runs again, except now let’s concentrate on how long it takes each scenario to executeRemember, scenarios are things like adding a user, placing a bid on an auction, uploading a picture, etc. This graph has the same x-axis, concurrencyBut now the y-axis shows how long the average transaction took to complete in whole seconds [CLICK] At 256 threads, everybody is completing requests in about 0.1 secondsGreat; everything is working fine[CLICK] But along the way to 1024 threads, MySQL starts taking up to 3 seconds to answer requestsThis is going to confuse and upset the user experience[CLICK] Meanwhile Clustrix is completing just as fast as before (~0.1 seconds)[CLICK] Even out @9250 threads, 6-node Clustrix cluster is still operating relatively quickly[CLICK] But MySQL is reacting so slowly that various timeouts will likely occur, possibly bringing the revenue-producing activities of the site down
  • #18: In conclusion…{Ruby on Rails is a popular framework for deploying web sites}[CLICK] {MySQL is frequently used as the backend for Rails and this works well…}[CLICK] When organizations are first putting their ideas together or…Dealing with their initial customer base[CLICK] But, as one’s organization becomes more successful, MySQL eventually hits various limits and this keeps Rails from scaling properly[CLICK] {Clustrix breaks through traditional Rails limitations}Allowing Rails to scaleProviding full MySQL compliance, high availability, and inherent fault toleranceIf you think back to the Twitter quote that Neil showed about Rails limitations…know that you don’t have to give up what you love about Rails to make it scale; you just need the a truly scalable database solution
  • #19: Thanks very much for your attentionI got a little QR code on here that links to the white paper up on our web siteWe have Robert from Blue Box with us here today and… we invite you all to our booth # 16 after the break…to learn more about Clustrix, Blue Box, and our Ruby on Rails benchmarkI hope to see you thereEnjoy the rest of Percona Live!!