[Geoserver-users] Oracle vector JNDI: bad performance due to 16 database calls per layer fetched

Hello everyone,

We noticed while having a look at database activity from geoserver to Oracle there seem to be quite some inefficiencies...

After some looking around we found out that for every vector layer (configured using the oracle JNDI datastore) fetched from oracle there are 16 calls to the database... and since our average WMS requests needs 10 vector layers, this is 160 calls per WMS request.

This is an example of the database calls for a layer:

1) SELECT WKTEXT FROM MDSYS.CS_SRS WHERE SRID = -1
2) SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
  WHERE o.owner LIKE :1 ESCAPE '/' AND o.object_name LIKE :2 ESCAPE '/' AND o.object_type IN ('xxx', 'TABLE', 'VIEW')
  ORDER BY table_type, table_schem, table_name
3) SELECT * FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE 1 = 0
4) SELECT WKTEXT FROM MDSYS.CS_SRS WHERE SRID = -1
5) SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
  WHERE o.owner LIKE :1 ESCAPE '/' AND o.object_name LIKE :2 ESCAPE '/' AND o.object_type IN ('xxx', 'TABLE', 'VIEW')
  ORDER BY table_type, table_schem, table_name
6) SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
  WHERE o.owner LIKE :1 ESCAPE '/' AND o.object_name LIKE :2 ESCAPE '/' AND o.object_type IN ('xxx', 'TABLE', 'VIEW')
  ORDER BY table_type, table_schem, table_name
7) SELECT * FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE 1 = 0
8) SELECT GEOM AS GEOM FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE SDO_FILTER(GEOM, :1 , 'mask=anyinteract querytype=WINDOW') = 'TRUE'

And before executing each and every query above, the connection pool will check if the connection is still valid by executing the following query:
       select sysdate from dual (or select 1 from dual)

In the overview above you see that 2), 5) and 6) is the same query being executed 3 times per layer... so 30 times in our average case. If there is a "SCHEMA" defined (any) in the JNDI data store, this query takes 0.1 second per execution in our config... if not... +- 1 second per execution. This means that best-case this query accounts for 0.1 * 30 calls = 3 seconds added time for each WMS request... which means 66% of the time because our average WMS request takes 4.5 seconds.

It doesn't matter if it is the first WMS request for a layer/data store/... or the 10th... all queries are always executed, no caching behaviour, regardless of the setting of "Feature type cache size" in global settings.

Our configuration is as following:
  - Geoserver 2.2.0 (Linux, Oracle/Sun Java 1.6, Tomcat)
  - Oracle 11gR2

Question:
Is anyone else seeing this behavior... or is there something specific about our setup that causes these issues?

PS: It is pretty easy for anyone with select permissions on the (system) table v$sql to see the activity of a certain user using the following query:
  SELECT LAST_ACTIVE_TIME, last_load_time, module, parsing_schema_name, elapsed_time total_elapsed_time_micros, executions number_executions, DECODE(executions,0,0,round((elapsed_time/executions)/1000000,3)) avg_elapsed_time_s, sql_id, sql_fulltext FROM v$sql
  WHERE 1=1
    and parsing_schema_name IN (:username)
    -- and last_active_time > to_date('24/01/2011 16:13:00', 'DD/MM/YYYY HH24:MI:SS')
    -- and UPPER(sql_text) like UPPER('SELECT NULL AS table_cat,%')
    -- and sql_id = 'c749bc43qqfz3'
  ORDER BY LAST_ACTIVE_TIME DESC;

All this information is also contained in following geoserver bug report:
https://jira.codehaus.org/browse/GEOS-5317?focusedCommentId=334486&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-334486

Regards,
Pieter

Hi,
I’ve just tried out with a 2.3.4 I was working with, I only see 4 queries for each of my WMS requests, a line layer that I’ve renamed compared to the
raw table name to have a nicer looking name:

  1. SELECT GEOMETRY as GEOMETRY FROM GEOSERVER.GRAFO_EXP WHERE SDO_FILTER(GEOMETRY, :1, ‘mask=anyinteract querytype=WINDOW’) = ‘TRUE’
  2. select 1 from dual
  3. SELECT info from “GEOSERVER”.MDRT_6757$ where rowid = :rid
  4. select count(*) from mdsys.geodetic_srids where srid = :srid

