Large-scale websites performance optimisation tricks @IPC Spring 2017

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.

84cfe0e14cd3fdf8d1b2ef8223d99619?s=128

Georgiana Gligor

May 30, 2017
Tweet

Transcript

  1. LARGE-SCALE WEBSITES PERFORMANCE OPTIMISATION TRICKS Georgiana Gligor / Tekkie Consulting

    / @gbtekkie
  2. 2 ✤ Geek. Mother. Do-er. ✤ I bring old apps

    to life ✤ PHP Cluj Meetup ✤ Systems Engineering PhD Student Georgiana Gligor @gbtekkie gb@tekkie.ro
  3. the challenge enterprise architecture the tricks lessons learned

  4. THE CHALLENGE

  5. ✤ ultra low cost airline ✤ clever airports strategy ✤

    own reservation system (no GDS) ✤ selling models: site, call centre THE CHALLENGE
  6. LEGACY

  7. TODAY

  8. ✤ destination-centred travel experience ✤ scalability ✤ withstand Cyber Monday

    test ✤ narrow delivery timeframe REQUIREMENTS
  9. CONSTRAINTS https://youtu.be/MQm5BnhTBEQ

  10. CONSTRAINTS

  11. CONSTRAINTS

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

    MILESTONES
  13. ENTERPRISE ARCHITECTURE

  14. LEGACY AS DATA

  15. CONTENT REPOSITORIES

  16. ISOLATE HIGH-TRAFFIC

  17. ISOLATE HIGH-TRAFFIC

  18. HIGH-TRAFFIC COMPONENTS

  19. TRICK #1: PARTITION DATA

  20. None
  21. None
  22. TRICK #2: IN PARALLEL

  23. ✤ same good old cURL, but on steroids ✤ curl_init

    -> curl_multi_init ✤ async process multiple cURL handles
  24. None
  25. TRICK #3: FIXTURES

  26. component gjyuvsf gjyuvsf

  27. component component

  28. ADVANTAGES ✤ discuss contracts before writing code ✤ eliminates problems

    early on ✤ developers work independently ✤ test components separately
  29. TRICK #4: "204 TRICK"

  30. ✤ HTTP status code 204 ✤ success code ✤ Content-Length:

    0 ✤ acknowledge request and continue ✤ client can continue processing
  31. None
  32. public function batchProcess($data) { } NOT ONLY FOR FRONTEND

  33. public function batchProcess($data) { // 1 - check permissions }

    NOT ONLY FOR FRONTEND
  34. public function batchProcess($data) { // 1 - check permissions //

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

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

    2 - validate user data // 3 - return 204 No Content // 4 - process batch } NOT ONLY FOR FRONTEND
  37. LIVE DEBUGGING

  38. LIVE DEBUGGING

  39. TRICK #5: SILOS

  40. Departments inside a company don’t work together. Silo Mentality

  41. ✤ frontend (Javascript SPAs) ✤ backend (PHP services) ✤ cache

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

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

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

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

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

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

    TESTING no cache memcache redis 3rd party API content internal API
  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
  49. traffic controller AWS Google Rackspace MULTI-CLOUD 3rd party API content

    internal API
  50. SUMMARY

  51. 51 #1: partition data #2: parallel execution #3: fixtures #4:

    204 trick #5: silos
  52. QUESTIONS? } Affordable quality system architecture. In-house polyglot trainings. @gbtekkie

    https:/ /tekkie.ro/