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

Large-scale websites performance optimisation t...

Large-scale websites performance optimisation tricks @IPC Spring 2017

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

May 30, 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 ✤ Systems Engineering PhD Student Georgiana Gligor @gbtekkie [email protected]
  2. ✤ ultra low cost airline ✤ clever airports strategy ✤

    own reservation system (no GDS) ✤ selling models: site, call centre THE CHALLENGE
  3. ✤ same good old cURL, but on steroids ✤ curl_init

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

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

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

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

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

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

    1 silo = all servers that deliver the end-to- end functionality DEFINITION
  10. traffic controller silo 1 silo 3 silo 2 availability reservations

    content repository content repository OVERVIEW
  11. INSIDE A SILO traffic dispatcher frontend frontend user cache static

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

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

    data middleware content repository middleware middleware /cache bwbjmbcjmjuz
  14. traffic controller variation A variation C variation B THEY'RE JUST

    VARIATIONS 3rd party API content internal API
  15. traffic controller variation A variation C variation B CACHE A/B

    TESTING no cache memcache redis 3rd party API content internal API
  16. 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