SlideShare a Scribd company logo
1 of 47
Download to read offline
Framework and
Application Benchmarking
         Paul M. Jones
        PhpBenelux 2011

            @pmjones
       http://joind.in/2498
Overview
• Benchmarking methodology, results,
  and interpretation
 • Server/application
 • Single frameworks
 • Framework comparisons
• Resource usage prediction
• Engineering analysis
Read These




• “Free to Choose”, Friedman
• “Pleasure of Finding Things Out”, Feynman
• “Fooled By Randomness”, Taleb
About Me
• Dev, Sr Dev, Team Lead,
  Architect, VP Eng

• PHP since 1999

• Savant template system

• PEAR Group member

• http://paul-m-jones.com

• @pmjones
Full Disclosure

• Solar framework

• Zend framework

  • Zend_Db*,
    Zend_View

• “Rigor and integrity”

• Google Code, now
  Github
Part 1:
In General
Profiling vs
            Benchmarking

• Profiling applies to sub-
  systems (component design)

• Benchmarking applies to
  entire systems (architecture
  and interaction)

• Profile is to unit test, as
  benchmark is to system test
Benchmarking Subjects
• CPU                      • Programmer
                             productivity
• RAM
                           • Time to initial
• Disk access                implementation
• Database access          • Time to add new
• Network access             major feature

• Requests/second          • Time to fix bugs

          -- numeric measurement --
           -- control for variables --
Why Bother With
          Benchmarking?


• New site will be linked
  by Slashdot, Digg, etc.

• “Can we handle the
  traffic, Dodgers?”

• “Sure thing, boss.”
Why Bother With
            Benchmarking?


• “...(time to load-test.)”

• How many req/sec
  expected?

• Load-tested, optimized
  in a hurry, balanced
Know Your Limitations
• What limits are imposed,
  and where?

• Where to spend effort
  when optimizing?

• Profiling your app will not
  help with non-app limits

• Profiling does not tell you
  req/sec
The Stack



• Web server
• Framework (foundation)
• Application
Part 2:
Getting Started
Methodology


• Refining and reporting since 2007
• Benchmark the basic system
• Add a component, benchmark again
• Track responsiveness at each point
Tools
• ab, http_load,
  siege, ...

• Emulate concurrent
  users hitting a URI

• Reports req/sec,
  latency, min/max
  times, etc


ab -c 10 -t 60 http://example.com/
ab

Document Path: /baseline-html/index.html
Document Length: 13 bytes
Concurrency Level: 10
Time taken for tests: 0.19088 seconds
Complete requests: 50000
Failed requests: 0
Total transferred: 15950000 bytes
HTML transferred: 650000 bytes
Requests per second: 2619.45
Transfer rate: 835.60 kb/s received
http_load


4278 fetches, 325 max parallel, 25668 bytes
6 mean bytes/connection
855 fetches/sec, 5130 bytes/sec
msecs/connect: 20.0881 mean, 3006.54 max, 0.099 min
msecs/first-response: 51.3568 mean, 342.488 max, 1.423 min
HTTP response codes:
  code 200 -- 4278
siege



2009-02-26 16:35:22, 256869, 60.28, 3, 0.00, 4261.26, ...
Combined Tooling

• Each tool (ab, http_load, siege) has different
  options, params, and target specifications
• http://github.com/pmjones/php-framework-
  benchmarks


./bench/(ab|http_load|siege) target/all.ini
Benchmark Subject


• Run against a test installation
• As similar to production as possible
• Hardware, OS, server, PHP installation
• No database, no application code
Control for
     Known Variables



• Network latency (use localhost)
• Server processes (turn everything off)
Outer Limits Of
          Responsiveness
• Amazon EC2 “Large”
  instance, 64-Bit Ubuntu
  10.04 (Alestic)

• Apache 2.2 (stock install)

• PHP 5.3.3, APC, Suhosin
  (stock install)

• “index.html” and
  “index.php”
HTML and PHP Graph
                           2814.62
      ab
                       2170.31

                              3195.91
