1 / 34

The Definition Of Crazy Insanity

The Definition Of Crazy Insanity. Chris Porter D.O netw3rker Chris.porter@acquia.com. Who is this guy?. Chris Porter - chris.porter@acquia.com Technical Consultant – Acquia 8 years of Drupal Experience 4.5yrs Professional Services. Doesn’t learn from mistakes. Level 1: PHP is Crazy.

candie
Download Presentation

The Definition Of Crazy Insanity

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Definition Of Crazy Insanity Chris Porter D.O netw3rker Chris.porter@acquia.com

  2. Who is this guy? Chris Porter - chris.porter@acquia.com Technical Consultant – Acquia 8 years of Drupal Experience 4.5yrs Professional Services Doesn’t learn from mistakes

  3. Level 1: PHP is Crazy

  4. Nervous? Q: How many files does a single freshly installed Drupal page include? A: ~80 files Q: How many files does my current client’s “events” page include? A: 2830* (well, actually it was ~680)

  5. CRAZY: What about 1000 requests? How many times did PHP meet the definition of insane? Crazy = includes * (requests - 1) • Stock Drupal: 79,920 • My Client: 2,150,000 (!!!!) Actual traffic pattern for that client: 3MM page views per month! 100K per day!

  6. Crazy Medicine: PHP OPCode Caching Opcode Caching is hands down the: • Easiest • Fastest • Most over-looked Single performance improvement you can make. It makes the PHP engine *not crazy*

  7. OPCode Caching • Caches the pseudo compiled version of a file • Caches the filesystem permissions • Stores the cache in memory • Shares the memory with other PHP processes • Some even provide fast acting data memory space

  8. Use APC – Its Easy • Install APC • Add the following lines to your php.ini file extension=apc.so apc.enabled=1 apc.shm_segments=1 apc.shm_size=64 apc.stat=0 • Drink a beer More Detail at: https://drupal.org/node/1777090

  9. This Means its working!

  10. APC Magic in Action APC Configuration Applied 50s! 15s! Local doc root fix 300ms

  11. Level 2:Your code What you are probably doing that is totally bonkers.

  12. We’ve all done this at least once *This is not real code, I made it up entirely

  13. Lets break it down: 1 request results in: 1 db query + 100 service calls 1000 requests results in: 1000 db queries 100,000 service calls That’s a lot of crazy: about 99,900 to be exact.

  14. The Cure Try Drupal’s Cache APIhttps://api.drupal.org/api/drupal/includes%21cache.inc/7 Use the functions: cache_get() and cache_set() If you like data organization, implement your own cache table!

  15. Infrequent updates? Cache the whole thing!

  16. Now who’s crazy? • 1 request = 100 webservice calls • 1,000 requests = 100 webservice calls • 1,000,000 requests = 100 webservice calls • No more crazy here!

  17. Level 3: Drupal How you are configuring Drupal to be crazy

  18. Mass Delusion: You are making all of your users crazy Max simultaneous requests time gap

  19. Substantially reduce client requests

  20. Views Caching • Views Caching

  21. Panels Caching • Panels Caching

  22. Page Caching • Page Caching

  23. Level 4: Your Webserver Your webserver is acting crazier than you think. It probably has a gnarly case of OCD.

  24. 100 pages and 1,000,000 requests Q: How many times did Drupal “bootstrap”? A: 1,000,000 (at least) Q: What’s the definition of crazy here? A: Requests – Pages = CRAZY Your webserver was crazy 999,900 times!

  25. OCD Training: Front-end Caching Things to consider about front end caches: • Provide extremely fast content delivery • Take Drupal out of the equation for almost all requests. • Only works for anonymous users* (mostly)

  26. OCD Meds: Varnish • Install Varnish (*nix only) • Read Lullabot’s amazing varnish tutorial • Use Lullabot’s pre-written “high availability VCL” • Get Drupal’s Varnish Module • Configure Drupal’s page cache options. • Wonder where your server load went 

  27. Level 5: Your Infrastructure Your network is delivering the same content over and over again for no other reason than because it can. Your network needs a Quaalude.

  28. Deep thoughts: What happens if your servers network goes down? What happens if your systems fail? (it happens) Why should users in Japan get content delivered from Colorado? Ever wonder why websites say “server down” on one page, but not another?

  29. CDN’s to the rescue Content Delivery Networks distribute your content around the world. Main modes of operation: • Reverse Proxy – point your DNS at them, let the magic happen. • File Server – put static assets such as images up on the CDN– serve fewer requests.

  30. Pro’s • Rapidly scale your anonymous content globally • Deliver content in very short routes to consumers • Reduce the load on your server Con’s • You pay by the byte of data • Do it wrong, and you’ll pay for 2x the bytes of data • Clearing the cache can take a while Notes: • Somewhere around 150 endpoints to deal with

  31. Checking out You just made the front page of: • Reddit • Slashdot • Drudge report Are you still crazy?

  32. Calming Meds: Expected Traffic • The CDN will server all of that traffic except:100 pages * 150 endpoints = 15,000 requests. • Varnish will server all previously served page requests:15,000 – 100 unique pages = 4,900 requests • Drupal will bootstrap: 100 times • PHP will include: 698 files [SANE]

  33. Summary: Main problem areas • PHP – Lack of Opcode Caching • Code – Cache things you should only do once • Webserver – Use Compression • Cluster – Use reverse proxy caching • Cloud – Use a CDN

  34. That’s It! Questions? Resources: • Lullabot’s Varnish Writuphttp://www.lullabot.com/blog/article/configuring-varnish-high-availability-multiple-web-servers • Configure APC for Drupal: https://drupal.org/node/1777090 • CDN Discussions: http://wimleers.com/article/key-properties-of-a-cdn • Drupal Cache API: https://api.drupal.org/api/drupal/includes%21cache.inc/7 • Drupal Performance Tips: http://www.achieveinternet.com/enterprise-drupal-blogs/enterprise-drupal-performance-caching-hosting/5-things-you-can-do-improve-performance-and-scal

More Related