$30 off During Our Annual Pro Sale. View Details »

Large-scale websites performance optimisation tricks. Airline case study. @ZendCon

Large-scale websites performance optimisation tricks. Airline case study. @ZendCon

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

October 21, 2016
Tweet

More Decks by Georgiana Gligor

Other Decks in Technology

Transcript

  1. LARGE-SCALE WEBSITES
    PERFORMANCE OPTIMISATION TRICKS
    Georgiana Gligor / @gbtekkie
    Airline case study

    View Slide

  2. 2
    ✤ Geek. Mother. Do-er.
    ✤ Crafting enterprise apps
    ✤ Large-Scale Application
    Architect
    ✤ PHP Cluj Meetup Organiser
    ✤ Systems Engineering PhD
    Student
    Georgiana Gligor
    @gbtekkie
    [email protected]

    View Slide

  3. The
    Challenge
    Enterprise
    Architecture
    The
    Tricks
    Lessons
    Learned
    OUTLINE 3

    View Slide

  4. THE
    CHALLENGE

    View Slide

  5. ✤ ultra low cost airline
    ✤ clever airports strategy
    ✤ own reservation system (no GDS)
    ✤ selling models: site, call centre
    5
    THE CHALLENGE

    View Slide

  6. 6
    TODAY

    View Slide

  7. 7
    LEGACY

    View Slide

  8. ✤ destination-centred travel experience
    ✤ scalability
    ✤ withstand Cyber Monday test
    ✤ narrow delivery timeframe
    8
    REQUIREMENTS

    View Slide

  9. 9
    CONSTRAINTS
    https://youtu.be/MQm5BnhTBEQ

    View Slide

  10. CONSTRAINTS 10

    View Slide

  11. 11
    CONSTRAINTS

    View Slide

  12. (1) booking path
    (2) online check-in
    (3) Cyber Monday preparation
    12
    MILESTONES

    View Slide

  13. ENTERPRISE
    ARCHITECTURE

    View Slide

  14. 14
    Legacy as data
    LEGACY AS DATA

    View Slide

  15. 15
    RESTful services access data
    CONTENT REPOSITORIES

    View Slide

  16. 16
    ISOLATE HIGH-TRAFFIC

    View Slide

  17. 17
    ISOLATE HIGH-TRAFFIC

    View Slide

  18. 18
    Web-facing components
    HIGH-TRAFFIC COMPONENTS

    View Slide

  19. THE
    TRICKS

    View Slide

  20. 20
    #1: STATIC DATA

    View Slide

  21. 21
    #1: STATIC DATA

    View Slide

  22. Parallel PHP
    https://flic.kr/p/53kGFW
    22
    #2: PARALLELISM

    View Slide

  23. 23
    Parallel PHP
    #2: PARALLELISM
    ✤ same good old cURL, but on steroids
    ✤ curl_init -> curl_multi_init
    ✤ async process multiple cURL handles

    View Slide

  24. 24
    #2: PARALLELISM

    View Slide

  25. 25
    Fixture-based development
    #3: FIXTURES
    ✤ discuss contracts before actual coding
    ✤ eliminates problems early on
    ✤ developers work independently
    ✤ test components separately

    View Slide

  26. 26
    #3: FIXTURES

    View Slide

  27. 27
    #4: 204 TRICK
    ✤ HTTP status code 204
    ✤ success code
    ✤ Content-Length: 0
    ✤ backend ack request and continues
    ✤ client can continue processing

    View Slide

  28. 28
    #4: 204 TRICK

    View Slide

  29. 29
    #4: 204 TRICK
    public function batchProcess($data) {
    }

    View Slide

  30. 30
    #4: 204 TRICK
    public function batchProcess($data) {
    // 1 - check permissions
    }

    View Slide

  31. 31
    #4: 204 TRICK
    public function batchProcess($data) {
    // 1 - check permissions
    // 2 - validate user data
    }

    View Slide

  32. 32
    #4: 204 TRICK
    public function batchProcess($data) {
    // 1 - check permissions
    // 2 - validate user data
    // 3 - return 204 No Content
    }

    View Slide

  33. 33
    #4: 204 TRICK
    public function batchProcess($data) {
    // 1 - check permissions
    // 2 - validate user data
    // 3 - return 204 No Content
    // 4 - process batch
    }

    View Slide

  34. 34
    #4: 204 TRICK

    View Slide

  35. 35
    #4: 204 TRICK

    View Slide

  36. 36
    Departments inside a
    company don’t work
    together.
    - Silo Mentality
    #5: SILOS

    View Slide

  37. ✤ frontend (Drupal, Javascript SPAs)
    ✤ backend (PHP services)
    ✤ cache
    37
    #5: SILOS
    1 silo = full setup of servers that deliver
    the end-to-end functionality

    View Slide

  38. 38
    #5: SILOS

    View Slide

  39. 39
    #5: SILOS

    View Slide

  40. 40
    #5: SILOS

    View Slide

  41. 41
    #5: SILOS

    View Slide

  42. 42
    #5: SILOS

    View Slide

  43. 43
    #5: SILOS

    View Slide

  44. 44
    #5: SILOS

    View Slide

  45. 45
    #5: SILOS

    View Slide

  46. 46
    #5: SILOS

    View Slide

  47. LESSONS
    LEARNED

    View Slide

  48. ✤ static data
    ✤ parallelism
    ✤ fixtures
    ✤ 204 trick
    ✤ silos
    48

    View Slide

  49. Q & A
    @gbtekkie
    https:/
    /joind.in/talk/d9f66

    View Slide

  50. Georgiana Gligor
    50
    THANK YOU

    View Slide