http_load
                          2496.59

                                       4262.12
    siege
                                3148.12

            0         1250        2500        3750   5000
                        html             php
                (10 concurrent users, 60 seconds)
HTML and PHP
     Percentage Change


           html      php       pct
ab         2814.62   2170.31   77.11%

httpload   3195.91   2496.59   78.12%

siege      4262.12   3148.12   73.86%
Control for
        Unknown Variables

• Run multiple times

• No two runs will be
  identical; look for trends

• File-based sessions will
  cause exponentially
  declining returns

• session_id(‘constant_value’)
Other Problem
          Indicators


• PHP faster than
  HTML?

• Byte counts?

• Socket availability?
Benchmarking as
  Resource Prediction
• About resource planning, not
  speed (per se)

• With supply of “R” requests/
  second, you need “S” servers
  for demand of “T” traffic

• What stack components can
  you modify to increase “R”
  so you can handle more “T”
  with same or fewer “S”?
Part 3:
Single Frameworks
Single-Framework
      Methodology
• Minimal, not full, application
• Sane config
• No action code
• No view layout or helpers
• Static view text
• No caching
• No database
Framework (Foundation)
    Benchmarking
             Web Server + PHP
               Framework
      Boot   Front   Page   Action   View



• Dynamic dispatch cycle as the limiting
  factor
• Improvements off critical path will not
  increase responsiveness
• Page cache?
Single-Framework
             Analysis


• Now you know how
  much you need to
  improve

• Work on the critical path

• Iterative benchmarking
Benchmarking as
       Engineering Aid
• Every architecture
  decision has a cost

• Compare benchmark
  stats between versions

• Are added features
  are worth req/sec
  cost?

• (Thanks, Laura
  Thomson.)
Part 3:
 Multiple
Frameworks
Multiple-Framework
          Comparison

• Examine responsiveness
  in context of other systems

• Compare architecture
  costs between systems

• Use the same minimal app
  to remove variability in
  application code
Compare Like With Like
• Frameworks to be compared
  should be reasonably similar
  in “style” or “class”

• PHP5, design patterns, front
  & page controllers, controller
  & view separation, plugins or
  extensions, no globals

• Cake, Lithium, Solar,
  Symfony, Yii, Zend

• CI, Kohana
Multiple-Framework
   Methodology (1/2)

• Minimal application
• Reduced or optimized config
• Production mode
• No debugging or logging
• No database connection
• No layouts or view helpers
Multiple-Framework
   Methodology (2/2)

• APC to reduce filesystem access
• Restart web server between runs (APC)
• 5 runs of 10 concurrent users for 60
  seconds, averaged
• Calculate req/sec as percent of PHP
  (thanks, Richard “Cyberlot” Thomas)
Framework Numbers
Target                relative   average   1         2         3         4         5

baseline/html         1.2823     3220.56   3227.18   3226.03   3207.75   3222.63   3219.20

baseline/php          1.0000     2511.54   2521.14   2509.00   2506.45   2508.48   2512.63

cake/1.3.7            0.0412     103.46    103.37    103.73    103.93    102.55    103.70

ci/1.7.3              0.2946     739.95    722.08    725.95    722.96    768.37    760.40

kohana/3.0.9          0.2912     731.37    696.83    757.46    743.72    720.10    738.76

lithium/0.9.9         0.0827     207.62    252.87    249.94    35.19     249.53    250.58

solar/1.1.1           0.1609     404.17    405.08    404.33    403.12    399.63    408.68

symfony/1.4.8         0.0784     196.91    197.00    197.77    199.00    194.93    195.87

symfony/2.0.0alpha1 0.1675       420.73    422.02    424.85    422.48    411.20    423.08

symfony/2.0.0pr4      0.0897     225.22    224.59    221.18    225.88    227.73    226.71

yii/1.1.5             0.1891     474.82    500.21    439.74    456.77    494.82    482.57

zend/1.10.2-minapp    0.1136     285.28    279.83    291.61    280.61    287.00    287.37

