wms performance tests map server vs geo server

26
W W W . R E F R A C T I O N S . N E T WMS Performance WMS Performance Tests! Tests! Mapserver & Mapserver & Geoserver Geoserver FOSS4G 2007 FOSS4G 2007 Presented by Brock Anderson and Justin Deoliveira Shapefiles vs. PostGIS, Concurrency, and other exciting tests...

Upload: donnyv

Post on 18-May-2015

12.102 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

WMS Performance WMS Performance Tests!Tests!

Mapserver & GeoserverMapserver & Geoserver

FOSS4G 2007FOSS4G 2007

Presented by Brock Anderson and Justin Deoliveira

Shapefiles vs. PostGIS,Concurrency,and other exciting tests...

Page 2: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Presentation OutlinePresentation Outline

• Goals of testing.

• Quick review of WMS.

• Description of the test environment.

• Discussion of performance tests and results.

• Questions.

Page 3: Wms Performance Tests Map Server Vs Geo Server

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.

*

Page 4: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Keeping the tests fairKeeping the tests fair

• 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.

Page 5: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Web Map Service (WMS)Web Map Service (WMS)

WMS

User

http://server.org/wms? request=getmap& layers=states,lakes& bbox=-85,36,-60,49& format=png&...

A Map

Page 6: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test EnvironmentTest Environment

Shapefiles

Mapserver

4.10.2

Server ComputerClient Computer

JMeter 2.2

WMS requestsData

Additional Server Specs: Dual core (1.8Ghz per core). 2GB RAM. 7200RPM disk. Linux. PostgreSQL 8.2.4. PostGIS 1.2.

Apache 2.2.4 (with mod_fcgi)

Geoserver

1.6 beta 3

Tomcat 6.0.14WMS requests

Vecto

r Data

Page 7: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test #1: PostGIS vs. Test #1: PostGIS 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...

Page 8: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test #1: PostGIS vs. ShapefilesTest #1: PostGIS vs. Shapefiles

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.

1,000 of 10,000 1,000 of 3,000,000

0

50

100

150

200

250

300

350

400

50 4739

386Mapserver

Resp

on

se t

ime (

mil

-li

seco

nd

s)

1,000 of 10,000 1,000 of 3,000,000

0

50

100

150

200

250

300

350

400

42 4227 33

Geoserver

Page 9: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test #2: Concurrent Test #2: Concurrent 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...

Page 10: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test #2: Concurrent Test #2: Concurrent RequestsRequests

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.

1 2 5 10 15 20 40 60

-100

100

300

500

700

900

1100

1300

1500

Mapserver

Response t

ime (

milliseconds)

1 2 5 10 15 20 40 60

0

200

400

600

800

1000

1200

1400

Geoserver

Page 11: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

... or Throughput, if you ... or Throughput, if you preferprefer

An alternative way to summarize the data collected for the concurrency test. (Higher lines are better here.)

1 2 5 10 15 20 40 60

0

10

20

30

40

50

60

70

80

Mapserver Throughput

# Concurrent Requests

Res

pons

es p

er s

econ

d

1 2 5 10 15 20 40 60

0

10

20

30

40

50

60

70

80Geoserver Throughput

# Concurrent Requests

Page 12: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Test #3: ReprojectionTest #3: Reprojection

Currently Mapserver calls PROJ for every

vertex, but it could improve by batching

those into a single call.

None Geog WGS84 – UTM 14N

WGS84

Geog WGS84 – UTM 14N

NAD27

Geog WGS84 – SPS NAD83

UTM 14N WGS84 - SPS

NAD83

0

10

20

30

40

50

60

70

80

Mapserver (using PROJ to reproject)

Res

pons

e tim

e (m

illise

cond

s)

None Geog WGS84 – UTM 14N

WGS84

Geog WGS84 – UTM 14N

NAD27

Geog WGS84 – SPS NAD83

UTM 14N WGS84 - SPS

NAD83

0

10

20

30

40

50

60

70

80

Geoserver (using Geotools to repro-ject)

PROJ optimizes by assuming these source

and target datums are equivalent.

Geotools is slightly faster than

PROJ for these cases.

Geoserver simplifies geometry before reprojecting.

0 6

229 12

0 419 21

31

Page 13: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

CGI vs. FastCGI (Mapserver only)CGI vs. FastCGI (Mapserver only)

CGI FastCGI0

10

20

30

40

50

60

70

80

90 81

5257

42 PostGISShapefile

Re

sp

on

se

tim

e (

mil

-li

se

co

nd

s)

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.

Page 14: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Breakdown of Mapserver Breakdown of Mapserver Response TimeResponse Time

• FastCGI eliminates Start mapserv process and Connect to DB costs.

• The Write image step is dependant on output format.

PostGIS Shapefile0

10

20

30

40

50

60

70

80

90

Network delayWrite imageDrawFetch & storeQueryConnect to DBLoad map fileStart mapserv process

Tim

e (

in m

illis

ec

on

ds

)

Page 15: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Breakdown of Geoserver Breakdown of Geoserver Response TimeResponse Time

404: Document not found

Page 16: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Servlet Container and Java (Geoserver Servlet Container and Java (Geoserver only)only)

• 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!

Java 1.4 Java 5 Java 60

40

80

120

160

200 179

95

64

Jetty 6.0.2

