"Stupid Easy" Scaling Tweaks and Settings. AKA Scaling for the Lazy

Similar documents
Improve WordPress performance with caching and deferred execution of code. Danilo Ercoli Software Engineer

Real Life Web Development. Joseph Paul Cohen

Offline-first PWA con Firebase y Vue.js

Large-Scale Web Applications

Django Better Cache Documentation

How to git with proper etiquette

DISQUS. Continuous Deployment Everything. David

BUILDING THE FASTEST DRUPAL OF THE GALAXY

Signals Documentation

Building a Scalable Architecture for Web Apps - Part I (Lessons Directi)

Trending with Purpose. Jason Dixon

Scaling App Engine Applications. Justin Haugh, Guido van Rossum May 10, 2011

Summary See complete responses

MITOCW MIT6_172_F10_lec18_300k-mp4

A Library and Proxy for SPDY

Flask-Caching Documentation

Anatomy of a SPA: Client-side MVC

Caching Memcached vs. Redis

LECTURE 15. Web Servers

How you can benefit from using. javier

Overview of BC Learning Network SMS2 Introduction

DECENTRALIZED SOCIAL NETWORKING WITH WORDPRESS. November 7, 2018 WordPress Meetup Vienna Alex Kirk

Web Performance in

Connect with Remedy: SmartIT: Social Event Manager Webinar Q&A

Scaling Without Sharding. Baron Schwartz Percona Inc Surge 2010

Cloud Help for Community Managers...3. Release Notes System Requirements Administering Jive for Office... 6

django-stored-messages Documentation

Yahoo Search ATS Plugins. Daniel Morilha and Scott Beardsley

Drupal Frontend Performance & Scalability

MongoDB Web Architecture

EXPERIENCES MOVING FROM DJANGO TO FLASK

Http Error Status 502 Bad Gateway Error Reason Server Unreachable

Ten interesting features of Google s Angular Project

Django. Jinja2. Aymeric Augustin DjangoCong 2016

Fixing Twitter.... and Finding your own Fail Whale. John Adams Twitter Operations

Scaling DreamFactory

Pluggable Patterns. For Reusable Django Applications

Easy-select2 Documentation

Sessions. Mendel Rosenblum. CS142 Lecture Notes - Sessions

Next Generation Collaborative Reversing with Ida Pro and CollabREate. Chris Eagle and Tim Vidas Naval Postgraduate School

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

ANGULAR2 OVERVIEW. The Big Picture. Getting Started. Modules and Components. Declarative Template Syntax. Forms

Ur/Web: A Simple Model for Programming the Web. Adam Chlipala MIT CSAIL POPL 2015 January 15, 2015

Effective Networking with Swift and ios 8

Scaling Instagram. AirBnB Tech Talk 2012 Mike Krieger Instagram

8.0 Help for End Users About Jive for SharePoint System Requirements Using Jive for SharePoint... 6

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

How to bootstrap a startup using Django. Philipp Wassibauer philw ) & Jannis Leidel

9 May Swifta. A performant Hadoop file system driver for Swift. Mengmeng Liu Andy Robb Ray Zhang

Real World Web Scalability. Ask Bjørn Hansen Develooper LLC

Oracle APEX 18.1 New Features

Life as a Service. Scalability and Other Aspects. Dino Esposito JetBrains ARCHITECT, TRAINER AND CONSULTANT

BEGINNER PHP Table of Contents

Four times Microservices: REST, Kubernetes, UI Integration, Async. Eberhard Fellow

Jquery.ajax Call Returns Status Code Of 200 But Fires Jquery Error

Git Source Control: For the Rest of Us. Nolan Erck

Digital Marketing Manager, Marketing Manager, Agency Owner. Bachelors in Marketing, Advertising, Communications, or equivalent experience

Creating Dynamic Websites with CGI and Mason - Day Two. Jon Warbrick University of Cambridge Computing Service

Databricks, an Introduction

Release Notes for Dovecot Pro Minor release

Lecture 14. Moving Forward 1 / 23

the road to cloud native applications Fabien Hermenier

Export as DivX, Xvid, x264, MP4 Posted by DJKnuddel - 28 May :09

CS Lab 1: httpd

Hello, and welcome to another episode of. Getting the Most Out of IBM U2. This is Kenny Brunel, and

Best Practices. For developing a web game in modern browsers. Colt "MainRoach" McAnlis

The Stack, Free Store, and Global Namespace

P1_L3 Operating Systems Security Page 1

THE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX

Writing a Django e- commerce framework OSCON 2012

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between

GETTING STARTED GUIDE

How to Improve Your Campaign Conversion Rates

8.0 Help for Community Managers About Jive for Google Docs...4. System Requirements & Best Practices... 5

Sucuri Webinar Q&A HOW TO IDENTIFY AND FIX A HACKED WORDPRESS WEBSITE. Ben Martin - Remediation Team Lead

ERIC YONGE EYStudios

BrandingUI (Basic, Advanced, Enterprise) Getting Started - Important First Steps

Using NGiNX for release automation at The Atlantic

youckan Documentation

Shortcake. Bridging the gap between WordPress developers and content creators. Brian DeConinck. NC State University. Office of Information Technology

Give Your Site a Boost With memcached. Ben Ramsey

Q&A Session for Connect with Remedy - CMDB Best Practices Coffee Break

Software Architecture With ColdFusion: Design Patterns and Beyond Topics Outline Prepared by Simon Horwith for CFUnderground 6

CaseComplete Roadmap

