SlideShare a Scribd company logo
Turbocharge Your PHP
                                      with Nginx




                                       Errazudin Ishak




www.mimos.my   © 2009 MIMOS Berhad. All Rights Reserved.
Agenda

        • me
        • “engine X”
        • nginx.conf
        • ..with PHP
        • Benchmark
        • Samples


www.mimos.my      © 2010 MIMOS Berhad. All Rights Reserved.
"Apache is like Microsoft Word, it has a million options
      but you only need six. Nginx does those six things, and it
      does five of them 50 times faster than Apache."
      - Chris Lea, ChrisLea.com




http://www.abacuspub.com/fsd/catalog/s574.htm



             www.mimos.my                       © 2010 MIMOS Berhad. All Rights Reserved.
Me
        • Senior engineer @ Mimos Malaysia
        • Focuses on web application development,
          deployment, performance and stability.
        • 2009 : foss.my , MyGOSSCON
        • 2010 : Entp. PHP Techtalk, BarcampKL, PHP
                 Meetup, MOSC2010




www.mimos.my          © 2010 MIMOS Berhad. All Rights Reserved.
www.mimos.my   © 2010 MIMOS Berhad. All Rights Reserved.
nginx

        • Free
        • X platform
        • open-source
        • (high-performance)
        • lightweight
        • HTTP server
        • reverse proxy
        • IMAP/POP3 proxy server
www.mimos.my      © 2010 MIMOS Berhad. All Rights Reserved.
http://noisetu.be/mirrors/jet_beetle/



        “I'm the author of nginx (pronounced "engine x")-
        Igor Sysoev
        (nginx creator)




www.mimos.my              © 2010 MIMOS Berhad. All Rights Reserved.
http://image.importtuner.com/f/miscellaneous/new-tomei-turbo-kits-for-sr/29774779/tomei-bolt-on-turbo-kit-for-sr.jpg




               Load Balance
               Static Content, Index files
               Reverse Proxy (with cache)
               Streaming




www.mimos.my             © 2010 MIMOS Berhad. All Rights Reserved.
http://www.litchfieldimports.co.uk/forum/gtr-engine-bay.jpg




               Loads of Request
               Less memory footprint
               Use less CPU
               C10K Certified



www.mimos.my       © 2010 MIMOS Berhad. All Rights Reserved.
http://www.gtrblog.com/wp-content/uploads/2008/11/gtr-gt2-nurburgring-001.jpg




                                                  Apache
--------                                          ----------
Async model                                       Processes
Single Thread                                     Threads
Low Memory                                        High Memory
Less CPU                                          CPU Overhead
PHP as separate proc.                             PHP included as
over FastCGI                                      module (mod_php)




  www.mimos.my      © 2010 MIMOS Berhad. All Rights Reserved.
Numbers

                                                           http://www.scoobyworld.co.uk/catalog/images/BFamber-1.jpg
www.mimos.my   © 2010 MIMOS Berhad. All Rights Reserved.
Market Share for Top Servers Across All Domains
                                                                    213,458,815




Source :
Netcraft
  www.mimos.my          © 2010 MIMOS Berhad. All Rights Reserved.
Market Share for Top Servers Across the Million Busiest
          Sites




Source :
Netcraft
  www.mimos.my             © 2010 MIMOS Berhad. All Rights Reserved.
Market Share for Top Servers Across All Domains

                                                                    227,225,642




Source :
Netcraft
  www.mimos.my          © 2010 MIMOS Berhad. All Rights Reserved.
Market Share for Top Servers Across the Million Busiest
          Sites




Source :
Netcraft
  www.mimos.my             © 2010 MIMOS Berhad. All Rights Reserved.
http://www.autoguide.com/auto-news/wp-content/uploads/2010/09/The_Stig_Top_Gear_Eight.jpg




                                                                     Who?




www.mimos.my   © 2010 MIMOS Berhad. All Rights Reserved.
Me uses nginx




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Me uses nginx




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
We also..




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
We all love nginx…




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Modules

                          Mail, 3rd
                           Party
                           Optional
                               HTTP

                           Standard
                             HTTP



                            Core

www.mimos.my      © 2010 MIMOS Berhad. All Rights Reserved.
Modules


               Mail Core, Mail Auth, Mail Proxy, Mail SSL


 HTTP Addition, Emb. Perl, FLV, Gzip Precompression, Random Index,
GeoIP, Real IP, SSL, Stub Status, Substitution, WebDAV, Google Perftools,
                       XSLT, Secure Link, Image Filter

 HTTP Core, HTTP Upstream, HTTP Access, HTTP Auth Basic, HTTP Auto
 Index, Browser, Charset, Empty gif, FastCGI, Geo, Gzip, HTTP Headers,
 Index, HTTP Referer, HTTP Limit Zone, HTTP Limit Requests, Log, Map,
           Memchached, HTTP Proxy, Rewrite, SSI, User ID



                          Main, Events