As you know 1 and 2 cannot be avoided (well 2) can be removed by disabling connection validation)
3 is weird, must be generated by the jdbc driver but I have no idea why and what it is about
4) is used to determine if the srid is geodetic, there is a cache for this info, but it’s not doing its job, this one can definitely be eliminated

Not sure why you’re getting all the others. Might be the JDBC driver again (have you tried using a different one, maybe more recent?),
or something that has been fixed in the meantime.
Btw, I’m not using a JNDI connection, that might be a factor, however the GeoServer code does not even know where the connection pool
is coming from, so the difference could be caused, potentially, by the connection pool itself.

There is a number of things that could be the cause… needs more investigation.

Cheers
Andrea

···

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

Hello everyone,

We noticed while having a look at database activity from geoserver to Oracle there seem to be quite some inefficiencies…

After some looking around we found out that for every vector layer (configured using the oracle JNDI datastore) fetched from oracle there are 16 calls to the database… and since our average WMS requests needs 10 vector layers, this is 160 calls per WMS request.

This is an example of the database calls for a layer:

  1. SELECT WKTEXT FROM MDSYS.CS_SRS WHERE SRID = -1
  2. SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
    WHERE o.owner LIKE :1 ESCAPE ‘/’ AND o.object_name LIKE :2 ESCAPE ‘/’ AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’)
    ORDER BY table_type, table_schem, table_name
  3. SELECT * FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE 1 = 0
  4. SELECT WKTEXT FROM MDSYS.CS_SRS WHERE SRID = -1
  5. SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
    WHERE o.owner LIKE :1 ESCAPE ‘/’ AND o.object_name LIKE :2 ESCAPE ‘/’ AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’)
    ORDER BY table_type, table_schem, table_name
  6. SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o
    WHERE o.owner LIKE :1 ESCAPE ‘/’ AND o.object_name LIKE :2 ESCAPE ‘/’ AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’)
    ORDER BY table_type, table_schem, table_name
  7. SELECT * FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE 1 = 0
  8. SELECT GEOM AS GEOM FROM (SELECT geom FROM gis_objct WHERE layer_id = 40080) VTABLE WHERE SDO_FILTER(GEOM, :1 , ‘mask=anyinteract querytype=WINDOW’) = ‘TRUE’

And before executing each and every query above, the connection pool will check if the connection is still valid by executing the following query:
select sysdate from dual (or select 1 from dual)

In the overview above you see that 2), 5) and 6) is the same query being executed 3 times per layer… so 30 times in our average case. If there is a “SCHEMA” defined (any) in the JNDI data store, this query takes 0.1 second per execution in our config… if not… ± 1 second per execution. This means that best-case this query accounts for 0.1 * 30 calls = 3 seconds added time for each WMS request… which means 66% of the time because our average WMS request takes 4.5 seconds.

It doesn’t matter if it is the first WMS request for a layer/data store/… or the 10th… all queries are always executed, no caching behaviour, regardless of the setting of “Feature type cache size” in global settings.

Our configuration is as following:

  • Geoserver 2.2.0 (Linux, Oracle/Sun Java 1.6, Tomcat)
  • Oracle 11gR2

Question:
Is anyone else seeing this behavior… or is there something specific about our setup that causes these issues?

PS: It is pretty easy for anyone with select permissions on the (system) table v$sql to see the activity of a certain user using the following query:
SELECT LAST_ACTIVE_TIME, last_load_time, module, parsing_schema_name, elapsed_time total_elapsed_time_micros, executions number_executions, DECODE(executions,0,0,round((elapsed_time/executions)/1000000,3)) avg_elapsed_time_s, sql_id, sql_fulltext FROM v$sql
WHERE 1=1
and parsing_schema_name IN (:username)
– and last_active_time > to_date(‘24/01/2011 16:13:00’, ‘DD/MM/YYYY HH24:MI:SS’)
– and UPPER(sql_text) like UPPER(‘SELECT NULL AS table_cat,%’)
– and sql_id = ‘c749bc43qqfz3’
ORDER BY LAST_ACTIVE_TIME DESC;

