Speed is a feature PyConAr 2014

Pablo Mouzo
Pablo MouzoSoftware Developer at Adaptive
This slide was intentionally left blank
Speed is a feature
A mystical journey through Django performance
optimization techniques, tools and gotchas
@martinblech @polmuz
Roadmap
How to find performance problems
Sneak peak: Front-end performance
How to fix them in Django
Why?
[Google] found that Half a
second delay caused a 20% drop
in traffic.
[Amazon] found that even very
small delays would result in
substantial and costly drops in
revenue.
Users really respond to speed
2006
There’s nothing like data
Don’t start with the code. Profile and gather real usage data.
There’s nothing like real data
Identify bottlenecks
New Relic
Very good
Very paid
Google Analytics
Free of charge
Less detail
Your logs
No data to third parties
Harder to use
Profiling
Complex setup required
Overhead
New Relic
New Relic
Google Analytics Site Speed
There’s nothing like data
Let’s find the culprit!
django-debug-toolbar
django-debug-toolbar-template-timings
Time all the things!
Typical backend bottlenecks
Database
External Services
CPU Intensive task
Template Rendering
Database
Missing index
Big, unused fields
Excessive # of queries
Order
Missing Index
class Comment(Model):
...
created_at = DateTimeField(db_index=True)
blogpost = ForeignKey(Blogpost)
class Meta:
index_together = [
["created_at", "blogpost"],
]
select_related()
>>> for c in Comment.objects.all():
print c.user.name
# select * from comments;
# select * from users where id = 1;
# select * from users where id = 2;
...
>>> comments = Comment.objects.all();
>>> for c in comments.select_related(“user”):
print c.user.name
# select comments.*, users.*
# from comments, users
# where comments.user_id = users.id;
prefech_related()
>>> for u in User.objects.filter(id__lt=10):
print len(u.comments.all())
# select * from users;
# select * from comments where user_id = 1;
# select * from comments where user_id = 2;
...
>>> users = User.objects.filter(id__lt=10)
>>> for u in users.prefetch_related(“comments”):
print len(u.comments.all())
# select * from users where id < 10;
# select * from comments
# where user_id in (1,2,3,4,5,6,7,8,9);
## Joins them in python
Demo
Background Jobs
Celery
from celery import task
@task
def send_confirmation_email(user_id):
...
def signup(req):
...
send_confirmation_email.delay(req.user.id)
return HttpResponseRedirect(“/home/”)
Template Compilation
Use
django.template.loaders.cached.Loader
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
Template Fragment Caching
{% load cache %}
{% cache 500 “last_comments” %}
.. last comments ..
{% endcache %}
{% load cache %}
{% cache 500 “my_recent_comments” user.id %}
.. user’s recent comments ..
{% endcache %}
Caching!
Per view cache
from django.views.decorators.cache import
cache_page
@cache_page(60 * 15) # seconds
def my_view(request):
...
Caching!
Per view cache
Gotchas:
User-specific content
CSRF token
Caching!
Low level cache API
>>> from django.core.cache import get_cache
>>> cache = get_cache('default')
>>> cache.set('my_key', 'hello, world!', 30)
>>> cache.get('my_key')
>>> from django.core.cache import caches
>>> cache = caches['default']
Caching!
from django.core.cache import get_cache
cache = get_cache('default')
def last_comments(request):
comments_ids = cache.get('last_comments')
if comments_ids:
comments = Comment.objects.filter(id__in=comments_ids)
else:
comments = fetch_last_comments()
comments_ids = [c.id for c in comments]
cache.set('last_comments', comments_ids)
...
Low level cache API
Cache Invalidation
“There are two hard things in computer
science: cache invalidation, naming
things, and off-by-one errors.”
post_save/post_delete are a good place
to start, but it doesn’t end there!
@receiver(post_save, sender=Comment)
@receiver(post_delete, sender=Comment)
def invalidate_last_comments(sender, **kwargs):
cache.delete('last_comments')
Caching!
Django Cacheback
from cacheback.decorators import cacheback
@cacheback
def fetch_last_comments_ids():
...
def last_comments(request):
comments_ids = fetch_last_comments_ids()
comments = Comment.objects.filter(id__in=comments_ids)
...
Don’t forget about the browser
80% or more of the end-user response
time is spent in the front end
Combine
Compress
Cache
Less is more
Load slow things later
Focus on making the
important things faster
Don’t forget about the browser
Google PageSpeed Insights
webpagetest.org
Chrome & Firefox
Assets
Django Compressor
{% compress js %}
<script src="/static/js/one.js"></script>
<script>obj.value = "value";</script>
{% endcompress %}
Django Assets
{% assets "js_all" %}
<script async src="{{ ASSET_URL }}"></script>
{% endassets %}
Assets
aload.js
<script data-aload="http://foo.com/foo.js"></script>
<link data-aload="http://foo.com/foo.css" rel="stylesheet">
Assets
Shameless plug: django-critical
{% critical %}
<link rel="stylesheet" href="bootstrap.min.css">
{% endcritical %}
Alpha stage, use at your own risk!
Q & Maybe A
References
Performance is a feature - http://blog.codinghorror.com/performance-is-a-feature/
Marissa Mayer at Web 2.0 - http://glinden.blogspot.com.ar/2006/11/marissa-mayer-at-web-20.html
Psychology of Web Performance - http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/
New Relic - http://newrelic.com
Google Analytics - http://www.google.com/analytics/
Tracking Application Response Time with Nginx - http://lincolnloop.com/blog/tracking-application-response-time-nginx/
Logging Apache response times - http://www.moeding.net/archives/33-Logging-Apache-response-times.html
Django Debug Toolbar - http://django-debug-toolbar.readthedocs.org/
DDT Template Timings - https://github.com/orf/django-debug-toolbar-template-timings
Django Database Optimizations - https://docs.djangoproject.com/en/1.7/topics/db/optimization/
Two Hard Things - http://martinfowler.com/bliki/TwoHardThings.html
Django Cache Docs - https://docs.djangoproject.com/en/1.7/topics/cache/
Django Cacheback - http://django-cacheback.readthedocs.org/en/latest/index.html
Cached Templates - https://docs.djangoproject.com/en/1.7/ref/templates/api/#django.template.loaders.cached.Loader
Google PageSpeed Insights - https://developers.google.com/speed/pagespeed/insights/
Web Page Test - http://www.webpagetest.org/
Django Compressor - http://django-compressor.readthedocs.org/en/1.3/
Django Assets - http://django-assets.readthedocs.org/en/0.8/
aload.js - https://github.com/pazguille/aload
django-critical - https://github.com/martinblech/django-critical
Demo - https://github.com/martinblech/pyconar2014_perfdemo
1 of 33

