Optimization of web applications<br />An introduction<br />
Whois Sherif ?<br /><ul><li>Bachelor in Computer Science Concordia University
Worked for 3 years as a Web Developer
Then 2.5 years as a Perl Programmer handling large scale ecommerce web sites
Then for 2.5 years as Software Architect, Team Lead for (J2EE)
Worked for 2.5 years as IT Director, Software Architect at w.illi.am/ </li></li></ul><li>Overview<br />
Overview<br />How does Apache Prefork handle your request<br />Projects that #Failed<br />What I have learned<br />
Apache Prefork<br />
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Request on port 80<br />
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Request on port 80<br />ForkChild<br />Child Process...
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache Main Process<br />Request on port 80<br />For...
Request/Response Cycle (Apache Prefork)<br />Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache ...
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Requeston port 80<br />Child Process<br />
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Requeston port 80<br />Child Exists<br />Child Proce...
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache Main Process<br />Child Exists<br />Child Pro...
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
Past Failings<br />Conclusions<br />Minimize response time<br />Do not let the children hang<br />Don’t use to many childr...
How I #Failed<br />
Challenges : Component Failure<br /># Failure<br />Hardware failure<br />RAID fails<br />Node  in cluster fails<br />
Challenges : Component Failure<br /># Failure<br />Hardware failure<br />RAID fails<br />Node  in cluster fails<br />Learn...
Challenges : Peaks in traffic<br /># Failure<br />Successful marketing campaigns<br />Radio Station – 10 stations announce...
Challenges : Peaks in traffic<br /># Failure<br />Successful marketing campaigns<br />Radio Station – 10 stations announce...
Challenges : Peaks in traffic<br /># Failure<br />Important news events<br />
Challenges : Peaks in traffic<br /># Failure<br />Important news events<br />Learning : <br />Estimate your  peak  and des...
Challenges : Unproven code<br /># Failure<br />Third party libraries can go wrong<br />
Challenges : Unproven code<br /># Failure<br />Third party libraries can go wrong<br />Learning<br />Beware of 3rd party l...
Challenges : Unproven code<br /># Failure<br />Updated System libraries<br />Memcached client libraries update<br />GD2 Cl...
Challenges : Unproven code<br /># Failure<br />Updated System libraries<br />Memcached client libraries update<br />GD2 Cl...
Challenges : Stress tests<br /># Failure<br />Stress tests the false insurance<br />
Challenges : Stress tests<br /># Failure<br />Stress tests the false insurance<br />Learning<br />Correct planning of test...
Challenges : Conclusions<br />The 10 Conclusions<br />Design for 60% usage<br />Try to stagger your communications<br />So...
Understand your Software components
Understand your Human components
Understand your Marketing pushes</li></li></ul><li>How to optimize <br />
Optimization<br />Optimization is not about code<br />Optimization is not about RAIDed disks<br />Optimization is not abou...
Optimization<br />Optimization is not about code<br />Optimization is not about RAIDed disks<br />Optimization is not abou...
Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />
Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of...
Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of...
Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics</li></ul>Optimization starts wi...
Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics
Próxima SlideShare
Cargando en…5
×

Presentation confoo optimization_sherifzaroubi

694 visualizaciones

Publicado el