All this information is also contained in following geoserver bug report:
https://jira.codehaus.org/browse/GEOS-5317?focusedCommentId=334486&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-334486

Regards,
Pieter


October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Fri, Oct 25, 2013 at 11:55 AM, Andrea Aime
<andrea.aime@anonymised.com>wrote:

Hi,
I've just tried out with a 2.3.4 I was working with, I only see 4 queries
for each of my WMS requests, a line layer that I've renamed compared to the
raw table name to have a nicer looking name:

1) SELECT GEOMETRY as GEOMETRY FROM GEOSERVER.GRAFO_EXP WHERE
SDO_FILTER(GEOMETRY, :1, 'mask=anyinteract querytype=WINDOW') = 'TRUE'
2) select 1 from dual
3) SELECT info from "GEOSERVER".MDRT_6757$ where rowid = :rid
4) select count(*) from mdsys.geodetic_srids where srid = :srid

As you know 1 and 2 cannot be avoided (well 2) can be removed by disabling
connection validation)
3 is weird, must be generated by the jdbc driver but I have no idea why
and what it is about

Ok, now I know what that is, it's an access to the spatial index. It may
well be it cannot be removed, but this one
too requires a bit more investigation.

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

In the overview above you see that 2), 5) and 6) is the same query being
executed 3 times per layer... so 30 times in our average case. If there is
a "SCHEMA" defined (any) in the JNDI data store, this query takes 0.1
second per execution in our config... if not... +- 1 second per execution.
This means that best-case this query accounts for 0.1 * 30 calls = 3
seconds added time for each WMS request... which means 66% of the time
because our average WMS request takes 4.5 seconds.

Btw, the 0.1s per query caught my eye. I have a small Oracle table in a
vanilla Oracle XE installed on Ubuntu 12.04 64 bit,
that I'm displaying fully (500 multilines), and I did a quick performance
check making 1000 wms requests with "ab" (ApacheBench), using a single
thread.
Here is the result:

Requests per second: 14.24 [#/sec] (mean)
Time per request: 70.203 [ms] (mean)

So, on my machine, GeoServer does 4 Oracle queries, paints the map, encodes
the result in PNG in less time than it takes for you to run a single SQL
statement?
That's odd, my desktop has a 3.5 years old core i7 860. I mean, I
understand in your case there will be a network in between, but still...

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

On Fri, Oct 25, 2013 at 12:18 PM, Andrea Aime
<andrea.aime@anonymised.com>wrote:

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

In the overview above you see that 2), 5) and 6) is the same query being
executed 3 times per layer... so 30 times in our average case. If there is
a "SCHEMA" defined (any) in the JNDI data store, this query takes 0.1
second per execution in our config... if not... +- 1 second per execution.
This means that best-case this query accounts for 0.1 * 30 calls = 3
seconds added time for each WMS request... which means 66% of the time
because our average WMS request takes 4.5 seconds.

Btw, the 0.1s per query caught my eye. I have a small Oracle table in a
vanilla Oracle XE installed on Ubuntu 12.04 64 bit,
that I'm displaying fully (500 multilines), and I did a quick performance
check making 1000 wms requests with "ab" (ApacheBench), using a single
thread.
Here is the result:

Requests per second: 14.24 [#/sec] (mean)
Time per request: 70.203 [ms] (mean)

While I was at it, I've turned down logging to PRODUCTION setting and
installed my new fast PNG encoder (available as a community module
for the dev series, but works fine in 2.3.x as well), and gave it another
kick:

Requests per second: 18.27 [#/sec] (mean)
Time per request: 54.736 [ms] (mean)

The queries are definitely taking less than 10ms each on my machine (as
confirmed by the v$sql AVG_ELAPSED_TIME_S column)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hello,

The 0.1 seconds is specific for the query on the ALL_OBJECTS system table…

The queries doing real work take typically indeed a fraction of this time… average about 0.03 seconds in our case… but those are layers containing between 5 and 5 million objects… Calling the same query returning all 500 objects of a table is definitely not representable in any case as this will just be cached… and starting from oracle 11R2 it will most likely even be cached in a client-side resultset cache in the JDBC driver…

We just tried upgrading the jdbc driver to 11.2.0.3 (same version as the database)… and this doesn’t solve the problem L…

Pieter

Verzonden: vrijdag 25 oktober 2013 12:30

···

On Fri, Oct 25, 2013 at 12:18 PM, Andrea Aime <andrea.aime@anonymised.com07…> wrote:

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

In the overview above you see that 2), 5) and 6) is the same query being executed 3 times per layer… so 30 times in our average case. If there is a “SCHEMA” defined (any) in the JNDI data store, this query takes 0.1 second per execution in our config… if not… ± 1 second per execution. This means that best-case this query accounts for 0.1 * 30 calls = 3 seconds added time for each WMS request… which means 66% of the time because our average WMS request takes 4.5 seconds.

Btw, the 0.1s per query caught my eye. I have a small Oracle table in a vanilla Oracle XE installed on Ubuntu 12.04 64 bit,

that I’m displaying fully (500 multilines), and I did a quick performance check making 1000 wms requests with “ab” (ApacheBench), using a single thread.

Here is the result:

Requests per second: 14.24 [#/sec] (mean)

Time per request: 70.203 [ms] (mean)

While I was at it, I’ve turned down logging to PRODUCTION setting and installed my new fast PNG encoder (available as a community module

for the dev series, but works fine in 2.3.x as well), and gave it another kick:

Requests per second: 18.27 [#/sec] (mean)

Time per request: 54.736 [ms] (mean)

The queries are definitely taking less than 10ms each on my machine (as confirmed by the v$sql AVG_ELAPSED_TIME_S column)

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


Beginning of next week we’ll try an upgrade to a more recent version to see if that helps… your tests with 2.3.4 at least seem promising… thanks for that.

I suppose it is best to upgrade to 2.4.1 immediately… so we’re good again for some time?

Regards,

Pieter

···

Van: Pieter Roggemans [mailto:Pieter.Roggemans@anonymised.com]
Verzonden: vrijdag 25 oktober 2013 13:01
Aan: ‘Andrea Aime’
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Oracle vector JNDI: bad performance due to 16 database calls per layer fetched

Hello,

The 0.1 seconds is specific for the query on the ALL_OBJECTS system table…

The queries doing real work take typically indeed a fraction of this time… average about 0.03 seconds in our case… but those are layers containing between 5 and 5 million objects… Calling the same query returning all 500 objects of a table is definitely not representable in any case as this will just be cached… and starting from oracle 11R2 it will most likely even be cached in a client-side resultset cache in the JDBC driver…

We just tried upgrading the jdbc driver to 11.2.0.3 (same version as the database)… and this doesn’t solve the problem L…

Pieter

Van: andrea.aime@anonymised.com [mailto:andrea.aime@anonymised.com] Namens Andrea Aime
Verzonden: vrijdag 25 oktober 2013 12:30
Aan: Pieter Roggemans
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Oracle vector JNDI: bad performance due to 16 database calls per layer fetched

On Fri, Oct 25, 2013 at 12:18 PM, Andrea Aime <andrea.aime@anonymised.com07…> wrote:

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

In the overview above you see that 2), 5) and 6) is the same query being executed 3 times per layer… so 30 times in our average case. If there is a “SCHEMA” defined (any) in the JNDI data store, this query takes 0.1 second per execution in our config… if not… ± 1 second per execution. This means that best-case this query accounts for 0.1 * 30 calls = 3 seconds added time for each WMS request… which means 66% of the time because our average WMS request takes 4.5 seconds.

Btw, the 0.1s per query caught my eye. I have a small Oracle table in a vanilla Oracle XE installed on Ubuntu 12.04 64 bit,

that I’m displaying fully (500 multilines), and I did a quick performance check making 1000 wms requests with “ab” (ApacheBench), using a single thread.

Here is the result:

Requests per second: 14.24 [#/sec] (mean)

Time per request: 70.203 [ms] (mean)

While I was at it, I’ve turned down logging to PRODUCTION setting and installed my new fast PNG encoder (available as a community module

for the dev series, but works fine in 2.3.x as well), and gave it another kick:

Requests per second: 18.27 [#/sec] (mean)

Time per request: 54.736 [ms] (mean)

The queries are definitely taking less than 10ms each on my machine (as confirmed by the v$sql AVG_ELAPSED_TIME_S column)

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


On Fri, Oct 25, 2013 at 2:03 PM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Beginning of next week we’ll try an upgrade to a more recent version to
see if that helps… your tests with 2.3.4 at least seem promising… thanks
for that.****

** **

I suppose it is best to upgrade to 2.4.1 immediately… so we’re good again
for some time?

That's something I would try, yes.
Mind, there have been large changes in the security subsystem since 2.2.0,
as well as significant changes in layer group configuration,
some users reported hiccups in the upgrade.

Please make a copy of your data directory and try running 2.4.1 against the
copy

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Hello everyone,

We noticed while having a look at database activity from geoserver to
Oracle there seem to be quite some inefficiencies...

Ah, another interesting find from 2.3.4, this time I've published a SQL
View (just noticed that your sql pointed at the usage of one,
not a simple table), this time the queries went up to 7:

select * from (select * from GRAFO_EXP) VTABLE where 1 = 0
select 'TABLE' as table_type from dual/nunion select 'VIEW' as table_type
from dual/nunion select 'SYNONYM' as table_type from dual/n
select 1 from dual
SELECT info from "GEOSERVER".MDRT_6757$ where rowid = :rid
select count(*) from mdsys.geodetic_srids where srid = :srid
SELECT NULL AS table_cat,/n o.owner AS table_schem,/n
o.object_name AS table_name,/n o.object_type AS table_type,/n
NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE '/'/n
   AND o.object_name LIKE :2 ESCAPE '/'/n AND o.object_type IN ('xxx',
'TABLE', 'VIEW', 'SYNONYM')/n ORDER BY table_type, table_schem,
table_name/n
SELECT GEOMETRY as GEOMETRY FROM (select * from GRAFO_EXP) VTABLE WHERE
SDO_FILTER(GEOMETRY, :1, 'mask=anyinteract querytype=WINDOW') = 'TRUE'

So there is extra inefficiency in using sql tables, I believe some of
which could be eliminated by caching some of the informations
the code is trying to gather about the structure of the result

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thanks for the warning!

The geoserver is a virtual server though, and we have separate DEV, TEST en PRODUCTION environments running… so the upgrade will be tried/tested on a clone of the DEV server… so we should be safe.

Pieter

Verzonden: vrijdag 25 oktober 2013 14:21

···

On Fri, Oct 25, 2013 at 2:03 PM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

Beginning of next week we’ll try an upgrade to a more recent version to see if that helps… your tests with 2.3.4 at least seem promising… thanks for that.

I suppose it is best to upgrade to 2.4.1 immediately… so we’re good again for some time?

That’s something I would try, yes.

Mind, there have been large changes in the security subsystem since 2.2.0, as well as significant changes in layer group configuration,

some users reported hiccups in the upgrade.

Please make a copy of your data directory and try running 2.4.1 against the copy

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


On Fri, Oct 25, 2013 at 1:00 PM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Hello,****

The 0.1 seconds is specific for the query on the ALL_OBJECTS system table…

Ah, ok, I misread your initial mail, thought you were calculating the time
for a single layer, but instead you're computing the overhead of
that particular query for the 10 layers instead

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Ouch… the culprit shows up now in 2.3.4 as well… so upgrading won’t solve the problem… at best it will reduce the problem:

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n o.object_name AS table_name,/n o.object_type AS table_type,/n NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE ‘/’/n AND o.object_name LIKE :2 ESCAPE ‘/’/n AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’, ‘SYNONYM’)/n ORDER BY table_type, table_schem, table_name/n

Is the above query only executed once per layer fetched in a WMS call? In our case it is 3 times per layer…

Regards,

Pieter

Verzonden: vrijdag 25 oktober 2013 14:26

···

On Fri, Oct 25, 2013 at 10:27 AM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

Hello everyone,

We noticed while having a look at database activity from geoserver to Oracle there seem to be quite some inefficiencies…

Ah, another interesting find from 2.3.4, this time I’ve published a SQL View (just noticed that your sql pointed at the usage of one,

not a simple table), this time the queries went up to 7:

select * from (select * from GRAFO_EXP) VTABLE where 1 = 0

select ‘TABLE’ as table_type from dual/nunion select ‘VIEW’ as table_type from dual/nunion select ‘SYNONYM’ as table_type from dual/n

select 1 from dual

SELECT info from “GEOSERVER”.MDRT_6757$ where rowid = :rid

select count(*) from mdsys.geodetic_srids where srid = :srid

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n o.object_name AS table_name,/n o.object_type AS table_type,/n NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE ‘/’/n AND o.object_name LIKE :2 ESCAPE ‘/’/n AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’, ‘SYNONYM’)/n ORDER BY table_type, table_schem, table_name/n