Recommended

Speed is a feature - Django Meetup Buenos Aires June 2014 by
Speed is a feature - Django Meetup Buenos Aires June 2014Speed is a feature - Django Meetup Buenos Aires June 2014
Speed is a feature - Django Meetup Buenos Aires June 2014Pablo Mouzo
625 views28 slides
Authentication by
AuthenticationAuthentication
Authenticationsoon
893 views45 slides
Google by
GoogleGoogle
Googlesoon
978 views41 slides
Deploying by
DeployingDeploying
Deployingsoon
1.1K views39 slides
JavaServer Pages by
JavaServer Pages JavaServer Pages
JavaServer Pages profbnk
251 views55 slides
Acts As Most Popular by
Acts As Most PopularActs As Most Popular
Acts As Most PopularWolfram Arnold
491 views15 slides

More Related Content

What's hot

Java script programms by
Java script programmsJava script programms
Java script programmsMukund Gandrakota
451 views29 slides
The Future of CSS with Web Components by
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web ComponentsColdFusionConference
390 views45 slides
Cache Money Talk: Practical Application by
Cache Money Talk: Practical ApplicationCache Money Talk: Practical Application
Cache Money Talk: Practical ApplicationWolfram Arnold
1.1K views34 slides
The Big Picture and How to Get Started by
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Startedguest1af57e
1.6K views47 slides
Opensocial Codelab by
Opensocial CodelabOpensocial Codelab
Opensocial CodelabPieter De Schepper
506 views14 slides
Micro app-framework by
Micro app-frameworkMicro app-framework
Micro app-frameworkMichael Dawson
643 views26 slides

