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