zend/1.10.2-project   0.0832     208.84    215.74    206.20    209.26    207.75    205.25
Framework Graph (100%)
        baseline/html
        baseline/php
          cake/1.3.7
              ci/1.7.3
        kohana/3.0.9
         lithium/0.9.9
          solar/1.1.1
       symfony/1.4.8
 symfony/2.0.0alpha1
    symfony/2.0.0pr4
             yii/1.1.5
 zend/1.10.2-minapp
  zend/1.10.2-project
                         0   0.375   0.750   1.125   1.500
Framework Graph (30%)
          cake/1.3.7        0.04

             ci/1.7.3                                                    0.29

       kohana/3.0.9                                                      0.29

        lithium/0.9.9              0.08

         solar/1.1.1                               0.16

      symfony/1.4.8                0.08

symfony/2.0.0alpha1                                 0.17

   symfony/2.0.0pr4                  0.09

            yii/1.1.5                                      0.19

zend/1.10.2-minapp                          0.11

 zend/1.10.2-project               0.08

                        0                   0.10                  0.20          0.30
What Does This Mean?
• Both more and less than you think it
  might
• Speed is not the only consideration
  • Features, intangibles
  • Unlikely to change minds of devotees
• Even the slowest is still pretty fast
• Each AJAX call is one request
Failure Modes
• Apache/Lighty, APC/XCache, mod_php/
  fcgid
• EC2 load fluctuation between/during runs
• Order of testing
• Different concurrency or duration
• Added features and app code will reduce
  dynamic response ... but curve is
  unknown.
Links
• http://github.com/pmjones/php-framework-benchmarks
• http://code.google.com/p/web-framework-benchmarks
• “New Year’s Benchmarks”:
  http://paul-m-jones/archives/238
• “Do All Frameworks Suck?”:
  http://www.laurathomson.com/2007/07/do-all-
  framewor.html
• Google: "cargo cult science"
• Questions?
• Comments?
• Criticism?
• http://joind.in/2498
Objections


• “Highly profiled.”
• “‘Hello world’ is unrealistic.”
• “Not optimized for ‘hello world.’”
• “Faster for ‘real world’ applications.”
Avoid Frameworks?
• If framework code is only at 4-30% of max
  PHP, should we not use frameworks?
• “Slow” relative to what?
• Compare like with like, and proposed systems
  to existing systems.
• You will use a framework, even if you write it
  yourself.
• The good comes not from the code or the
  features, but process standardization.
Thanks!

More Related Content

What's hot

Apache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationApache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationClaus Ibsen
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxClaus Ibsen
 
Webinar: Agile Network Deployment
Webinar: Agile Network DeploymentWebinar: Agile Network Deployment
Webinar: Agile Network DeploymentVasudhaSridharan
 
Managing Large Selenium Grid
Managing Large Selenium Grid�Managing Large Selenium Grid�
Managing Large Selenium Griddimakovalenko
 
Developing in the Cloud
Developing in the CloudDeveloping in the Cloud
Developing in the CloudRyan Cuprak
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewJosh Padnick
 
[114] DRC hubo technical review
[114] DRC hubo technical review[114] DRC hubo technical review
[114] DRC hubo technical reviewNAVER D2
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Ryan Cuprak
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshopseleniumconf
 
Performance testing with 100,000 concurrent users in AWS
Performance testing with 100,000 concurrent users in AWSPerformance testing with 100,000 concurrent users in AWS
Performance testing with 100,000 concurrent users in AWSMatthias Matook
 
The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedInYevgeniy Brikman
 
JMeter, Docker sitting in a tree
JMeter, Docker sitting in a treeJMeter, Docker sitting in a tree
JMeter, Docker sitting in a treesrivaths_sankaran
 
Performance Oriented Design
Performance Oriented DesignPerformance Oriented Design
Performance Oriented DesignRodrigo Campos
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Andrew Krug
 

What's hot (20)

Apache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentationApache Camel - FUSE community day London 2010 presentation
Apache Camel - FUSE community day London 2010 presentation
 
