Upload
david-zwarg
View
256
Download
5
Embed Size (px)
Citation preview
Scalable OSGeo StacksFrom Tutorials to Production
David Zwarg [email protected]
Tutorials
• A good place to start!
• A bad place to end!
Production Environments
• Your production environment is a beautiful snowflake.
!
• Mileage may vary
Definition of Terms
• “Production”
• A data-driven, dynamic, scalable, web application
• “Tutorial”
• Anything else
“data-driven”Anything that can be changed in the application is changed in a database.
photo by Daniel Mitchell (flickr)
“dynamic”Each visitor may have a personalized “view” of any URL.
photo by Jessa Dow-Anderson (flickr)
“scalable”The application may be run on 1 server or 100 servers.
photo by Tiny Delights (flickr)
“web application”An application that provides rich interactivity in a user’s web browser.
Good Tutorials Warn You
• Bad tutorials don’t
Tutorial #1: django
• https://docs.djangoproject.com/en/1.7/intro/tutorial01/
• Do not ignore these helpful notes:
Tutorial #2: geodjango
• “Use the source”
• Source installs can be just as dependable as package management solutions
Side Note: Source Install
• Ensure that all script installations are scriptable
• Script & version package management installations
• Aim for a repeatable installation
Tutorial #3: celery
• More helpful log messages: “UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!”
Side Note: Workers
• Long-running processes should be performed “out of band”
• Use separate processes to do big tasks
Visitor TrafficWhat your users feel
photo by Björn (flickr)
Visitor TrafficWhat it really looks like
photo by joiseyshowaa (flickr)
Backend ScalingTips for Servers
photo by Henrik Bennetsen (flickr)
Scaling GEOS & GDAL
• Single-threaded designs
• Apache: use the preform multiprocessing module (mpm_prefork)
• gunicorn: use synchronous workers with many worker_processes
Scaling Tiles
• Geoserver includes Geowebcache
• Cache WMS image tiles
• Automatic cache seeding
• Scriptable via REST
Scaling Tiles (cont.)
• Tilestache
• Plugs into Mapnik
• Use with MBTiles, Amazon S3, Memcache, etc
Scaling PostGIS
• Heroku provides the option of HA failover and PostGIS.
• Or, roll your own snowflake (WAL, Slony, Bucardo)
Frontend ScalingTips for Web Applications
OpenLayers
• Loading Strategies
• BBOX
• Vector “Resolution”
• Don’t drown in data
Use a CDN
• “Content Delivery Network”
• https://cdnjs.com
• https://ajax.googleapis.com
• http://cloudflare.net
• more!
General Tips
• Scale servers on demand
• Don’t overwhelm clients
• Focus on long-running processes & slow requests
• Use a cache
Scalable OSGeo StacksFrom Tutorials to Production
David Zwarg [email protected]