www.mimos.my              © 2010 MIMOS Berhad. All Rights Reserved.
Nginx with PHP

        • FastCGI
        • PHP-FPM (FastCGI Process Manager)
               • Bundled with PHP 5.3.3




www.mimos.my              © 2010 MIMOS Berhad. All Rights Reserved.
Nginx with PHP : FastCGI

        • persistent processes, ability to handle multiple
          requests.
        • web server and gateway application
          communicate with sockets such as TCP
        • web server forwards the client request to the
          gateway and receives the response within a
          single connection
        • can be implemented on any platform with any
          programming language.



www.mimos.my           © 2010 MIMOS Berhad. All Rights Reserved.
Nginx with PHP : FastCGI

     server {
       server_name mysite.com;
       listen 80;
       root /usr/share/mysite/www;
       index index.html;
       location / {
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_param SCRIPT_FILENAME
       $document_root$fastcgi_script_name;
           fastcgi_param PATH_INFO $fastcgi_script_name;
           include fastcgi_params;
       }
     }


www.mimos.my         © 2010 MIMOS Berhad. All Rights Reserved.
PHP-FPM

        • FastCGI Process Manager
        • Daemonizes PHP > background proc
        • provides a command-line script for
          managing PHP proc
        • configuration of FastCGI pools
        • enhances some of the FastCGI internals
        • increases error reporting
        • script termination

www.mimos.my         © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark
http://www.myshutterspace.com/profile/AthonySaucedo



        www.mimos.my                                  © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : Specs

        •      AMD Turion 64
        •      1MB L2 Cache, 1.8 GHz
        •      1GB RAM
        •      OS- Karmic Koala
        •      (my old 4 y.o. Acer)




www.mimos.my             © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : apacheBench

        • -n 5000
        • -c 500




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : nginx




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : apache (runs..)




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : apache (end)




www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
Benchmark : Findings


                Apache 2.2.12               Nginx 0.7.62
Concurrency     500                         500
Doc size        2195 bytes                  2195 bytes
Complete        100%                        100%
Request
Req per secs    327                         3003
Longest Req     15269ms                     296ms




 www.mimos.my         © 2010 MIMOS Berhad. All Rights Reserved.
“Every nanoseconds count!” - My Big Boss
               (your boss also)
                                                                              http://geekonfilm.files.wordpress.com/2009/09/vader.jpg
www.mimos.my                      © 2010 MIMOS Berhad. All Rights Reserved.
Resources


•    http://wiki.nginx.org/Main
•    Nedelcu’s book http://goo.gl/67OA
•    http://php-fpm.org/
•    http://nginx.org
•    #nginx




    www.mimos.my        © 2010 MIMOS Berhad. All Rights Reserved.
http://goo.gl/EbTI




                                        Demo


www.mimos.my   © 2010 MIMOS Berhad. All Rights Reserved.
THANK YOU

                                                                                                    @errazudin
                                                                                                http://joind.in/2067


* All images, logos and data are the copyright of
their respective owners
     www.mimos.my                                   © 2009 MIMOS Berhad. All Rights Reserved.

More Related Content

Similar to turbocharge your php with nginx - errazudin - phpnw2010

Rise of the Planet of the Anonymous
Rise of the Planet of the AnonymousRise of the Planet of the Anonymous
Rise of the Planet of the Anonymous
phptechtalk
 
Cooking security sans@night
Cooking security sans@nightCooking security sans@night
Cooking security sans@night
jtimberman
 
Jeff Rigby on Scaling Drupal in the Enterprise
Jeff Rigby on Scaling Drupal in the EnterpriseJeff Rigby on Scaling Drupal in the Enterprise
Jeff Rigby on Scaling Drupal in the Enterprise
Joe Bachana
 
Sulu and the Other Guys - Symfony Live Berlin 2015
Sulu and the Other Guys - Symfony Live Berlin 2015Sulu and the Other Guys - Symfony Live Berlin 2015
Sulu and the Other Guys - Symfony Live Berlin 2015
Sulu
 
Scalable applications with HTTP
Scalable applications with HTTPScalable applications with HTTP
Scalable applications with HTTP
Patrice Neff
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
robinzimmermann
 
Media mosa architecture - features -10 june 2010
Media mosa   architecture - features -10 june 2010Media mosa   architecture - features -10 june 2010
Media mosa architecture - features -10 june 2010
Andrii Podanenko
 
Analysis & Design Method for OSGi-based Development
Analysis & Design Method for OSGi-based DevelopmentAnalysis & Design Method for OSGi-based Development
Analysis & Design Method for OSGi-based Development
Linuxmalaysia Malaysia
 