Apache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the boxApache Camel Introduction & What's in the box
Apache Camel Introduction & What's in the box
 
How Flipkart scales PHP
How Flipkart scales PHPHow Flipkart scales PHP
How Flipkart scales PHP
 
Webinar: Agile Network Deployment
Webinar: Agile Network DeploymentWebinar: Agile Network Deployment
Webinar: Agile Network Deployment
 
Managing Large Selenium Grid
Managing Large Selenium Grid�Managing Large Selenium Grid�
Managing Large Selenium Grid
 
Developing in the Cloud
Developing in the CloudDeveloping in the Cloud
Developing in the Cloud
 
Cfml features modern_coding
Cfml features modern_codingCfml features modern_coding
Cfml features modern_coding
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
[114] DRC hubo technical review
[114] DRC hubo technical review[114] DRC hubo technical review
[114] DRC hubo technical review
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshop
 
Performance testing with 100,000 concurrent users in AWS
Performance testing with 100,000 concurrent users in AWSPerformance testing with 100,000 concurrent users in AWS
Performance testing with 100,000 concurrent users in AWS
 
The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedIn
 
JMeter, Docker sitting in a tree
JMeter, Docker sitting in a treeJMeter, Docker sitting in a tree
JMeter, Docker sitting in a tree
 
Performance Oriented Design
Performance Oriented DesignPerformance Oriented Design
Performance Oriented Design
 
Keep Applications Online
Keep Applications OnlineKeep Applications Online
Keep Applications Online
 
BlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance ReportingBlazeMeter- Effective Performance Reporting
BlazeMeter- Effective Performance Reporting
 
ColdFusion builder plugins
ColdFusion builder pluginsColdFusion builder plugins
ColdFusion builder plugins
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015
 

Viewers also liked

Same Thing Happens Every Time
Same Thing Happens Every TimeSame Thing Happens Every Time
Same Thing Happens Every TimePaul Jones
 
All You Jokers
All You JokersAll You Jokers
All You JokersPaul Jones
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)Paul Jones
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Paul Jones
 
How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?Paul Jones
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHPPaul Jones
 
Action-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCAction-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCPaul Jones
 
How To Train Your Manager
How To Train Your ManagerHow To Train Your Manager
How To Train Your ManagerPaul Jones
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerPaul Jones
 
Mobile App Benchmarks: Engagement & Retention
Mobile App Benchmarks: Engagement & RetentionMobile App Benchmarks: Engagement & Retention
Mobile App Benchmarks: Engagement & RetentionEmmanuel Quartey
 
Career and Life Management
Career and Life ManagementCareer and Life Management
Career and Life ManagementPaul Jones
 

Viewers also liked (11)

Same Thing Happens Every Time
Same Thing Happens Every TimeSame Thing Happens Every Time
Same Thing Happens Every Time
 
All You Jokers
All You JokersAll You Jokers
All You Jokers
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)
 
How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?How Do We Get The Deficit To Zero?
How Do We Get The Deficit To Zero?
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHP
 
Action-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCAction-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVC
 
How To Train Your Manager
How To Train Your ManagerHow To Train Your Manager
How To Train Your Manager
 
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-ControllerAction-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
Action-Domain-Responder: A Web-Specific Refinement of Model-View-Controller
 
Mobile App Benchmarks: Engagement & Retention
Mobile App Benchmarks: Engagement & RetentionMobile App Benchmarks: Engagement & Retention
Mobile App Benchmarks: Engagement & Retention
 
Career and Life Management
Career and Life ManagementCareer and Life Management
Career and Life Management
 

Similar to Framework and Application Benchmarking

Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
Common Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudCommon Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudNick Gerner
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukLohika_Odessa_TechTalks
 
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...rschuppe
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scalingsmattoon
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...rschuppe
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudyJohn Adams
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)Tech in Asia ID
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonNeotys
 
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...
Oleksandr Khotemskyi  - Serverless architecture and how to apply it in Automa...Oleksandr Khotemskyi  - Serverless architecture and how to apply it in Automa...
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...Web Tech Fun
 
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Dakiry
 
OnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildOnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildDavid Rosen
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sunsmattoon
 
Radical Speed for SQL Queries on Databricks: Photon Under the Hood
Radical Speed for SQL Queries on Databricks: Photon Under the HoodRadical Speed for SQL Queries on Databricks: Photon Under the Hood
Radical Speed for SQL Queries on Databricks: Photon Under the HoodDatabricks
 
Linux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownLinux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownScyllaDB
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Testplant
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 

Similar to Framework and Application Benchmarking (20)

Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
Common Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the CloudCommon Sense Performance Indicators in the Cloud
Common Sense Performance Indicators in the Cloud
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
 
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...
Application Performance Troubleshooting 1x1 - Von Schweinen, Schlangen und Pa...
 
Drupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, ScalingDrupal Efficiency - Coding, Deployment, Scaling
Drupal Efficiency - Coding, Deployment, Scaling
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Remix
RemixRemix
Remix
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...
Oleksandr Khotemskyi  - Serverless architecture and how to apply it in Automa...Oleksandr Khotemskyi  - Serverless architecture and how to apply it in Automa...
Oleksandr Khotemskyi - Serverless architecture and how to apply it in Automa...
 
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
Олександр Хотемський:”Serverless архітектура та її застосування в автоматизац...
 
OnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildOnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform Build
 
Drupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from SunDrupal Efficiency using open source technologies from Sun
Drupal Efficiency using open source technologies from Sun
 
Radical Speed for SQL Queries on Databricks: Photon Under the Hood
Radical Speed for SQL Queries on Databricks: Photon Under the HoodRadical Speed for SQL Queries on Databricks: Photon Under the Hood
Radical Speed for SQL Queries on Databricks: Photon Under the Hood
 
Linux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance ShowdownLinux Kernel vs DPDK: HTTP Performance Showdown
Linux Kernel vs DPDK: HTTP Performance Showdown
 
Tools. Techniques. Trouble?
Tools. Techniques. Trouble?Tools. Techniques. Trouble?
Tools. Techniques. Trouble?
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Intro to.net core 20170111
Intro to.net core   20170111Intro to.net core   20170111
Intro to.net core 20170111
 