SELECT GEOMETRY as GEOMETRY FROM (select * from GRAFO_EXP) VTABLE WHERE SDO_FILTER(GEOMETRY, :1, ‘mask=anyinteract querytype=WINDOW’) = ‘TRUE’

So there is extra inefficiency in using sql tables, I believe some of which could be eliminated by caching some of the informations

the code is trying to gather about the structure of the result

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


On Fri, Oct 25, 2013 at 2:40 PM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Ouch… the culprit shows up now in 2.3.4 as well… so upgrading won’t
solve the problem… at best it will reduce the problem:****

** **

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n
o.object_name AS table_name,/n o.object_type AS table_type,/n
NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE '/'/n
   AND o.object_name LIKE :2 ESCAPE '/'/n AND o.object_type IN ('xxx',
'TABLE', 'VIEW', 'SYNONYM')/n ORDER BY table_type, table_schem,
table_name/n****

** **

Is the above query only executed once per layer fetched in a WMS call? In
our case it is 3 times per layer…

I have dumped all the queries performed for one wms call over a sql view in
my previous mail.
So yes, it's happening once per call.
Can probably be optimized out with some caching, not 100% sure, some
investigation in the code would be needed

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

OK.

This means that the best-case of migrating now to a newer version would be that we would “only” loose one second per WMS request instead of 3 seconds per WMS request… This is a significant improvement… if the behavior is the same in our environment… but nonetheless it stays a very suboptimal situation.

Hopefully you find the time to have a look into the code to check if it is possible to optimize these issues away…

Pieter

Verzonden: vrijdag 25 oktober 2013 14:43

···

On Fri, Oct 25, 2013 at 2:40 PM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

Ouch… the culprit shows up now in 2.3.4 as well… so upgrading won’t solve the problem… at best it will reduce the problem:

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n o.object_name AS table_name,/n o.object_type AS table_type,/n NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE ‘/’/n AND o.object_name LIKE :2 ESCAPE ‘/’/n AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’, ‘SYNONYM’)/n ORDER BY table_type, table_schem, table_name/n

Is the above query only executed once per layer fetched in a WMS call? In our case it is 3 times per layer…

I have dumped all the queries performed for one wms call over a sql view in my previous mail.

So yes, it’s happening once per call.

Can probably be optimized out with some caching, not 100% sure, some investigation in the code would be needed

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


Hi Both,
I’m arriving a little late to this one.

I’m using “Oracle NG” for my connection (Geoserver 2.4.1) and don’t appear to be seeing this, although maybe I’m looking in the wrong places. Is this something unique to the JNDI driver?

The debug level GeoServer logging is only showing one request made, and the v$sql query only appears to be one as well (though I may well be mis-reading both).

So maybe you could try a different Oracle connection type?

Jonathan

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

On 25 October 2013 14:18, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

OK.

This means that the best-case of migrating now to a newer version would be that we would “only” loose one second per WMS request instead of 3 seconds per WMS request… This is a significant improvement… if the behavior is the same in our environment… but nonetheless it stays a very suboptimal situation.

Hopefully you find the time to have a look into the code to check if it is possible to optimize these issues away…

Pieter

