WMS Performance Tests! Mapserver & Geoserver FOSS4G 2007
Total Page:16
File Type:pdf, Size:1020Kb
W W W . R E F R A C T I O N S . N E T WMSWMS PerformancePerformance Tests!Tests! MapserverMapserver && GeoserverGeoserver FOSS4GFOSS4G 20072007 Shapefiles vs. PostGIS, Concurrency, and other exciting tests... Presented by Brock Anderson and Justin Deoliveira W W W . R E F R A C T I O N S . N E T PresentationPresentation OutlineOutline • Goals of testing. • Quick review of WMS. • Description of the test environment. • Discussion of performance tests and results. • Questions. W W W . R E F R A C T I O N S . N E T GoalsGoals 1. Compare performance of WMS GetMap requests in Mapserver and Geoserver. 2. Identify configuration settings that will improve performance. 3. Identify and fix inefficiencies in Geoserver. We do not test stability, usability, etc., * We do not test styling or labelling. We focus on vector input . W W W . R E F R A C T I O N S . N E T KeepingKeeping thethe teststests fairfair • Not an easy job! • We tried to understand what each server does under the hood to ensure we're not accidentally performing unnecessary processing on either server. W W W . R E F R A C T I O N S . N E T WebWeb MapMap ServiceService (WMS)(WMS) http://server.org/wms? request =getmap& layers =states,lakes& bbox =-85,36,-60,49& format =png&... WMS User A Map W W W . R E F R A C T I O N S . N E T TestTest EnvironmentEnvironment Client Computer Server Computer Apache 2.2.4 (with mod_fcgi) Vector Data Vector Mapserver 4.10.2 WMS requests JMeter Data 2.2 Tomcat 6.0.14 WMS requests Shapefiles Geoserver 1.6 beta 3 Additional Server Specs: Dual core (1.8Ghz per core). 2GB RAM. 7200RPM disk. Linux. PostgreSQL 8.2.4. PostGIS 1.2. W W W . R E F R A C T I O N S . N E T TestTest #1:#1: PostGISPostGIS vs.vs. ShapefilesShapefiles • Two Data Sets : 3,000,000 Tiger roads in Texas 10,000 Tiger roads in Dallas, Texas • Both data sets are in PostGIS and shapefile format. • Spatial indexes on both data sets. • Mapserver and Geoserver layers point at the data. • Minimal styling. • JMeter issues WMS requests to fetch ~1,000 features, limited by the 'bbox' parameter. And the results are... W W W . R E F R A C T I O N S . N E T TestTest #1:#1: PostGISPostGIS vs.vs. ShapefilesShapefiles Mapserver Geoserver 400 386 400 350 350 300 300 250 250 200 200 150 150 100 100 50 47 50 39 50 4227 42 33 Response(milliseconds) time 0 0 1,000 of 10,000 1,000 of 3,000,000 1,000 of 10,000 1,000 of 3,000,000 Notes: This test uses two different data sets: one with 3 million features, the other with 10,000. Each bar is an average of 30 sample WMS requests, each using a different bounding box to fetch and draw appx. 1000 features (+/- 15%). The same 30 requests are executed for each scenario. One request at a time (no concurrency). Mapserver and Geoserver use the same data. Mapserver is using FastCGI via Apache/mod_fcgi. Spatial indexes on both data sets. Quadtree indexes generated by 'shptree'. No reprojection required. Minimal styling. Responses are 1-bit PNG images. W W W . R E F R A C T I O N S . N E T TestTest #2:#2: ConcurrentConcurrent RequestsRequests • Using the same tiger roads data set with 10,000 records. • We issue multiple requests with pseudo-random BBOXes that fetch approximately 1,000 features. • The main difference is that now we're issuing multiple concurrent requests. Let's see what happened... W W W . R E F R A C T I O N S . N E T TestTest #2:#2: ConcurrentConcurrent RequestsRequests Mapserver Geoserver 1400 1400 1200 1200 1000 1000 800 800 600 600 400 400 200 Response time(milliseconds) 200 0 0 1 2 5 10 15 20 40 60 1 2 5 10 15 20 40 60 Notes: Data in PostGIS and shapefile formats. Mapserver and Geoserver use the same data. Mapserver is using FastCGI via Apache/mod_fcgi. 20 FastCGI mapserv processes. Geoserver uses connection pooling with 20 connections. Spatial indexes on both data sets. No reprojection required. Minimal styling. Responses are 2-color PNG images. More details in the appendix. W W W . R E F R A C T I O N S . N E T ...... oror Throughput,Throughput, ifif youyou preferprefer Mapserver Throughput Geoserver Throughput 80 80 70 70 60 60 50 50 40 40 30 30 20 20 10 10 Responses per0 second 0 1 2 5 10 15 20 40 60 1 2 5 10 15 20 40 60 # Concurrent Requests # Concurrent Requests An alternative way to summarize the data collected for the concurrency test. (Higher lines are better here.) W W W . R E F R A C T I O N S . N E T TestTest #3:#3: ReprojectionReprojection Mapserver (using PROJ to reproject) Geoserver (using Geotools to reproject) 80 80 31 70 22 70 19 21 60 6 9 12 60 50 0 50 0 4 40 40 30 30 20 20 10 10 Response time (milliseconds) 0 0 None Geog WGS84 Geog WGS84 Geog WGS84 UTM 14N None Geog WGS84 Geog WGS84 Geog WGS84 UTM 14N – UTM 14N – UTM 14N – SPS NAD83 WGS84 - SPS – UTM 14N – UTM 14N – SPS NAD83 WGS84 - SPS WGS84 NAD27 NAD83 WGS84 NAD27 NAD83 PROJ optimizes by assuming these source Geotools is slightly faster than and target datums are equivalent. PROJ for these cases. Currently Mapserver calls PROJ for every Geoserver simplifies geometry vertex, but it could improve by batching before reprojecting. those into a single call. W W W . R E F R A C T I O N S . N E T CGICGI vs.vs. FastCGIFastCGI (Mapserver(Mapserver only)only) 90 81 80 70 60 57 52 50 42 PostGIS 40 Shapefile 30 20 10 Response time (milliseconds) time Response 0 CGI FastCGI Notes: Average of 30 samples. One request at a time (no concurrency). Each request fetches one layer with 1000 features from a data set of 10,000. Spatial indices on both data sets. No reprojection required. Minimal styling. Responses are 1-bit PNG images. The same binary file was used for both CGI and FastCGI. FastCGI through Apache and mod_fcgi. W W W . R E F R A C T I O N S . N E T BreakdownBreakdown ofof MapserverMapserver ResponseResponse TimeTime 90 80 70 Network delay 60 Write image 50 Draw Fetch & store 40 Query 30 Connect to DB Load map file Time (in milliseconds) (in Time 20 Start mapserv process 10 0 PostGIS Shapefile • FastCGI eliminates Start mapserv process and Connect to DB costs. • The Write image step is dependant on output format. W W W . R E F R A C T I O N S . N E T BreakdownBreakdown ofof GeoserverGeoserver ResponseResponse TimeTime 404: Document not found W W W . R E F R A C T I O N S . N E T ServletServlet ContainerContainer andand JavaJava (Geoserver(Geoserver only)only) Jetty 6.0.2 Tomcat 6.0.14 200 179 200 160 160 120 120 95 Tomcat 6 95 80 80 doesn't 64 support 63 40 40 Java 1.4 Response time (milliseconds) 0 0 Java 1.4 Java 5 Java 6 Java 1.4 Java 5 Java 6 • These results show average response times for the same WMS request when Geoserver is backed by different Servlet containers and Java versions. • Using shapefile backend. • Conclusion: Use Java 6! W W W . R E F R A C T I O N S . N E T OutcomeOutcome ofof thethe teststests • Lots of performance optimizations to Geoserver which will be available in version 1.6. • Identified a few places where Mapserver can improve too. (These will be reported as “bugs” as time permits.) • Both servers can be FAST, but require some special configuration. W W W . R E F R A C T I O N S . N E T TheThe RoadRoad toto SpeedSpeed Mapserver Geoserver 1000 1000 800 800 600 600 400 400 Response time (milliseconds) time Response 200 200 0 0 Start (CGI) Switch to Re-order Output Start Logging Transp. Output JVM Code FastCGI 'epsg' file format Off styles format settings change off Data sources with high All will be in Geoserver 1.6 connection overhead will benefit much more from FastCGI. W W W . R E F R A C T I O N S . N E T PerformancePerformance TipsTips (Mapserver)(Mapserver) • Beware of PROJECTION 'init=epsg:4326' END The “init=” syntax causes one lookup in the PROJ4 'epsg' file for every occurrence in the map file. (Move your most-used EPSG codes to the top of the 'epsg' file.) • Use FastCGI instead of ordinary CGI. Instruction here: http://mapserver.gis.umn.edu/docs/howto/fastcgi • Ensure you have enough FastCGI processes. W W W . R E F R A C T I O N S . N E T PerformancePerformance TipsTips (Geoserver)(Geoserver) • Geoserver has many features enabled by default. Gain performance by disabling features you don't need. – Transparent styles double draw time. Use opacity=1 in your SLD to disable. – Antialiasing linework is costly. Try '&format_options=antialias:none' to disable. – Experiment with disabling “PNG native acceleration” • Favour Java 6 over Java 5 over Java 1.4. • JVM Settings: Increase heap size. Use -server switch. • Experiment with different shapefile index depth s. • Turn off logging W W W .