J2EE: Best Practices for Application Development and Achieving High-Volume Throughput. Michael S Pallos, MBA Session: 3567, 4:30 pm August 11, 2003

Send me up to 5 good questions in your opinion, I ll use top ones Via direct message at slack. Can be a group effort. Try to add some explanation.

MySQL Database Scalability

Full Stack boot camp

To Kill a Monolith: Slaying the Demons of a Monolith with Node.js Microservices on CloudFoundry. Tony Erwin,

Bambu API Documentation

Investigating Source Code Reusability for Android and Blackberry Applications

Introduction to Software Engineering: Tools and Environments. Session 10. Oded Lachish

Meet our Example Buyer Persona Adele Revella, CEO

AirBespoke Inventory Tracking System

Release Manu Phatak

Google Drive: Access and organize your files

Open-Falcon A Distributed and High-Performance Monitoring System. Yao-Wei Ou & Lai Wei 2017/05/22

GroupWise Architecture and Best Practices. WebAccess. Kiran Palagiri Team Lead GroupWise WebAccess

Splitting the pattern into the model (this stores and manipulates the data and executes all business rules).

Geospatial three amigos: Python, Leaflet, and ElasticSearch. Roberto Rosario

Transcription:

"Stupid Easy" Scaling Tweaks and Settings AKA Scaling for the Lazy

I'm Lazy (and proud of it)

The Benefits of "Lazy" Efficiency is king Dislike repetition Avoid spending a lot of time on things

A Lazy Approach to Scaling Changes shouldn't take more than ~1h Change once, and "forget" Skims the surface, but goes the distance

The Design

Identify the problems Single User Some Users Over 24 hours 1-23 hours tweets() 10s Real Time Everyone

Dealing with Blocks A "block" is anything which holds up processing (usually I/O operations): Network connections 3rd party APIs Disk reads/writes Some blocks bigger than others (i.e. DB write is a bigger 'block' than a read) For big 'blocks', push off to Celery

Async vs Sync Sync Processes in order Multiple processes running Default Behavior Long I/O blocks = Bad (use Celery) This is approach we're addressing Async Usually green threading Spawns new thread on I/O block Fewer processes running Blocks on Native C libraries Special case use

The Server

Cache EVERYTHING Use a cache for everything you can A lot of this can be done 'auto-magically' 1. apt-get install memcached libmemcached-dev 2. pip install pylibmc 3. Configure with ketama CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.pylibmccache', 'LOCATION': '127.0.0.1:11211', 'TIMEOUT': 3600, 'VERSION': 1, 'OPTIONS': { # Maps to pylibmc "behaviors" 'tcp_nodelay': True, 'ketama': True }, }, } [1] Set up Cache

Cache Sessions Django default of session in DB = unnecessary DB reads/writes SESSION_ENGINE = "django.contrib.sessions.backends.cache" SESSION_CACHE_ALIAS = "sessions" (new in 1.5) Concerned about session persistence? Maybe use redis as a session backend instead of Django docs "...backends.cached_db" Django docs for session backends

Cached Template Loader Everyone knows Django Templates are slow, right? Slower than Jinja2, etc. Bollocks. This can cut down your django templates to 1/10th the rendering time: Use the cached template loader: TEMPLATE_LOADERS = (('django.template.loaders.cached.loader', ( 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', )), )

Cache Pages Add Django's Cache Middleware to automatically cache the whole page served. I suggest adding the setting: CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

Upstream Cache Even better - let's not touch Django at all! Use an upstream cache to serve static files at a breakneck speed. Use @ensure_csrf_cookie to prevent caching in upstream uwsgi_cache_key $scheme:site$request_uri:$request_method; uwsgi_cache_bypass $cookie_sessionid; # Don't serve cache if session uwsgi_cache_bypass $cookie_csrftoken; # Don't serve cache if session uwsgi_no_cache $cookie_sessionid; # Don't cache response w/ session uwsgi_no_cache $cookie_csrftoken; # Don't cache response w/ session Gist of full configuration settings for uwsgi + nginx upstream cache

Database

Johnny Cache Automagically caches DB queries, and invalidates all queries dependent on a table if the table has a write. Use the blacklist for tables written more often than read. Set "'TIMEOUT': 0" in settings for infinite cache Beware external writes to DB!!!!!

Connection Pooling Source

The Client

Use a CDN Speeds up requests, reduces server load. Also, use max 'Expires' (and just version updates)

PJAX Hi, Josh! You have 22 notifications. Most recent message: "I forgot the graph..." Let's Only Content Update This All the social media updates you can't do without.

How PJAX works jquery plugin that uses a "new" technique to change only part of the page, but update the history and URL. If browser doesn't support it, loads normally. Otherwise, adds a "PJAX" header to request. Just add html attributes to links and containers, and then run the plugin. (Needs server-side integration though)

django-pjax Adds decorators and class mixins (for classbased-views) to specify different templates if the PJAX header exists. Easiest way: @pjaxtend() --- creates 'parent' context variable which defaults to base.html if not PJAX, or pjax.html if PJAX In template: {% extends parent %} I suggest using my fork until pull request merged: My fork

Final Thoughts You could add all these features in a single weekend. If you're not using any of them at all, you'll see gains of about 20% to 10,000% of what you have now (depending on the specific case) These don't work in ALL cases, but do work in MOST cases.

Oh, and btw... So for this I polled you guys on what talks you'd like to see. Here were the results:

Q&A Josh Lovison jlovison@gmail.com