Van: andrea.aime@anonymised.com [mailto:andrea.aime@anonymised.com] Namens Andrea Aime
Verzonden: vrijdag 25 oktober 2013 14:43

Aan: Pieter Roggemans
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Oracle vector JNDI: bad performance due to 16 database calls per layer fetched

On Fri, Oct 25, 2013 at 2:40 PM, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

Ouch… the culprit shows up now in 2.3.4 as well… so upgrading won’t solve the problem… at best it will reduce the problem:

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n o.object_name AS table_name,/n o.object_type AS table_type,/n NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE ‘/’/n AND o.object_name LIKE :2 ESCAPE ‘/’/n AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’, ‘SYNONYM’)/n ORDER BY table_type, table_schem, table_name/n

Is the above query only executed once per layer fetched in a WMS call? In our case it is 3 times per layer…

I have dumped all the queries performed for one wms call over a sql view in my previous mail.

So yes, it’s happening once per call.

Can probably be optimized out with some caching, not 100% sure, some investigation in the code would be needed

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it



October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hello,

Thanks for looking into this.

When I did my tests last year “Oracle NG” and “Oracle JNDI” gave the same results… but when I retested now on our current environment (geoserver 2.2.0 instead of 2.1.4) there are indeed significant differences between the two:

  • Oracle JNDI (using an “SQL view” layer):

  • 16 calls to the database per layer, and query “SELECT NULL AS table_cat…” takes 0.1 second per execution

  • 8 out of the 16 calls it is the validation query or the JNDI connection pool

  • Oracle NG (using an “SQL view” layer):

  • 2 calls to the database per layer:

  • the query getting the data

  • ± the data query but with an extra “where 1=0” appended

  • NO validation query, even though the “validation query” checkbox is enabled in the data store definition. Or is the “where 1=0” query the validation query?

So… it seems that the “Oracle NG“ datastore is a lot better… I just wonder if it really is validating its connection or not…

Thanks a lot for this feedback… it looks “Oracle NG” might save us. There are some disadvantages with it, like the password that needs to be specified in each datastore instead of in the tomcat configuration… but… these are minor inconveniences compared to the performance problems…

I’ll keep you guys posted…

Thanks!!!

Pieter

Verzonden: dinsdag 29 oktober 2013 13:31

···

Hi Both,

I’m arriving a little late to this one.

I’m using “Oracle NG” for my connection (Geoserver 2.4.1) and don’t appear to be seeing this, although maybe I’m looking in the wrong places. Is this something unique to the JNDI driver?

The debug level GeoServer logging is only showing one request made, and the v$sql query only appears to be one as well (though I may well be mis-reading both).

So maybe you could try a different Oracle connection type?

Jonathan

On 25 October 2013 14:18, Pieter Roggemans <Pieter.Roggemans@anonymised.com> wrote:

OK.

This means that the best-case of migrating now to a newer version would be that we would “only” loose one second per WMS request instead of 3 seconds per WMS request… This is a significant improvement… if the behavior is the same in our environment… but nonetheless it stays a very suboptimal situation.

Hopefully you find the time to have a look into the code to check if it is possible to optimize these issues away…

Pieter

Van: andrea.aime@anonymised.com… [mailto:andrea.aime@anonymised.com] Namens Andrea Aime
Verzonden: vrijdag 25 oktober 2013 14:43

Aan: Pieter Roggemans
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Oracle vector JNDI: bad performance due to 16 database calls per layer fetched

On Fri, Oct 25, 2013 at 2:40 PM, Pieter Roggemans <Pieter.Roggemans@anonymised.com48…> wrote:

Ouch… the culprit shows up now in 2.3.4 as well… so upgrading won’t solve the problem… at best it will reduce the problem:

SELECT NULL AS table_cat,/n o.owner AS table_schem,/n o.object_name AS table_name,/n o.object_type AS table_type,/n NULL AS remarks/n FROM all_objects o/n WHERE o.owner LIKE :1 ESCAPE ‘/’/n AND o.object_name LIKE :2 ESCAPE ‘/’/n AND o.object_type IN (‘xxx’, ‘TABLE’, ‘VIEW’, ‘SYNONYM’)/n ORDER BY table_type, table_schem, table_name/n

