Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Large-scale websites performance optimisation tricks @CodeCampTalks Iasi

Large-scale websites performance optimisation tricks @CodeCampTalks Iasi

Practical lessons learned while revamping a US airline website to resist huge Black Friday and Cyber Monday traffic values. Using HTTP status codes and PHP cleverly, we have made parallel requests possible, so that the user experience is greatly enhanced, and we pre-cache resource-consuming user searches. All on a solid PHP foundation.

Georgiana Gligor

September 10, 2017
Tweet

More Decks by Georgiana Gligor

Other Decks in Technology

Transcript

  1. 2 ✤ Geek. Mother. Do-er. ✤ I bring old apps

    to life ✤ PHP Cluj Meetup ✤ RomaniaPHP ✤ PhD Student Georgiana Gligor @gbtekkie [email protected]
  2. 5 ✤ ultra low cost airline ✤ clever airports strategy

    ✤ own reservation system (no GDS) ✤ selling models: site, call centre THE CHALLENGE
  3. 8 ✤ destination-centred travel experience ✤ scalability ✤ withstand Cyber

    Monday test ✤ narrow delivery timeframe REQUIREMENTS
  4. ✤ same good old cURL, but on steroids ✤ curl_init

    -> curl_multi_init ✤ async process multiple cURL handles
  5. 28 ADVANTAGES ✤ discuss contracts before writing code ✤ eliminates

    problems early on ✤ developers work independently ✤ test components separately
  6. ✤ HTTP status code 204 ✤ success code ✤ Content-Length:

    0 ✤ acknowledge request and continue ✤ client can continue processing
  7. 34 public function batchProcess($data) { // 1 - check permissions

    // 2 - validate user data } NOT ONLY FOR FRONTEND
  8. 35 NOT ONLY FOR FRONTEND public function batchProcess($data) { //

    1 - check permissions // 2 - validate user data // 3 - return 204 No Content }
  9. 36 public function batchProcess($data) { // 1 - check permissions

    // 2 - validate user data // 3 - return 204 No Content // 4 - process batch } NOT ONLY FOR FRONTEND
  10. 41 ✤ frontend (Javascript SPAs) ✤ backend (PHP services) ✤

    cache 1 silo = all servers that deliver the end-to- end functionality DEFINITION
  11. 42 traffic controller silo 1 silo 3 silo 2 availability

    reservations content repository content repository OVERVIEW
  12. 43 INSIDE A SILO traffic dispatcher frontend frontend user cache

    static data middleware content repository middleware middleware
  13. 44 INSIDE A SILO traffic dispatcher frontend frontend user cache

    static data middleware content repository middleware middleware /cache
  14. 45 INSIDE A SILO traffic dispatcher frontend frontend user cache

    static data middleware content repository middleware middleware /cache bwbjmbcjmjuz
  15. 46 traffic controller variation A variation C variation B THEY'RE

    JUST VARIATIONS 3rd party API content internal API
  16. 47 traffic controller variation A variation C variation B CACHE

    A/B TESTING no cache memcache redis 3rd party API content internal API
  17. 48 traffic controller variation A variation C variation B PAINLESS

    CODE UPGRADES v11.4.7 v11.4.8 v12.0.1 3rd party API content internal API