What's hot(19)

Cache Money Talk: Practical Application by Wolfram Arnold
Cache Money Talk: Practical ApplicationCache Money Talk: Practical Application
Cache Money Talk: Practical Application
Wolfram Arnold1.1K views
The Big Picture and How to Get Started by guest1af57e
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
guest1af57e1.6K views
Django Architecture Introduction by Haiqi Chen
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
Haiqi Chen1.8K views
Djangoアプリのデプロイに関するプラクティス / Deploy django application by Masashi Shibata
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata12.7K views
Security: Odoo Code Hardening by Odoo
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
Odoo774 views
JavaScript Testing for Rubyists by Jamie Dyer
JavaScript Testing for RubyistsJavaScript Testing for Rubyists
JavaScript Testing for Rubyists
Jamie Dyer854 views
Yearning jQuery by Remy Sharp
Yearning jQueryYearning jQuery
Yearning jQuery
Remy Sharp16K views
2012 SVCodeCamp: In App Payments with HTML5 by Jonathan LeBlanc
2012 SVCodeCamp: In App Payments with HTML52012 SVCodeCamp: In App Payments with HTML5
2012 SVCodeCamp: In App Payments with HTML5
Jonathan LeBlanc1.4K views
Make More Money With Advanced Custom Fields - WordCampYYC 2015 by buildstudio
Make More Money With Advanced Custom Fields - WordCampYYC 2015Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015
buildstudio685 views
Progressive Downloads and Rendering by Stoyan Stefanov
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and Rendering
Stoyan Stefanov6K views

Similar to Speed is a feature PyConAr 2014

Django at the Disco by
Django at the DiscoDjango at the Disco
Django at the DiscoRichard Leland
1.7K views26 slides
Introduction to Django by
Introduction to DjangoIntroduction to Django
Introduction to DjangoJagdeep Singh Malhi
2.1K views18 slides
國民雲端架構 Django + GAE by
國民雲端架構 Django + GAE國民雲端架構 Django + GAE
國民雲端架構 Django + GAEWinston Chen
1.1K views37 slides
Django at the Disco by
Django at the DiscoDjango at the Disco
Django at the DiscoRichard Leland
791 views26 slides
Django at the Disco by
Django at the DiscoDjango at the Disco
Django at the DiscoRichard Leland
450 views26 slides
Django at the Disco by
Django at the DiscoDjango at the Disco
Django at the DiscoRichard Leland
642 views26 slides

Similar to Speed is a feature PyConAr 2014(20)

國民雲端架構 Django + GAE by Winston Chen
國民雲端架構 Django + GAE國民雲端架構 Django + GAE
國民雲端架構 Django + GAE
Winston Chen1.1K views
Gae Meets Django by fool2nd
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd1.5K views
Caching Up and Down the Stack by Dan Kuebrich
Caching Up and Down the StackCaching Up and Down the Stack
Caching Up and Down the Stack
Dan Kuebrich1.2K views
Implementation of GUI Framework part3 by masahiroookubo
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
masahiroookubo1.7K views
High Performance Web Pages - 20 new best practices by Stoyan Stefanov
High Performance Web Pages - 20 new best practicesHigh Performance Web Pages - 20 new best practices
High Performance Web Pages - 20 new best practices
Stoyan Stefanov50.1K views
Introduction to Django by Joaquim Rocha
Introduction to DjangoIntroduction to Django
Introduction to Django
Joaquim Rocha2.2K views
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines by Tikal Knowledge
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge4.7K views
Intro To Django by Udi Bauman
Intro To DjangoIntro To Django
Intro To Django
Udi Bauman2.6K views
PHPConf-TW 2012 # Twig by Wake Liu
PHPConf-TW 2012 # TwigPHPConf-TW 2012 # Twig
PHPConf-TW 2012 # Twig
Wake Liu2.3K views

