The connection between sub-second web application performance and revenue is becoming more and more apparent with established companies regularly reporting the benefits of reducing page load times.
This talk will cover:
* Designing for performance
* Approaches to instrumenting and measuring application performance
* Areas of focus for both front-end and back-end improvement
* Techniques, tools and modules available in Django-land for improving performance
* New and emerging technologies, for example SPDY protocol and Django 1.5's StreamingHttpResponse
ICT role in 21st century education and its challenges
Â
The life of a web request - techniques for measuring and improving Django application performance
1. The Life of a Web Request
Measuring and improving
Django application performance
PyCon Australia 2013
Roger Barnes
@mindsocket
roger@mindsocket.com.au
http://slideshare.net/mindsocket/
2. What are you here for
Aspects of site performance
Measuring everything
Fixing the right thing
AND HOW
3. Performance focus for this talk
â user perspective
â seconds per request
â benchmarks
â users per server
â requests per second
4.
5. Why should we care?
â Web application performance affects
â engagement
6. Why should we care?
â Web application performance affects
â engagement
â bounce rate
http://www.slideshare.net/joshfraz/sept-2012rumtalk
7. Why should we care?
â Web application performance affects
â engagement
â bounce rate
â conversion/abandonment
8. Why should we care?
â Web application performance affects
â engagement
â bounce rate
â conversion/abandonment
â search engine ranking
9. Why should we care?
â Web application performance affects
â engagement
â bounce rate
â conversion/abandonment
â search engine ranking
â revenue
10. Why should we care?
Web sites are
larger
&
than ever
11. Why should we care?
Average web page:
1.3Mb
85 requests
- HTTPArchive.org
12. Why should we care?
Users are increasingly mobile
Their expectations are up
Many "responsive" sites are
no smaller than their desktop
version
19. The Performance Golden Rule
"80-90% of the end-user response time
is spent on the frontend.
Start there."
- Steve Souders
Source: http://www.stevesouders.com/blog/2012/02/10/the-performance-golden-rule/
39. Query Performance
â Use debug toolbar
â Avoid unnecessary queries
â eg exists followed by separate get
â select_related to get FKs in same query
â Be wary of optional foreign keys
â prefetch_related to get collections
â 1 additional query instead of N+1
43. Web server
WSGI application (WSGIHandler.__call__)
Initialise request
Get Response (BaseHandler.get_response)
URL Resolution
Request Middleware Response Middleware
View Middleware Template Response Middleware
View Template rendering
Backend services
Django Works Then Responds
Bytes on the wire
(Time to First Byte)
Back end
44. Can we stream?
â StreamingHttpResponse in 1.5
â Patch for streaming templates (#13910)
â Caveats
â Middleware compatibility
â Exception handling
â YAGNI?
45. What about eager streaming?
Hack: View middleware that streams the top of a
page before even calling the view
Proof of concept:
https://github.com/mindsocket/
django-perf-example