pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brett Walker <brett.walker@geometryit.com>
To: Riaan van den Dool <rvddool@csir.co.za>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Geoserver-PostGIS performance problems
Date: Tue, 24 Jul 2012 17:54:49 +1000
Message-ID: <4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com> (raw)
In-Reply-To: <500E690D020000DB000A78CC@pta-emo.csir.co.za>
References: <500E690D020000DB000A78CC@pta-emo.csir.co.za>

Hi Riaan,
I am familiar if the Geoserver/Geotools package and I believe that the problem is not Postgres/PostGIS but rather Geoserver.
The DB Connection Closed message is not sent at the end of the query, but rather at the end of the rendering. There is more than just querying happening between the Select message and the Closed message.
Brett
From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Riaan van den Dool
Sent: Tuesday, 24 July 2012 5:21 PM
To: pgsql-performance@postgresql.org
Subject: [PERFORM] Geoserver-PostGIS performance problems



Hi



We have noticed something strange in the interaction between our Geoserver instance and Postgres/PostGIS.



After setting Geoserver's log level to include developer debugging, I managed to capture a single request from Geoserver WMS to PostGIS.



The (shortened) sequence of events and their timestamps:



12:31:22,658 - SELECT query for MSG is sent to Postgres

12:32:10,315 - Rendering for MSG layer starts

12:32:10,356 - DB Connection Closed

========

~ 48 seconds



Interestingly enough, when I execute the same query (MSG) directly from PgAdmin3:



SELECT "frp_mw",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM "public"."af_msg_abba_datetime_today" WHERE ("the_geom" && GeometryFromText('POLYGON ((-27.67968749408379 -46.92207325648429, -27.67968749408379 -6.186892358058866, 75.67968748740275 -6.186892358058866, 75.67968748740275 -46.92207325648429, -27.67968749408379 -46.92207325648429))', 4326) AND (("frp_mw" >= -1 AND "frp_mw" <= 150) OR ("frp_mw" >= 151 AND "frp_mw" <= 300) OR ("frp_mw" >= 301 AND "frp_mw" <= 600) OR ("frp_mw" >= 601 AND "frp_mw" <= 50000)));



I get 6515 rows in 380 ms.



Ie Postgres is able to return the results of the query within 380ms if queried from PgAdmin3 but Geoserver takes about 48 seconds to get hold of the same resultset.



Is this some kind of JDBC problem perhaps?



Some details about our setup:



Master Postgres database is on a separate VM from Geoserver, but we replicate to a slave Postgres cluster on the Geoserver VM (same host). So Geoserver is referencing the 'localhost' read-only Postgres cluster for its queries.



The 380 ms response time shown above was from the slave Postgres cluster, same one that Geoserver is using.



All Linux (Ubuntu 11.10) based. Postgres 9.1 PostGIS 1.5 Geoserver 2.1.3



Riaan





--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner<http://www.mailscanner.info/;,
and is believed to be clean.

Please consider the environment before printing this email.

view thread (13+ messages)  latest in thread

Message-ID: <4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com>
Permalink:  ../4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com/
Also on:    postgresql.org/message-id/4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: brett.walker@geometryit.com, rvddool@csir.co.za
  Subject: Re: Geoserver-PostGIS performance problems
  In-Reply-To: <4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com>
  References: <500E690D020000DB000A78CC@pta-emo.csir.co.za> <4B95BC7335A13A42AD0D23462F91AE6F6163F14852@echo.geometryit.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox