Your SlideShare is downloading. ×
0
Оптимизируем Drupal
                                Aleksey Khodakovskiy
                                               Ad...
Predicting peak traffic
         Traffic over the day can be highly irregular. To plan
         for peak loads, design as if a...
Analyzing hit distribution
                                                                                               ...
Throughput vs. Delivery Methods
                                                       Yellow
                            ...
Layering: Less Traffic at Each Step

                    Your Datacenter



                      Load                Revers...
Offload from the master database
                     Search       Your master database is the
                             ...
Relative importance
                              Processors/Cores             Memory                             Disk Spe...
All of your servers
     ‣   64-bit: no excuse to use anything less in 2010
     ‣   RHEL/CentOS and Ubuntu have the broad...
Reverse proxy caches
     ‣   Varnish and nginx have modern architecture and
         broad adoption
          ‣   Sites o...
Web servers
     ‣ Apache 2.2 + mod_php + memcached
     ‣ FastCGI is a bad idea
          ‣   Memory improvements are red...
Database servers
    ‣   Insist on MySQL 5.1+ and InnoDB
    ‣   Consider Percona builds and (eventually) MariaDB
    ‣   ...
Assembling the numbers
     ‣   Start with an architecture providing redundancy.
          ‣   Two servers, each running t...
Offline processing
     ‣   Gearman
          ‣   Primarily asynchronous job manager
     ‣   Hadoop
          ‣   MapReduce...
Edge-side includes
      <html>
      <body>
                                                                  ‣   Blocks ...
HipHop PHP
     ‣   Compiles PHP to a C++-based binary
          ‣   Integrated HTTP server
     ‣   Supports a subset of ...
Оптимизируем Друпал (Pressflow):
               https://launchpad.net/pressflow
что уже разработано и внедрено:
* Lazy ses...
Сравнение Pressflow с разными
          версиями Drupal:

https://wiki.fourkitchens.com/display/PF/Comparison+-+Pressflow+...
Caching: Modules that make
       Drupal scale:

http://groups.drupal.org/node/21897




                       Оптимизиру...
Tuning:
APC: https://wiki.fourkitchens.com/display/PF/Tuning+APC


                             DB:
  * Indexes: http://gr...
Front end optimisation modules:
http://groups.drupal.org/node/57563
http://drupal.org/node/266179 -> Comparison of CSS Pre...
=================================
All about optimization: http://drupal.org/node/326504
=================================
...
Upcoming SlideShare
Loading in...5
×

Drupal Optimization

4,164

Published on

--------------------------------------------------
Aleksey Khodakovskiy
Adyax
38 rue N-D De Nazareth, 75003 Paris
Ligne directe : +33 1 76 77 34 65
Standard : +33 1 76 77 34 60
Mobile : +33 6 37 47 45 83
Email : akhodakovskiy@adyax.com
--------------------------------------------------

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,164
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
56
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Transcript of "Drupal Optimization"

  1. 1. Оптимизируем Drupal Aleksey Khodakovskiy Adyax 38 rue N-D De Nazareth, 75003 Paris Ligne directe : +33 1 76 77 34 65 Standard : +33 1 76 77 34 60 Mobile : +33 6 37 47 45 83 Email : akhodakovskiy@adyax.com
  2. 2. Predicting peak traffic Traffic over the day can be highly irregular. To plan for peak loads, design as if all traffic were as heavy as the peak hour of load in a typical month — and then plan for some growth. David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  3. 3. Analyzing hit distribution 40% 30% a n t H um en nt Co 50% 3% ic at St me n t at Tre W wl C 100% l eb er ra ia s c pe ou S No m 10% ny Dy ag no “Pay na es W P Byp all” A m ass 7% ic 70% Auth entica ted 20% David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  4. 4. Throughput vs. Delivery Methods Yellow Green Red (Dynamic, (Static) (Dynamic) Cacheable) Content Delivery 2 Network ●●●●●●●●●● ✖ ✖ Reverse Proxy Cache ●●●●●●●● ●●●●●●● ✖ 5000 req/s PHP + APC + 1 ●●●● ●●● ●●● memcached 1 PHP + APC ●●●● ●● ●● 1 PHP (No APC) ●●●● ● ● 10 req/s 1 Delivered by Apache without PHP More dots = More throughput 2 Some actually can do this. David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  5. 5. Layering: Less Traffic at Each Step Your Datacenter Load Reverse Traffic Proxy Application Balancer Cache Server DNS Round Robin CDN Database David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  6. 6. Offload from the master database Search Your master database is the single greatest limitation on scalability. Application Slave Server Database Master Memory Cache Database David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  7. 7. Relative importance Processors/Cores Memory Disk Speed Reverse Proxy Cache ●● ●●● ●● Web Server ●●●●● ●● ● Database Server ●●● ●●●● ●●●● Monitoring ● ● ● David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  8. 8. All of your servers ‣ 64-bit: no excuse to use anything less in 2010 ‣ RHEL/CentOS and Ubuntu have the broadest adoption for large-scale LAMP ‣ But pick one, and stick with it for development, staging, and production ‣ Some disk redundancy: rebuilding a server is time-consuming unless you’re very automated David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  9. 9. Reverse proxy caches ‣ Varnish and nginx have modern architecture and broad adoption ‣ Sites often front Varnish with nginx for gzip and/or SSL ‣ Squid and Traffic Server are clunky but reliable alternatives + + CPU Memory Disk 1 GB base system Slow Save Your + 3 GB for caching + Small Money + Redundant David Strauss = 5000 req/s Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  10. 10. Web servers ‣ Apache 2.2 + mod_php + memcached ‣ FastCGI is a bad idea ‣ Memory improvements are redundant w/ Varnish Higher latency + less efficient with APC opcode ‣ ‣ Check the memory your app takes per process ‣ Tune MaxClients to around 25 × cores + + CPU Memory Disk Max out 1 GB base system Slow cores + 1 GB memcached + Small (but prefer fast cores to density) + 25 × cores × per- + Redundant process app memory David Strauss = 100 req/s Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  11. 11. Database servers ‣ Insist on MySQL 5.1+ and InnoDB ‣ Consider Percona builds and (eventually) MariaDB ‣ Every Apache process generally needs at least one connection available, and leave some headroom ‣ Tune the InnoDB buffer pool to at least half of RAM + + CPU Memory Disk No more As much as you can Fast than 8-12 afford (even RAM not + Large cores used by MySQL caches + Redundant disk content) David Strauss = 3000 queries/s Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  12. 12. Assembling the numbers ‣ Start with an architecture providing redundancy. ‣ Two servers, each running the whole stack ‣ Increase the number of proxy caches based on anonymous and search engine traffic. ‣ Increase the number of web servers based on authenticated traffic. ‣ Databases are harder to predict, but large sites should run them on at least two separate boxes with replication. David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  13. 13. Offline processing ‣ Gearman ‣ Primarily asynchronous job manager ‣ Hadoop ‣ MapReduce framework ‣ Traditional message queues ‣ ActiveMQ + Stomp is easy from PHP ‣ Allows you to build your own job manager David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  14. 14. Edge-side includes <html> <body> ‣ Blocks of HTML are <esi:include href=“http://drupal.org/block/views/3” /> </body> integrated into the </html> page at the edge layer. <div> ESI Processor (Varnish, Akamai, other) My block HTML. </div> ‣ Non-primary page content often occupies >50% of <html> PHP execution time. <body> <div> My block HTML. ‣ Decouples block </div> </body> and page cache </html> lifetimes Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  15. 15. HipHop PHP ‣ Compiles PHP to a C++-based binary ‣ Integrated HTTP server ‣ Supports a subset of PHP and extensions ‣ Requires an organizational commitment to building, testing, and deploying on HipHop ‣ Scott MacVicar has a presentation on HipHop later today at 16:00. David Strauss Wed 2010-06-09 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  16. 16. Оптимизируем Друпал (Pressflow): https://launchpad.net/pressflow что уже разработано и внедрено: * Lazy session creation (no sessions for anonymous users) * Fast access checks (access denied slow query) * Database repli cation (master/slave) * External page cache (reverse proxy support) * Fast path alias detection (drupal_lookup_path() optimization) * Native JSON encoding в скором будущем будет внедрено: https://blueprints. launchpad.net/pressflow * Path caching * Distributed menu tree generation and caching * HipHop PHP Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  17. 17. Сравнение Pressflow с разными версиями Drupal: https://wiki.fourkitchens.com/display/PF/Comparison+-+Pressflow+versus+Drupal Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  18. 18. Caching: Modules that make Drupal scale: http://groups.drupal.org/node/21897 Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  19. 19. Tuning: APC: https://wiki.fourkitchens.com/display/PF/Tuning+APC DB: * Indexes: http://groups.drupal.org/node/57213 via module: http://drupal.org/project/dbtuner * MySQL оптимизация: http://drupal.org/node/85768 * MySQL for Drupal: http://drupal.org/node/51263 * MyISAM -> InnoDB if SELECTs are blocked by INSERTs/UPDATEs * partitioning, memory tables Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  20. 20. Front end optimisation modules: http://groups.drupal.org/node/57563 http://drupal.org/node/266179 -> Comparison of CSS Preprocessors Решения: Boost + Nginx (может быть использовам вместо Apache) для анонимного трафика Authcach: + Memcached для авторизированного трафика + Boost для анонимного трафика Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  21. 21. ================================= All about optimization: http://drupal.org/node/326504 ================================= Drupal Group: High performance: http://groups.drupal.org/high-performance при подготовке доклада использованы материалы, представленные David Strauss на DrupalCamp Stockholm (May 19, 2010). -------------------------------------------------- Aleksey Khodakovskiy Adyax 38 rue N-D De Nazareth, 75003 Paris Ligne directe : +33 1 76 77 34 65 Standard : +33 1 76 77 34 60 Mobile : +33 6 37 47 45 83 Email : akhodakovskiy@adyax.com Оптимизируем Drupal. Aleksey Khodakovskiy DrupalCamp Kyiv 2010
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×