Sitecore 9 - What's new?
Sitecore 9 - What's new?Sitecore 9 - What's new?
Sitecore 9 - What's new?
Adrian IORGU
 
PHP at Yahoo!
PHP at Yahoo!PHP at Yahoo!
PHP at Yahoo!
elliando dias
 
Automating Oracle Database deployment with Amazon Web Services, fabric, and boto
Automating Oracle Database deployment with Amazon Web Services, fabric, and botoAutomating Oracle Database deployment with Amazon Web Services, fabric, and boto
Automating Oracle Database deployment with Amazon Web Services, fabric, and boto
mjbommar
 
Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010
Agora Group
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Charles Moulliard
 
Mule Integration Simplified
Mule Integration SimplifiedMule Integration Simplified
Mule Integration Simplified
Bui Kiet
 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High Performance
Amjad Rafique
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the Future
Frank Greco
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
Peter Lubbers
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
brent bucci
 
Scaling wix.com to 100 million users
Scaling wix.com to 100 million users Scaling wix.com to 100 million users
Scaling wix.com to 100 million users
Aviran Mordo
 
Peter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-appsPeter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-apps
Skills Matter
 

Similar to turbocharge your php with nginx - errazudin - phpnw2010 (20)

Rise of the Planet of the Anonymous
Rise of the Planet of the AnonymousRise of the Planet of the Anonymous
Rise of the Planet of the Anonymous
 
Cooking security sans@night
Cooking security sans@nightCooking security sans@night
Cooking security sans@night
 
Jeff Rigby on Scaling Drupal in the Enterprise
Jeff Rigby on Scaling Drupal in the EnterpriseJeff Rigby on Scaling Drupal in the Enterprise
Jeff Rigby on Scaling Drupal in the Enterprise
 
Sulu and the Other Guys - Symfony Live Berlin 2015
Sulu and the Other Guys - Symfony Live Berlin 2015Sulu and the Other Guys - Symfony Live Berlin 2015
Sulu and the Other Guys - Symfony Live Berlin 2015
 
Scalable applications with HTTP
Scalable applications with HTTPScalable applications with HTTP
Scalable applications with HTTP
 
HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)HTML5 Offline Web Applications (Silicon Valley User Group)
HTML5 Offline Web Applications (Silicon Valley User Group)
 
Media mosa architecture - features -10 june 2010
Media mosa   architecture - features -10 june 2010Media mosa   architecture - features -10 june 2010
Media mosa architecture - features -10 june 2010
 
Analysis & Design Method for OSGi-based Development
Analysis & Design Method for OSGi-based DevelopmentAnalysis & Design Method for OSGi-based Development
Analysis & Design Method for OSGi-based Development
 
Sitecore 9 - What's new?
Sitecore 9 - What's new?Sitecore 9 - What's new?
Sitecore 9 - What's new?
 
PHP at Yahoo!
PHP at Yahoo!PHP at Yahoo!
PHP at Yahoo!
 
Automating Oracle Database deployment with Amazon Web Services, fabric, and boto
Automating Oracle Database deployment with Amazon Web Services, fabric, and botoAutomating Oracle Database deployment with Amazon Web Services, fabric, and boto
Automating Oracle Database deployment with Amazon Web Services, fabric, and boto
 
Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010Zitec+ +new business+-+3iun2010
Zitec+ +new business+-+3iun2010
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
 
Mule Integration Simplified
Mule Integration SimplifiedMule Integration Simplified
Mule Integration Simplified
 
Mobile Web High Performance
Mobile Web High PerformanceMobile Web High Performance
Mobile Web High Performance
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the Future
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
 
Scaling wix.com to 100 million users
Scaling wix.com to 100 million users Scaling wix.com to 100 million users
Scaling wix.com to 100 million users
 
Peter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-appsPeter lubbers-html5-offline-web-apps
Peter lubbers-html5-offline-web-apps
 

Recently uploaded

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 

Recently uploaded (20)

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 