Recently uploaded

Consulting for Data Monetization Maximizing the Profit Potential of Your Data... by
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Flexsin
15 views10 slides
Roadmap y Novedades de producto by
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de productoNeo4j
50 views33 slides
Tridens DevOps by
Tridens DevOpsTridens DevOps
Tridens DevOpsTridens
9 views28 slides
SAP FOR CONTRACT MANUFACTURING.pdf by
SAP FOR CONTRACT MANUFACTURING.pdfSAP FOR CONTRACT MANUFACTURING.pdf
SAP FOR CONTRACT MANUFACTURING.pdfVirendra Rai, PMP
11 views2 slides
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDeltares
17 views13 slides
Fleet Management Software in India by
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India Fleetable
11 views1 slide

Recently uploaded(20)

Consulting for Data Monetization Maximizing the Profit Potential of Your Data... by Flexsin
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Consulting for Data Monetization Maximizing the Profit Potential of Your Data...
Flexsin 15 views
Roadmap y Novedades de producto by Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j50 views
Tridens DevOps by Tridens
Tridens DevOpsTridens DevOps
Tridens DevOps
Tridens9 views
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 views
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares11 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares9 views
El Arte de lo Possible by Neo4j
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo Possible
Neo4j38 views
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida by Deltares
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - PridaDSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
Deltares18 views
MariaDB stored procedures and why they should be improved by Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller36 views
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... by Deltares
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
Deltares9 views
Software testing company in India.pptx by SakshiPatel82
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptx
SakshiPatel827 views
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... by Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 views
A first look at MariaDB 11.x features and ideas on how to use them by Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli45 views