Publicado en: Educación, Tecnología
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Presentation confoo optimization_sherifzaroubi

  1. 1. Optimization of web applications<br />An introduction<br />
  2. 2. Whois Sherif ?<br /><ul><li>Bachelor in Computer Science Concordia University
  3. 3. Worked for 3 years as a Web Developer
  4. 4. Then 2.5 years as a Perl Programmer handling large scale ecommerce web sites
  5. 5. Then for 2.5 years as Software Architect, Team Lead for (J2EE)
  6. 6. Worked for 2.5 years as IT Director, Software Architect at w.illi.am/ </li></li></ul><li>Overview<br />
  7. 7. Overview<br />How does Apache Prefork handle your request<br />Projects that #Failed<br />What I have learned<br />
  8. 8. Apache Prefork<br />
  9. 9. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Request on port 80<br />
  10. 10. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Request on port 80<br />ForkChild<br />Child Process<br />
  11. 11. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache Main Process<br />Request on port 80<br />ForkChild<br />Child Process<br />SendRespond<br />
  12. 12. Request/Response Cycle (Apache Prefork)<br />Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache Main Process<br />Child Process<br />Child Process<br />
  13. 13. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Requeston port 80<br />Child Process<br />
  14. 14. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Requeston port 80<br />Child Exists<br />Child Process<br />
  15. 15. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Apache Main Process<br />Child Exists<br />Child Process<br />Child Process<br />
  16. 16. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
  17. 17. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
  18. 18. Request/Response Cycle (Apache Prefork)<br />Apache Main Process<br />Child Process<br />Child Process<br />
  19. 19. Past Failings<br />Conclusions<br />Minimize response time<br />Do not let the children hang<br />Don’t use to many children<br />
  20. 20. How I #Failed<br />
  21. 21. Challenges : Component Failure<br /># Failure<br />Hardware failure<br />RAID fails<br />Node in cluster fails<br />
  22. 22. Challenges : Component Failure<br /># Failure<br />Hardware failure<br />RAID fails<br />Node in cluster fails<br />Learning : <br />Design for 60% usage<br />KISS<br />
  23. 23. Challenges : Peaks in traffic<br /># Failure<br />Successful marketing campaigns<br />Radio Station – 10 stations announcement<br />TV Personality – News agency interviews<br />
  24. 24. Challenges : Peaks in traffic<br /># Failure<br />Successful marketing campaigns<br />Radio Station – 10 stations announcement<br />TV Personality – News agency interviews<br />Learning <br />Try to stagger your communications<br />Soft launch when you can<br />
  25. 25. Challenges : Peaks in traffic<br /># Failure<br />Important news events<br />
  26. 26. Challenges : Peaks in traffic<br /># Failure<br />Important news events<br />Learning : <br />Estimate your peak and design for it<br />
  27. 27. Challenges : Unproven code<br /># Failure<br />Third party libraries can go wrong<br />
  28. 28. Challenges : Unproven code<br /># Failure<br />Third party libraries can go wrong<br />Learning<br />Beware of 3rd party libraries<br />Profile all new code<br />Profile all new code<br />Profile all new code<br />
  29. 29. Challenges : Unproven code<br /># Failure<br />Updated System libraries<br />Memcached client libraries update<br />GD2 Client library update<br />
  30. 30. Challenges : Unproven code<br /># Failure<br />Updated System libraries<br />Memcached client libraries update<br />GD2 Client library update<br />Learning<br />Beware when updating production servers<br />Always have a Hot backup to rollback<br />
  31. 31. Challenges : Stress tests<br /># Failure<br />Stress tests the false insurance<br />
  32. 32. Challenges : Stress tests<br /># Failure<br />Stress tests the false insurance<br />Learning<br />Correct planning of test scenarios<br />Correct estimation of your traffics shape<br />Replicate a production environment as closely as possible<br />
  33. 33. Challenges : Conclusions<br />The 10 Conclusions<br />Design for 60% usage<br />Try to stagger your communications<br />Soft launch when you can<br /><ul><li>Estimate your peak and design for it</li></ul>Beware when updating production servers<br />Always have a Hot backup to rollback changes<br />Correct planning of test scenarios<br />Correct estimation of your traffics shape<br /><ul><li>Replicate a production environment</li></li></ul><li>Challenges : Conclusions<br />The 10 Conclusions<br />Design for 60% usage<br />Try to stagger your communications<br />Soft launch when you can<br /><ul><li>Estimate your peak and design for it</li></ul>Beware when updating production servers<br />Always have a Hot backup to rollback changes<br />Correct planning of test scenarios<br />Correct estimation of your traffics shape<br /><ul><li>Replicate a production environment</li></ul>Most importantly<br /><ul><li>Understand your Hardware components
  34. 34. Understand your Software components
  35. 35. Understand your Human components
  36. 36. Understand your Marketing pushes</li></li></ul><li>How to optimize <br />
  37. 37. Optimization<br />Optimization is not about code<br />Optimization is not about RAIDed disks<br />Optimization is not about software architecture<br />Optimization is not about caching systems<br />Optimization is not about load<br />
  38. 38. Optimization<br />Optimization is not about code<br />Optimization is not about RAIDed disks<br />Optimization is not about software architecture<br />Optimization is not about caching systems<br />Optimization is not about load<br />Optimization is about all the pieces working in unison <br />Optimization is an ongoing process<br />
  39. 39. Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />
  40. 40. Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />
  41. 41. Optimization : Finding the bottleneck<br />Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />Define your System metrics<br />Page load time<br />Page weight<br />Memory usage<br />CPU Usage<br />Load average<br />
  42. 42. Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics</li></ul>Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />Define your System metrics<br />Page load time<br />Page weight<br />Memory usage<br />CPU Usage<br />Load average<br />
  43. 43. Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics
  44. 44. Profile the code
  45. 45. CPU Time
  46. 46. Look at %</li></ul>Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />Define your System metrics<br />Page load time<br />Page weight<br />Memory usage<br />CPU Usage<br />Load average<br />
  47. 47. Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics
  48. 48. Profile the code
  49. 49. CPU Time
  50. 50. Look at %
  51. 51. Load test your system</li></ul>Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />Define your System metrics<br />Page load time<br />Page weight<br />Memory usage<br />CPU Usage<br />Load average<br />
  52. 52. Optimization : Finding the bottleneck<br /><ul><li>What is Normal ? Benchmark your metrics
  53. 53. Profile the code
  54. 54. CPU Time
  55. 55. Look at %
  56. 56. Load test your system
  57. 57. Tweak your system
  58. 58. Max Children
  59. 59. Spare Children
  60. 60. NFS settings
  61. 61. Caching
  62. 62. Session handling
  63. 63. Etc ...</li></ul>Optimization starts with Risk<br />Set the Assumptions<br /># Users<br />Mix of traffic<br />Connection speed<br />....<br />Define your System metrics<br />Page load time<br />Page weight<br />Memory usage<br />CPU Usage<br />Load average<br />
  64. 64. Optimization : Finding the bottleneck<br />Conclusion<br />I am more riskconscious<br />I think before I code<br />I profile, and profile, and profile<br />I define my test scenarios<br />Development environment as close as possible to the Production environment<br />I test my deployments<br />And always have a Plan B in case I forget something!<br />

×