turbocharge your php with nginx - errazudin - phpnw2010

  • 1. Turbocharge Your PHP with Nginx Errazudin Ishak www.mimos.my © 2009 MIMOS Berhad. All Rights Reserved.
  • 2. Agenda • me • “engine X” • nginx.conf • ..with PHP • Benchmark • Samples www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 3. "Apache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache." - Chris Lea, ChrisLea.com http://www.abacuspub.com/fsd/catalog/s574.htm www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 4. Me • Senior engineer @ Mimos Malaysia • Focuses on web application development, deployment, performance and stability. • 2009 : foss.my , MyGOSSCON • 2010 : Entp. PHP Techtalk, BarcampKL, PHP Meetup, MOSC2010 www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 5. www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 6. nginx • Free • X platform • open-source • (high-performance) • lightweight • HTTP server • reverse proxy • IMAP/POP3 proxy server www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 7. http://noisetu.be/mirrors/jet_beetle/ “I'm the author of nginx (pronounced "engine x")- Igor Sysoev (nginx creator) www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 8. http://image.importtuner.com/f/miscellaneous/new-tomei-turbo-kits-for-sr/29774779/tomei-bolt-on-turbo-kit-for-sr.jpg Load Balance Static Content, Index files Reverse Proxy (with cache) Streaming www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 9. http://www.litchfieldimports.co.uk/forum/gtr-engine-bay.jpg Loads of Request Less memory footprint Use less CPU C10K Certified www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 10. http://www.gtrblog.com/wp-content/uploads/2008/11/gtr-gt2-nurburgring-001.jpg Apache -------- ---------- Async model Processes Single Thread Threads Low Memory High Memory Less CPU CPU Overhead PHP as separate proc. PHP included as over FastCGI module (mod_php) www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 11. Numbers http://www.scoobyworld.co.uk/catalog/images/BFamber-1.jpg www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 12. Market Share for Top Servers Across All Domains 213,458,815 Source : Netcraft www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 13. Market Share for Top Servers Across the Million Busiest Sites Source : Netcraft www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 14. Market Share for Top Servers Across All Domains 227,225,642 Source : Netcraft www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 15. Market Share for Top Servers Across the Million Busiest Sites Source : Netcraft www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 16. http://www.autoguide.com/auto-news/wp-content/uploads/2010/09/The_Stig_Top_Gear_Eight.jpg Who? www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 17. Me uses nginx www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 18. Me uses nginx www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 19. We also.. www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 20. We all love nginx… www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 21. Modules Mail, 3rd Party Optional HTTP Standard HTTP Core www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 22. Modules Mail Core, Mail Auth, Mail Proxy, Mail SSL HTTP Addition, Emb. Perl, FLV, Gzip Precompression, Random Index, GeoIP, Real IP, SSL, Stub Status, Substitution, WebDAV, Google Perftools, XSLT, Secure Link, Image Filter HTTP Core, HTTP Upstream, HTTP Access, HTTP Auth Basic, HTTP Auto Index, Browser, Charset, Empty gif, FastCGI, Geo, Gzip, HTTP Headers, Index, HTTP Referer, HTTP Limit Zone, HTTP Limit Requests, Log, Map, Memchached, HTTP Proxy, Rewrite, SSI, User ID Main, Events www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 23. Nginx with PHP • FastCGI • PHP-FPM (FastCGI Process Manager) • Bundled with PHP 5.3.3 www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 24. Nginx with PHP : FastCGI • persistent processes, ability to handle multiple requests. • web server and gateway application communicate with sockets such as TCP • web server forwards the client request to the gateway and receives the response within a single connection • can be implemented on any platform with any programming language. www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 25. Nginx with PHP : FastCGI server { server_name mysite.com; listen 80; root /usr/share/mysite/www; index index.html; location / { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include fastcgi_params; } } www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 26. PHP-FPM • FastCGI Process Manager • Daemonizes PHP > background proc • provides a command-line script for managing PHP proc • configuration of FastCGI pools • enhances some of the FastCGI internals • increases error reporting • script termination www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 27. Benchmark http://www.myshutterspace.com/profile/AthonySaucedo www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 28. Benchmark : Specs • AMD Turion 64 • 1MB L2 Cache, 1.8 GHz • 1GB RAM • OS- Karmic Koala • (my old 4 y.o. Acer) www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 29. Benchmark : apacheBench • -n 5000 • -c 500 www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 30. Benchmark : nginx www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 31. Benchmark : apache (runs..) www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 32. Benchmark : apache (end) www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 33. Benchmark : Findings Apache 2.2.12 Nginx 0.7.62 Concurrency 500 500 Doc size 2195 bytes 2195 bytes Complete 100% 100% Request Req per secs 327 3003 Longest Req 15269ms 296ms www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 34. “Every nanoseconds count!” - My Big Boss (your boss also) http://geekonfilm.files.wordpress.com/2009/09/vader.jpg www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 35. Resources • http://wiki.nginx.org/Main • Nedelcu’s book http://goo.gl/67OA • http://php-fpm.org/ • http://nginx.org • #nginx www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 36. http://goo.gl/EbTI Demo www.mimos.my © 2010 MIMOS Berhad. All Rights Reserved.
  • 37. THANK YOU @errazudin http://joind.in/2067 * All images, logos and data are the copyright of their respective owners www.mimos.my © 2009 MIMOS Berhad. All Rights Reserved.