Speed is a feature PyConAr 2014

  • 1. This slide was intentionally left blank
  • 2. Speed is a feature A mystical journey through Django performance optimization techniques, tools and gotchas @martinblech @polmuz
  • 3. Roadmap How to find performance problems Sneak peak: Front-end performance How to fix them in Django
  • 4. Why? [Google] found that Half a second delay caused a 20% drop in traffic. [Amazon] found that even very small delays would result in substantial and costly drops in revenue. Users really respond to speed 2006
  • 5. There’s nothing like data Don’t start with the code. Profile and gather real usage data.
  • 6. There’s nothing like real data Identify bottlenecks New Relic Very good Very paid Google Analytics Free of charge Less detail Your logs No data to third parties Harder to use Profiling Complex setup required Overhead
  • 10. There’s nothing like data Let’s find the culprit! django-debug-toolbar django-debug-toolbar-template-timings
  • 11. Time all the things!
  • 12. Typical backend bottlenecks Database External Services CPU Intensive task Template Rendering
  • 13. Database Missing index Big, unused fields Excessive # of queries Order
  • 14. Missing Index class Comment(Model): ... created_at = DateTimeField(db_index=True) blogpost = ForeignKey(Blogpost) class Meta: index_together = [ ["created_at", "blogpost"], ]
  • 15. select_related() >>> for c in Comment.objects.all(): print c.user.name # select * from comments; # select * from users where id = 1; # select * from users where id = 2; ... >>> comments = Comment.objects.all(); >>> for c in comments.select_related(“user”): print c.user.name # select comments.*, users.* # from comments, users # where comments.user_id = users.id;
  • 16. prefech_related() >>> for u in User.objects.filter(id__lt=10): print len(u.comments.all()) # select * from users; # select * from comments where user_id = 1; # select * from comments where user_id = 2; ... >>> users = User.objects.filter(id__lt=10) >>> for u in users.prefetch_related(“comments”): print len(u.comments.all()) # select * from users where id < 10; # select * from comments # where user_id in (1,2,3,4,5,6,7,8,9); ## Joins them in python
  • 17. Demo
  • 18. Background Jobs Celery from celery import task @task def send_confirmation_email(user_id): ... def signup(req): ... send_confirmation_email.delay(req.user.id) return HttpResponseRedirect(“/home/”)
  • 19. Template Compilation Use django.template.loaders.cached.Loader TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), )
  • 20. Template Fragment Caching {% load cache %} {% cache 500 “last_comments” %} .. last comments .. {% endcache %} {% load cache %} {% cache 500 “my_recent_comments” user.id %} .. user’s recent comments .. {% endcache %}
  • 21. Caching! Per view cache from django.views.decorators.cache import cache_page @cache_page(60 * 15) # seconds def my_view(request): ...
  • 23. Caching! Low level cache API >>> from django.core.cache import get_cache >>> cache = get_cache('default') >>> cache.set('my_key', 'hello, world!', 30) >>> cache.get('my_key') >>> from django.core.cache import caches >>> cache = caches['default']
  • 24. Caching! from django.core.cache import get_cache cache = get_cache('default') def last_comments(request): comments_ids = cache.get('last_comments') if comments_ids: comments = Comment.objects.filter(id__in=comments_ids) else: comments = fetch_last_comments() comments_ids = [c.id for c in comments] cache.set('last_comments', comments_ids) ... Low level cache API
  • 25. Cache Invalidation “There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.” post_save/post_delete are a good place to start, but it doesn’t end there! @receiver(post_save, sender=Comment) @receiver(post_delete, sender=Comment) def invalidate_last_comments(sender, **kwargs): cache.delete('last_comments')
  • 26. Caching! Django Cacheback from cacheback.decorators import cacheback @cacheback def fetch_last_comments_ids(): ... def last_comments(request): comments_ids = fetch_last_comments_ids() comments = Comment.objects.filter(id__in=comments_ids) ...
  • 27. Don’t forget about the browser 80% or more of the end-user response time is spent in the front end Combine Compress Cache Less is more Load slow things later Focus on making the important things faster
  • 28. Don’t forget about the browser Google PageSpeed Insights webpagetest.org Chrome & Firefox
  • 29. Assets Django Compressor {% compress js %} <script src="/static/js/one.js"></script> <script>obj.value = "value";</script> {% endcompress %} Django Assets {% assets "js_all" %} <script async src="{{ ASSET_URL }}"></script> {% endassets %}
  • 31. Assets Shameless plug: django-critical {% critical %} <link rel="stylesheet" href="bootstrap.min.css"> {% endcritical %} Alpha stage, use at your own risk!
  • 33. References Performance is a feature - http://blog.codinghorror.com/performance-is-a-feature/ Marissa Mayer at Web 2.0 - http://glinden.blogspot.com.ar/2006/11/marissa-mayer-at-web-20.html Psychology of Web Performance - http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/ New Relic - http://newrelic.com Google Analytics - http://www.google.com/analytics/ Tracking Application Response Time with Nginx - http://lincolnloop.com/blog/tracking-application-response-time-nginx/ Logging Apache response times - http://www.moeding.net/archives/33-Logging-Apache-response-times.html Django Debug Toolbar - http://django-debug-toolbar.readthedocs.org/ DDT Template Timings - https://github.com/orf/django-debug-toolbar-template-timings Django Database Optimizations - https://docs.djangoproject.com/en/1.7/topics/db/optimization/ Two Hard Things - http://martinfowler.com/bliki/TwoHardThings.html Django Cache Docs - https://docs.djangoproject.com/en/1.7/topics/cache/ Django Cacheback - http://django-cacheback.readthedocs.org/en/latest/index.html Cached Templates - https://docs.djangoproject.com/en/1.7/ref/templates/api/#django.template.loaders.cached.Loader Google PageSpeed Insights - https://developers.google.com/speed/pagespeed/insights/ Web Page Test - http://www.webpagetest.org/ Django Compressor - http://django-compressor.readthedocs.org/en/1.3/ Django Assets - http://django-assets.readthedocs.org/en/0.8/ aload.js - https://github.com/pazguille/aload django-critical - https://github.com/martinblech/django-critical Demo - https://github.com/martinblech/pyconar2014_perfdemo