Is the above query only executed once per layer fetched in a WMS call? In our case it is 3 times per layer…

I have dumped all the queries performed for one wms call over a sql view in my previous mail.

So yes, it’s happening once per call.

Can probably be optimized out with some caching, not 100% sure, some investigation in the code would be needed

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it



October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

On Wed, Oct 30, 2013 at 6:03 PM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Hello,****

Thanks for looking into this.****

** **

When I did my tests last year “Oracle NG” and “Oracle JNDI” gave the same
results… but when I retested now on our current environment (geoserver
2.2.0 instead of 2.1.4) there are indeed significant differences between
the two:****

** **

- Oracle JNDI (using an “SQL view” layer):****

        - 16 calls to the database per layer, and query “SELECT NULL AS
table_cat…” takes 0.1 second per execution****

        - 8 out of the 16 calls it is the validation query or the JNDI
connection pool****

** **

- Oracle NG (using an “SQL view” layer):****

        - 2 calls to the database per layer: ****

                - the query getting the data****

                - +- the data query but with an extra “where 1=0” appended
****

        - NO validation query, even though the “validation query” checkbox
is enabled in the data store definition. Or is the “where 1=0” query the
validation query?

It is not. No idea why it's not happening, I have it in my logs (from
2.3.x).
What's weird is that the JNDI one just sets up the connection pool in a
different way... and also strange, its name should be "Oracle NG (JNDI)",
not "Oracle JNDI"

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Sorry… if this caused confusion… the datastore is called Oracle NG (JNDI) here as well…
P

-------- Oorspronkelijk bericht --------

···

Hello,

Thanks for looking into this.

When I did my tests last year “Oracle NG” and “Oracle JNDI” gave the same results… but when I retested now on our current environment (geoserver 2.2.0 instead of 2.1.4) there are indeed significant differences between the two:

  • Oracle JNDI (using an “SQL view” layer):

  • 16 calls to the database per layer, and query “SELECT NULL AS table_cat…” takes 0.1 second per execution

  • 8 out of the 16 calls it is the validation query or the JNDI connection pool

  • Oracle NG (using an “SQL view” layer):

  • 2 calls to the database per layer:

  • the query getting the data

  • ± the data query but with an extra “where 1=0” appended

  • NO validation query, even though the “validation query” checkbox is enabled in the data store definition. Or is the “where 1=0” query the validation query?

It is not. No idea why it’s not happening, I have it in my logs (from 2.3.x).
What’s weird is that the JNDI one just sets up the connection pool in a different way… and also strange, its name should be “Oracle NG (JNDI)”, not “Oracle JNDI”

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


For the validation query… In a few days I’l be able to retest in 2.4.1

-------- Oorspronkelijk bericht --------

···

Hello,

Thanks for looking into this.

When I did my tests last year “Oracle NG” and “Oracle JNDI” gave the same results… but when I retested now on our current environment (geoserver 2.2.0 instead of 2.1.4) there are indeed significant differences between the two:

  • Oracle JNDI (using an “SQL view” layer):

  • 16 calls to the database per layer, and query “SELECT NULL AS table_cat…” takes 0.1 second per execution

  • 8 out of the 16 calls it is the validation query or the JNDI connection pool

  • Oracle NG (using an “SQL view” layer):

  • 2 calls to the database per layer:

  • the query getting the data

  • ± the data query but with an extra “where 1=0” appended

  • NO validation query, even though the “validation query” checkbox is enabled in the data store definition. Or is the “where 1=0” query the validation query?

It is not. No idea why it’s not happening, I have it in my logs (from 2.3.x).
What’s weird is that the JNDI one just sets up the connection pool in a different way… and also strange, its name should be “Oracle NG (JNDI)”, not “Oracle JNDI”

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Wed, Oct 30, 2013 at 6:34 PM, Pieter Roggemans <
Pieter.Roggemans@anonymised.com> wrote:

Sorry.. if this caused confusion... the datastore is called Oracle NG
(JNDI) here as well...

Had to ask because "Oracle JNDI" is the name of an old version of the
Oracle store that should not be around anymore :slight_smile:

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------