Response t

ime (

mil-

liseconds)

Java 1.4 Java 5 Java 60

40

80

120

160

200

95

63

Tomcat 6.0.14

Tomcat 6 doesn't support Java 1.4

Page 17: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Outcome of the testsOutcome of the tests

• 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.

Page 18: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

The Road to SpeedThe Road to Speed

Start (CGI) Switch to FastCGI

Re-order 'epsg' file

Output format

0

200

400

600

800

1000

Mapserver

Resp

on

se t

ime (

millisecon

ds)

Star

t

Logg

ing

Off

Tran

sp. s

tyles off

Out

put fo

rmat

JVM set

tings

Code

cha

nge

0

200

400

600

800

1000

Geoserver

All will be in Geoserver 1.6Data sources with high connection overhead will benefit much more from FastCGI.

Page 19: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Performance Tips Performance Tips (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.

Page 20: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Performance Tips Performance Tips (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 depths.

• Turn off logging

Page 21: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

How can the servers How can the servers improve?improve?

Mapserver• More efficient

scanning of shapefile quadtree indexes. [ Bug Reported ]

• Batch PROJ calls when doing on-the-fly reprojection.

• Reduce number of 'epsg' lookups on map files.

Geoserver• Various

optimizations to the renderer.

[ Fixes Committed ]

• More efficient scanning of shapefile quadtree index. [ Fixes Committed ]

Page 22: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

Questions? Contact Us. Questions? Contact Us.

Brock Anderson: [email protected]

Justin Deolivera: [email protected]

Page 23: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

General WMS Performance General WMS Performance Tips Tips

• Only fetch from your data source the features that will be drawn, otherwise the servers have to spend time scanning and discarding the unused ones.

• Output format affects response time. 256 color PNG is faster to create than PNG24 on both servers.

• On-the-fly reprojection has a price. Store data in the same projection it's most commonly requested in.

Page 24: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

AppendixAppendix

Breakdown of Mapserver Response Time

The graph represents mapserv running in CGI mode to show all startup costs. Metrics for “Load map file”, “Connect to DB”, “Fetch & store”, “Draw” and “Write image” were collected by modifying source code to capture and log durarions of those operations. “Query” time measured with PostgreSQL's explain analyze command. “Start mapserv process” + “Network delay” = difference between response times recorded by JMeter and my custom mapserv logging which recorded the total time servicing a request.

PostGIS vs Shapefiles

This test uses two different data sets: one with 3,000,000 features, the other with 10,000. Each request fetches 1000 features by limiting with a 'bbox' WMS parameter. Each bar is an average of 30 samples. One request at a time (no concurrency). Mapserver and Geoserver use the same data. Mapserver is using FastCGI via Apache/mod_fcgi. Spatial indices on both data sets. The shapefile indices were generated with 'shptree'. No reprojection required. Minimal styling. Responses are 2-color PNG images (indexed color).

The unusual Mapserver result for the case of a 3 million record shapefile has been reported to the Mapserver bug tracker: http://trac.osgeo.org/mapserver/ticket/2282

15ms 15msLoad map file 3ms 3msConnect to DB 14ms n/aQuery 20ms n/aFetch 7ms n/aDraw 11ms 28msWrite image 8ms 8msNetwork delay 3ms 3ms

PostGIS ShapefileStart mapserv process

Page 25: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

AppendixAppendix

Concurrency and Throughput

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 (indexed color). “Concurrent” requests were fired in bursts with zero ramp up (as near to simultaneously as possible). I.e. For the test of 10 concurrent requests, all ten requests were fired at the same time. Once all the responses came back then the next burst of requests went out. Requests use random bboxes which fetch ~1000 features. The same random bboxes are used against both servers.

1 50 392 51 405 91 75

10 182 14715 269 22920 315 28340 784 61260 1269 905

Mapserver (Response times)PostGIS Shapefile

1 42 272 43 305 81 47

10 166 10315 261 16220 378 25240 747 51460 1170 773

Geoserver (Response times)PostGIS Shapefile

1 19.6 24.92 28.2 33.45 35.4 51.6

10 38.4 53.815 42.5 5520 42.4 54.140 43.2 54.960 43.1 51.5

Mapserver (Throughput times)PostGIS Shapefile

1 24.6 35.62 32.3 41.85 47.1 68.6

10 49.9 74.115 49.2 73.320 47.7 6840 48.3 6860 47.8 70.7

Geoserver (Throughput times)PostGIS Shapefile

Response times are measured in milliseconds. Throughput times represent responses per second.

The concurrency level is the left-most column in each table (1, 2, 5, 10, ...).

Page 26: Wms Performance Tests Map Server Vs Geo Server

W W W . R E F R A C T I O N S . N E T

AppendixAppendix

Summary of Geoserver code changes made to improve performance:

• optimized access to the shapefile spatial index (it was reading tiny sections of the file instead of doing some buffered access)

• figure out the optmimal palette out of the SLD style (when possible, that is, when antialiasing is off)

* don't access the dbf file when not necessary

* avoid unecessary operations, like duplicating over and over the same coordinate[] during rendering (loading it, generalize, reproject, copy back in the geometry and so on, now the array it's copied just once)

Raw list of changes here:

http://jira.codehaus.org/secure/ManageLinks.jspa?id=55176