In Production Juan Marin
Agenda Introduction Reliability Availability Performance Data optimizations Runtime optimizations Measuring your environment Monitoring your environment Example
Introduction No recipes, just guidelines Security Criteria for the quality of a production deployment: – Reliability – Availability – Performance
Change default admin user!!! Block geoserver/web, access only internally Use roles New security subsystem coming in 2.2 Dont forget about security
Reliability Disable unused services Control server resources – Set WMS rendering memory allocation and processing time limits – Set WFS response size limits – Optimize WFS response types Limit concurrent requests – Limit available server threads to reduce concurrency – Implement control flow to queue requests and avoid server overload
Change default logging
Avoid system overload Use control flow plugin Limits # of concurrent requests by: – Service type (i.e. WMS, WFS, global) – User (cookie based, browsers) – IP address (any client)
Control Flow
Availability Use mechanism to detect server unresponsiveness and restart if necessary (i.e. watchdog) Use load balancing across a pool of servers Provide high availability by using redundant hardware and software components throughout the system
Data Optimizations Sometimes the most important thing to do!! Prepare your maps – Symbology that makes sense – Scale dependency Store vector and raster data in the most frequently requested coordinate system
High Availability Configurations Load Balancer (i.e. HAProxy)
Performance Optimize data and map configuration – Optimize raster and vector data storage – Dont show too much data at once (~1000 features per map request) Use most recent version of Oracle JVM – Run in server mode – Configure options for maximum performance Install native code extensions for JAI and Image I/O Cluster your deployment – Better performance under load
Data optimizations Raster optimizations – Use correct format (GeoTiff, BigTiff, etc.) – Use ImageMosaic – Use ImagePyramid Vector optimizations – Make sure proper Spatial Index is being used – Use a spatial database Validate connections Use connection pooling – Generalize features for higher zoom levels – Avoid shapefile when filtering on attributes
GeoWebCache Cache tiles for fast map rendering Performance is sometimes orders of magnitude faster than regular WMS GeoWebCache is extremely fast, with some unique features – Integrated with GeoServer or standalone with any WMS – Can expire tiles by reading a GeoRSS feed – Seed tile cache down to a certain zoom level, dynamically cache below that
Runtime optimizations JVM settings for production (example) – -server: run in server mode – -Xms2048m -Xmx2048m: maximum heap size, allocates it all at startup – -XX:PermSize=128m -XX:MaxPermSize=256m: sets size and maximum size of permanent collection memory. Very important since GeoServer uses a lot of classes – -XX: SoftRefLRUPolicyMSPerMB=3600: Increases the effectiveness of datastore cache references by increasing the lifetime of soft references – -XX:+UserParalleGC: enables multi-threaded garbage collection. Use with multicore systems only – -XX:+AggressiveOpt: enables experimental optimizations that will be defaults in future versions of the JVM
Container tuning: Optimize Tomcat Limit number of concurrent threads in Tomcat ( /conf/server.xml) Install Apache Portable Runtime (APR) more info here doc/apr.html doc/apr.html
Measuring your environment JMeter VisualVM
Monitoring your environment
Example Data – Washington DC OSM Software – Ubuntu – PostgreSQL Postgis 2.0 – Tomcat – GeoServer – JVM: OpenJDK6, Oracle JDK6 and Oracle JDK7 Hardware – 4 cores – 8GB RAM
Example data
Results
References GeoServer in Production White Paper production/register/?target=/publications/geoserver- production/ GeoServer on steroids steroids
Questions? Thank You