Framework and Application Benchmarking

  • 1. Framework and Application Benchmarking Paul M. Jones PhpBenelux 2011 @pmjones http://joind.in/2498
  • 2. Overview • Benchmarking methodology, results, and interpretation • Server/application • Single frameworks • Framework comparisons • Resource usage prediction • Engineering analysis
  • 3. Read These • “Free to Choose”, Friedman • “Pleasure of Finding Things Out”, Feynman • “Fooled By Randomness”, Taleb
  • 4. About Me • Dev, Sr Dev, Team Lead, Architect, VP Eng • PHP since 1999 • Savant template system • PEAR Group member • http://paul-m-jones.com • @pmjones
  • 5. Full Disclosure • Solar framework • Zend framework • Zend_Db*, Zend_View • “Rigor and integrity” • Google Code, now Github
  • 7. Profiling vs Benchmarking • Profiling applies to sub- systems (component design) • Benchmarking applies to entire systems (architecture and interaction) • Profile is to unit test, as benchmark is to system test
  • 8. Benchmarking Subjects • CPU • Programmer productivity • RAM • Time to initial • Disk access implementation • Database access • Time to add new • Network access major feature • Requests/second • Time to fix bugs -- numeric measurement -- -- control for variables --
  • 9. Why Bother With Benchmarking? • New site will be linked by Slashdot, Digg, etc. • “Can we handle the traffic, Dodgers?” • “Sure thing, boss.”
  • 10. Why Bother With Benchmarking? • “...(time to load-test.)” • How many req/sec expected? • Load-tested, optimized in a hurry, balanced
  • 11. Know Your Limitations • What limits are imposed, and where? • Where to spend effort when optimizing? • Profiling your app will not help with non-app limits • Profiling does not tell you req/sec
  • 12. The Stack • Web server • Framework (foundation) • Application
  • 14. Methodology • Refining and reporting since 2007 • Benchmark the basic system • Add a component, benchmark again • Track responsiveness at each point
  • 15. Tools • ab, http_load, siege, ... • Emulate concurrent users hitting a URI • Reports req/sec, latency, min/max times, etc ab -c 10 -t 60 http://example.com/
  • 16. ab Document Path: /baseline-html/index.html Document Length: 13 bytes Concurrency Level: 10 Time taken for tests: 0.19088 seconds Complete requests: 50000 Failed requests: 0 Total transferred: 15950000 bytes HTML transferred: 650000 bytes Requests per second: 2619.45 Transfer rate: 835.60 kb/s received
  • 17. http_load 4278 fetches, 325 max parallel, 25668 bytes 6 mean bytes/connection 855 fetches/sec, 5130 bytes/sec msecs/connect: 20.0881 mean, 3006.54 max, 0.099 min msecs/first-response: 51.3568 mean, 342.488 max, 1.423 min HTTP response codes: code 200 -- 4278
  • 18. siege 2009-02-26 16:35:22, 256869, 60.28, 3, 0.00, 4261.26, ...
  • 19. Combined Tooling • Each tool (ab, http_load, siege) has different options, params, and target specifications • http://github.com/pmjones/php-framework- benchmarks ./bench/(ab|http_load|siege) target/all.ini
  • 20. Benchmark Subject • Run against a test installation • As similar to production as possible • Hardware, OS, server, PHP installation • No database, no application code
  • 21. Control for Known Variables • Network latency (use localhost) • Server processes (turn everything off)
  • 22. Outer Limits Of Responsiveness • Amazon EC2 “Large” instance, 64-Bit Ubuntu 10.04 (Alestic) • Apache 2.2 (stock install) • PHP 5.3.3, APC, Suhosin (stock install) • “index.html” and “index.php”
  • 23. HTML and PHP Graph 2814.62 ab 2170.31 3195.91 http_load 2496.59 4262.12 siege 3148.12 0 1250 2500 3750 5000 html php (10 concurrent users, 60 seconds)
  • 24. HTML and PHP Percentage Change html php pct ab 2814.62 2170.31 77.11% httpload 3195.91 2496.59 78.12% siege 4262.12 3148.12 73.86%
  • 25. Control for Unknown Variables • Run multiple times • No two runs will be identical; look for trends • File-based sessions will cause exponentially declining returns • session_id(‘constant_value’)
  • 26. Other Problem Indicators • PHP faster than HTML? • Byte counts? • Socket availability?
  • 27. Benchmarking as Resource Prediction • About resource planning, not speed (per se) • With supply of “R” requests/ second, you need “S” servers for demand of “T” traffic • What stack components can you modify to increase “R” so you can handle more “T” with same or fewer “S”?
  • 29. Single-Framework Methodology • Minimal, not full, application • Sane config • No action code • No view layout or helpers • Static view text • No caching • No database
  • 30. Framework (Foundation) Benchmarking Web Server + PHP Framework Boot Front Page Action View • Dynamic dispatch cycle as the limiting factor • Improvements off critical path will not increase responsiveness • Page cache?
  • 31. Single-Framework Analysis • Now you know how much you need to improve • Work on the critical path • Iterative benchmarking
  • 32. Benchmarking as Engineering Aid • Every architecture decision has a cost • Compare benchmark stats between versions • Are added features are worth req/sec cost? • (Thanks, Laura Thomson.)
  • 34. Multiple-Framework Comparison • Examine responsiveness in context of other systems • Compare architecture costs between systems • Use the same minimal app to remove variability in application code
  • 35. Compare Like With Like • Frameworks to be compared should be reasonably similar in “style” or “class” • PHP5, design patterns, front & page controllers, controller & view separation, plugins or extensions, no globals • Cake, Lithium, Solar, Symfony, Yii, Zend • CI, Kohana
  • 36. Multiple-Framework Methodology (1/2) • Minimal application • Reduced or optimized config • Production mode • No debugging or logging • No database connection • No layouts or view helpers
  • 37. Multiple-Framework Methodology (2/2) • APC to reduce filesystem access • Restart web server between runs (APC) • 5 runs of 10 concurrent users for 60 seconds, averaged • Calculate req/sec as percent of PHP (thanks, Richard “Cyberlot” Thomas)
  • 38. Framework Numbers Target relative average 1 2 3 4 5 baseline/html 1.2823 3220.56 3227.18 3226.03 3207.75 3222.63 3219.20 baseline/php 1.0000 2511.54 2521.14 2509.00 2506.45 2508.48 2512.63 cake/1.3.7 0.0412 103.46 103.37 103.73 103.93 102.55 103.70 ci/1.7.3 0.2946 739.95 722.08 725.95 722.96 768.37 760.40 kohana/3.0.9 0.2912 731.37 696.83 757.46 743.72 720.10 738.76 lithium/0.9.9 0.0827 207.62 252.87 249.94 35.19 249.53 250.58 solar/1.1.1 0.1609 404.17 405.08 404.33 403.12 399.63 408.68 symfony/1.4.8 0.0784 196.91 197.00 197.77 199.00 194.93 195.87 symfony/2.0.0alpha1 0.1675 420.73 422.02 424.85 422.48 411.20 423.08 symfony/2.0.0pr4 0.0897 225.22 224.59 221.18 225.88 227.73 226.71 yii/1.1.5 0.1891 474.82 500.21 439.74 456.77 494.82 482.57 zend/1.10.2-minapp 0.1136 285.28 279.83 291.61 280.61 287.00 287.37 zend/1.10.2-project 0.0832 208.84 215.74 206.20 209.26 207.75 205.25
  • 39. Framework Graph (100%) baseline/html baseline/php cake/1.3.7 ci/1.7.3 kohana/3.0.9 lithium/0.9.9 solar/1.1.1 symfony/1.4.8 symfony/2.0.0alpha1 symfony/2.0.0pr4 yii/1.1.5 zend/1.10.2-minapp zend/1.10.2-project 0 0.375 0.750 1.125 1.500
  • 40. Framework Graph (30%) cake/1.3.7 0.04 ci/1.7.3 0.29 kohana/3.0.9 0.29 lithium/0.9.9 0.08 solar/1.1.1 0.16 symfony/1.4.8 0.08 symfony/2.0.0alpha1 0.17 symfony/2.0.0pr4 0.09 yii/1.1.5 0.19 zend/1.10.2-minapp 0.11 zend/1.10.2-project 0.08 0 0.10 0.20 0.30
  • 41. What Does This Mean? • Both more and less than you think it might • Speed is not the only consideration • Features, intangibles • Unlikely to change minds of devotees • Even the slowest is still pretty fast • Each AJAX call is one request
  • 42. Failure Modes • Apache/Lighty, APC/XCache, mod_php/ fcgid • EC2 load fluctuation between/during runs • Order of testing • Different concurrency or duration • Added features and app code will reduce dynamic response ... but curve is unknown.
  • 43. Links • http://github.com/pmjones/php-framework-benchmarks • http://code.google.com/p/web-framework-benchmarks • “New Year’s Benchmarks”: http://paul-m-jones/archives/238 • “Do All Frameworks Suck?”: http://www.laurathomson.com/2007/07/do-all- framewor.html • Google: "cargo cult science"
  • 44. • Questions? • Comments? • Criticism? • http://joind.in/2498
  • 45. Objections • “Highly profiled.” • “‘Hello world’ is unrealistic.” • “Not optimized for ‘hello world.’” • “Faster for ‘real world’ applications.”
  • 46. Avoid Frameworks? • If framework code is only at 4-30% of max PHP, should we not use frameworks? • “Slow” relative to what? • Compare like with like, and proposed systems to existing systems. • You will use a framework, even if you write it yourself. • The good comes not from the code or the features, but process standardization.