[Geoserver-devel] Renderers and Data Access

Hi Chris - thanks for taking up the cause of rendering.

James talked David through switching over to StyledMapRenderer - the deprecated
messages steered us in that direction. But you are right that LiteRenderer
would be the better choice (at least I think so with my limited knoweldge of the
two).

While you are talking about abort() and the data access I remembered something
that has been lurking in the back of my mind for a bit. Actually talking with
Gabriel stired the pot as well (He had run into what he thought was a deadlock
when trying to work on writing).

When we were benchmarking GeoServer we ran into an interesting observation - it
looked for all the world like requests were being serialized. This is not cool
- but at the time we blamed the web container and went on.

The more I think about it though the more I wonder if it is some horrible
synchornized tag to do with access to DataStores. Do you know if we are
serialized at the moment - or is this expected behaviour.

Jody

On Monday 12 April 2004 07:17, jgarnett@anonymised.com wrote:

Hi Chris - thanks for taking up the cause of rendering.

James talked David through switching over to StyledMapRenderer - the
deprecated messages steered us in that direction. But you are right that
LiteRenderer would be the better choice (at least I think so with my
limited knoweldge of the two).

You can use the LiteRenderer without using deprecated methods and using
the MapContext. Now, StyledMapRenderer could really boost a map server
performance provided that:
* the layers in the map can be kept in memory in rendered form (which
  pretty much means, keeping in memory the geometries, if the styling is not
  complex);
* the map does not change from one request to another. That is, you serve
  the MapContext. This does not match the WMS specification I think, but it's
  quite a commonplace way for serving internet maps (that is, the legend and
  layers are predefined, you usually just have a choice of making them visible
  or not)

If the usage patter is like the above and the map can fit in memory, and you
cache the rendered layers instead of throwing them away like the JAIMapResponse
does now, StyledMapRenderer is faster. Otherwise, LiteRenderer is faster and
eats way less memory. If you prepare a memory sensitive cache of rendered layers,
and if we could break the single big rendered layer into sublayers that could be created
and cached selectively, then I think that the StyledMapRenderer would become a
powerful way to render maps even in a WMS.

So, short term solution: switch back to LiteRenderer for the moment.
Long term solution: adapt the StyledMapRenderer for selective data loading and caching
to get really good performance.

Best regards
Andrea Aime

----- Original Message -----
From: <jgarnett@anonymised.com>
To: "Chris Holmes" <cholmes@anonymised.com>
Cc: <Geoserver-devel@lists.sourceforge.net>
Sent: Monday, April 12, 2004 9:17 AM
Subject: [Geoserver-devel] Renderers and Data Access

While you are talking about abort() and the data access I remembered

something

that has been lurking in the back of my mind for a bit. Actually talking

with

Gabriel stired the pot as well (He had run into what he thought was a

deadlock

when trying to work on writing).

Actually it could arise from the sde connection policy. The lack of good
documentation is hitting me. Hopefully I'll could advance this week.

When we were benchmarking GeoServer we ran into an interesting

observation - it

looked for all the world like requests were being serialized. This is not

cool

- but at the time we blamed the web container and went on.

hey! shouldn't you being benchmarking against the sde datastore? it has a
pool.minConnections and pool.maxConnections parameters. The default is 1 for
both cases. The "safe" connection policy is to hold the connection until
close() or hasNext() == false inside the arcsde FeaturreReader. It means
that if you run 2 queries simultaneously the second will wait till the
connection gets released or timeout has reached.

Currently I'm experimenting with shared conections by multiple requests.
Looks good, up to 24 requests per connection but... _sometimes_ it locks...
(dead locks?)

anyway.. I'll keep trying, since connections == licenses is an ISSUE whan
talking about ArcSDE.

regards,

Gabriel

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

When we were benchmarking GeoServer we ran into an interesting
observation - it
looked for all the world like requests were being serialized. This
is not cool
- but at the time we blamed the web container and went on.

Were you by any chance using mozilla to do this?

Hey, I've been playing with some scalability stuff with geoserver today,
nothing scientific, just working with some large datasets, and I think
I may have hit on your issue with having geoserver do serial requests.

I was testing simultaneous requests today, checking to see if the lite
renderer's abort method works (I think it does, but I think we still
hold the image that it was drawing in memory, so I was getting some out
of memory errors - did make use of the free memory admin tool though,
which was nice (though it's got some issues with positive and negative
values, reports it freed negative abounts of memory)), and I noticed if
I issued three getMap requests in mozilla then the calls for the second
and then third would not be issued until the first completed. On ie it
would send them as soon as requested and start working on the
responses. I couldn't really test GetFeature since my mozilla gets all
slow at anything over like 300 features, so it's just a pain to work
with for large getFeature requests. So yeah, if you run into the
problem again try it out on a different browser and see if that's the
reason. I guess maybe mozilla does it when you're requesting stuff
from the same server? I don't know, but that's what I observed.

The lite renderer seems to be performing nicely now, thanks for the
hints Andrea, and the implementation Gabriel. And we've got James's
bug with property names in styles fixed too, thanks for noticing that.
So overall the WMS is looking pretty good. My only question is who
wants to do user defined SLD? :slight_smile:

Also, if anyone has any idea how to trash the graphic that the
LiteRenderer is working on when stopRendering is called let me know.

Chris

Hi Chris - thanks for taking up the cause of rendering.

James talked David through switching over to StyledMapRenderer - the
deprecated
messages steered us in that direction. But you are right that
LiteRenderer
would be the better choice (at least I think so with my limited
knoweldge of the
two).

While you are talking about abort() and the data access I remembered
something
that has been lurking in the back of my mind for a bit. Actually
talking with
Gabriel stired the pot as well (He had run into what he thought was a
deadlock
when trying to work on writing).

When we were benchmarking GeoServer we ran into an interesting
observation - it
looked for all the world like requests were being serialized. This
is not cool
- but at the time we blamed the web container and went on.

The more I think about it though the more I wonder if it is some
horrible
synchornized tag to do with access to DataStores. Do you know if we
are
serialized at the moment - or is this expected behaviour.

Jody

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

On Sunday 18 April 2004 10:53, Chris Holmes wrote:

> When we were benchmarking GeoServer we ran into an interesting
> observation - it
> looked for all the world like requests were being serialized. This
> is not cool
> - but at the time we blamed the web container and went on.

Were you by any chance using mozilla to do this?

Hey, I've been playing with some scalability stuff with geoserver today,
nothing scientific, just working with some large datasets, and I think
I may have hit on your issue with having geoserver do serial requests.

I was testing simultaneous requests today, checking to see if the lite
renderer's abort method works (I think it does, but I think we still
hold the image that it was drawing in memory, so I was getting some out
of memory errors - did make use of the free memory admin tool though,
which was nice (though it's got some issues with positive and negative
values, reports it freed negative abounts of memory)), and I noticed if
I issued three getMap requests in mozilla then the calls for the second
and then third would not be issued until the first completed. On ie it
would send them as soon as requested and start working on the
responses.

AFAIK Mozilla uses HTTP 1.1 by default, so it uses persistent connection,
and also as far as I rembember no more than 4 of those connection are
used simultaneously. Maybe IE doesn't use 1.1 or uses a higher number of
connections? Also, separate IE windows are separate processes, whilst
separate Mozilla windows are the same process, so it may be they are sharing
the same set of connection. Just wild guesses, I really don't know what's
going on. Are you using Mozilla 1.6?

I couldn't really test GetFeature since my mozilla gets all
slow at anything over like 300 features, so it's just a pain to work
with for large getFeature requests.

So you're speaking about WFS requests? Funny, it's quite a bit
of time Mozilla I don't experience perf. problems with large documents...

Also, if anyone has any idea how to trash the graphic that the
LiteRenderer is working on when stopRendering is called let me know.

LiteRenderer cannot thrash it since it is provided from outside... I think
it should disposed at the end of the request. I've attached a small patch that
uses only one graphics object instead of two and that disposes it when done.
It should be easy to apply with Eclipse (Team -> Apply Patch).
Sorry for not committing it myself, but I don't have time to setup geoserver
to test it.

Best regards
Andrea Aime

Index: JAIMapResponse.java

RCS file:
/cvsroot/geoserver/geoserver/src/org/vfny/geoserver/responses/wms/map/JAIMapResponse.java,v
retrieving revision 1.20
diff -u -r1.20 JAIMapResponse.java
--- JAIMapResponse.java 18 Apr 2004 11:01:40 -0000 1.20
+++ JAIMapResponse.java 18 Apr 2004 14:38:14 -0000
@@ -263,7 +263,7 @@
                     BufferedImage.TYPE_INT_RGB);

             //LOGGER.fine("setting up renderer");
- java.awt.Graphics g = image.getGraphics();
+ Graphics2D g = image.createGraphics();
             g.setColor(request.getBgColor());

             if (!request.isTransparent()) {
@@ -279,7 +279,9 @@
             AffineTransform at = renderer.worldToScreenTransform(dataArea,
                     paintArea);

- renderer.paint((Graphics2D) image.getGraphics(), paintArea, at);
+ renderer.paint(g, paintArea, at);
+ g.dispose();
+
             LOGGER.fine("called renderer");

             map = null;

On Sunday 18 April 2004 10:53, Chris Holmes wrote:
> > When we were benchmarking GeoServer we ran into an interesting
> > observation - it
> > looked for all the world like requests were being serialized.
This
> > is not cool
> > - but at the time we blamed the web container and went on.
>
> Were you by any chance using mozilla to do this?
>
> Hey, I've been playing with some scalability stuff with geoserver
today,
> nothing scientific, just working with some large datasets, and I
think
> I may have hit on your issue with having geoserver do serial
requests.
>
> I was testing simultaneous requests today, checking to see if the
lite
> renderer's abort method works (I think it does, but I think we
still
> hold the image that it was drawing in memory, so I was getting some
out
> of memory errors - did make use of the free memory admin tool
though,
> which was nice (though it's got some issues with positive and
negative
> values, reports it freed negative abounts of memory)), and I
noticed if
> I issued three getMap requests in mozilla then the calls for the
second
> and then third would not be issued until the first completed. On
ie it
> would send them as soon as requested and start working on the
> responses.

AFAIK Mozilla uses HTTP 1.1 by default, so it uses persistent
connection,
and also as far as I rembember no more than 4 of those connection are
used simultaneously. Maybe IE doesn't use 1.1 or uses a higher number
of
connections? Also, separate IE windows are separate processes, whilst
separate Mozilla windows are the same process, so it may be they are
sharing
the same set of connection. Just wild guesses, I really don't know
what's
going on. Are you using Mozilla 1.6?

Yeah, 1.6. Yeah, I guessed it's something like IE windows being
seperate processes as well...

> I couldn't really test GetFeature since my mozilla gets all
> slow at anything over like 300 features, so it's just a pain to
work
> with for large getFeature requests.

So you're speaking about WFS requests? Funny, it's quite a bit
of time Mozilla I don't experience perf. problems with large
documents...

Well, it's only with these wfs responses that I do. Keep in mind that
essentially what I'm doing is sending like 5 or 10 megs of data that
Mozilla tries to display for me, doing its nice xml printing, all in
one really large window. It doesn't surprise me that it falls over.
IE will handle a bit more, but will still mess up with a big enough
request. But yeah, the problem is trying to actually portray a ton of
data. If I just saved the document it'd be much easier, I guess with a
save target as or something, or if we changed the mime type.

> Also, if anyone has any idea how to trash the graphic that the
> LiteRenderer is working on when stopRendering is called let me
know.

LiteRenderer cannot thrash it since it is provided from outside... I
think
it should disposed at the end of the request. I've attached a small
patch that
uses only one graphics object instead of two and that disposes it
when done.
It should be easy to apply with Eclipse (Team -> Apply Patch).
Sorry for not committing it myself, but I don't have time to setup
geoserver
to test it.

No worries about not committing at all, thanks a ton for the patch.
Just tested it and yeah, seems to work better, was not able to
reproduce my out of memory error, doing like 20 very large getMap
requests all at once, canceling 16 of them (just hit reload a few times
on 4 browser windows, one mozilla and three ie). Granted my cpu was
floored for quite awhile, but no out of memory errors. I also made one
small improvment on the patch you gave me, held the graphic as a
private variable and called dispose when abort was called if the
graphic was not null. Seems like it might help free up memory, and
doesn't seem to hurt anything. But yeah, it's looking like the lite
renderer is now performing quite nicely, as I tried pretty hard to get
an out of memory error, thanks a ton for all your help.

Chris

Best regards
Andrea Aime

Index: JAIMapResponse.java

RCS file:

/cvsroot/geoserver/geoserver/src/org/vfny/geoserver/responses/wms/map/JAIMapResponse.java,v

retrieving revision 1.20
diff -u -r1.20 JAIMapResponse.java
--- JAIMapResponse.java 18 Apr 2004 11:01:40 -0000 1.20
+++ JAIMapResponse.java 18 Apr 2004 14:38:14 -0000
@@ -263,7 +263,7 @@
                     BufferedImage.TYPE_INT_RGB);

             //LOGGER.fine("setting up renderer");
- java.awt.Graphics g = image.getGraphics();
+ Graphics2D g = image.createGraphics();
             g.setColor(request.getBgColor());

             if (!request.isTransparent()) {
@@ -279,7 +279,9 @@
             AffineTransform at =
renderer.worldToScreenTransform(dataArea,
                     paintArea);

- renderer.paint((Graphics2D) image.getGraphics(),
paintArea, at);
+ renderer.paint(g, paintArea, at);
+ g.dispose();
+
             LOGGER.fine("called renderer");

             map = null;

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

Quoting cholmes@anonymised.com:

> On Sunday 18 April 2004 10:53, Chris Holmes wrote:
> > > When we were benchmarking GeoServer we ran into an interesting
> > > observation - it
> > > looked for all the world like requests were being serialized.
> This
> > > is not cool
> > > - but at the time we blamed the web container and went on.
> >
> > Were you by any chance using mozilla to do this?

No we were not - we had a separate client app that was performing thousands of
getFeatre and Insert requests. We can post the tester to the list on Monday.

> > I was testing simultaneous requests today, checking to see if the
> lite
> > renderer's abort method works (I think it does, but I think we
> still
> > hold the image that it was drawing in memory, so I was getting some
> out
> > of memory errors - did make use of the free memory admin tool
> though,
> > which was nice (though it's got some issues with positive and
> negative
> > values, reports it freed negative abounts of memory)),

Yes we should fix that one - although at the time the code looked correct.

On Sunday 18 April 2004 15:42, cholmes@anonymised.com wrote:

> On Sunday 18 April 2004 10:53, Chris Holmes wrote:

...

No worries about not committing at all, thanks a ton for the patch.
Just tested it and yeah, seems to work better, was not able to
reproduce my out of memory error, doing like 20 very large getMap
requests all at once, canceling 16 of them (just hit reload a few times
on 4 browser windows, one mozilla and three ie). Granted my cpu was
floored for quite awhile, but no out of memory errors.

Hum... that's probably due to scheduling problems... maybe the processing
thread should get a lower priority than control threads so that the latter
can notify aborting to the processing ones faster... just a wild guess, and
probably in a container you're not allowed to change thread priority anyway...

I also made one
small improvment on the patch you gave me, held the graphic as a
private variable and called dispose when abort was called if the
graphic was not null. Seems like it might help free up memory, and
doesn't seem to hurt anything.

Hmm... not sure about it. The LiteRenderer will continue to use the
Graphics object until it loops to the next feature, since the check for
the abort is done when it starts to process a new feature. The API
says that after calling dispose you should not use it anymore, so I'm
not sure it's ok to keep or running over a disposed graphics object:
if it just throws and exception, that's not a problem, but may it destabilize
things on lesser tested platforms? I don't know...

Best regards
Andrea Aime

> > > > When we were benchmarking GeoServer we ran into an
interesting
> > > > observation - it
> > > > looked for all the world like requests were being serialized.
> > This
> > > > is not cool
> > > > - but at the time we blamed the web container and went on.
> > >
> > > Were you by any chance using mozilla to do this?

No we were not - we had a separate client app that was performing
thousands of
getFeatre and Insert requests. We can post the tester to the list on
Monday.

Yeah, that would be good. As Rob pointed out we should start to
formalize these tests, since we're actually getting to the point where
spending good time on scalability would be a good idea, since all the
basics seem to be working pretty well. Perhaps integrate the tester
into some ant targets? Would be nice if people could easily run
performance tests, see how well geoserver holds up on their os, servlet
container, ect. Would also be great if some one could take some time
and experiment with JProbe, as I don't think anyone's really done that,
and there's probably some easy performance gains to be had.

> > > I was testing simultaneous requests today, checking to see if
the
> > lite
> > > renderer's abort method works (I think it does, but I think we
> > still
> > > hold the image that it was drawing in memory, so I was getting
some
> > out
> > > of memory errors - did make use of the free memory admin tool
> > though,
> > > which was nice (though it's got some issues with positive and
> > negative
> > > values, reports it freed negative abounts of memory)),

Yes we should fix that one - although at the time the code looked
correct.

Yeah, looks like some random negative where it should be a positive...

Chris

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

On Sunday 18 April 2004 15:42, cholmes@anonymised.com wrote:
> > On Sunday 18 April 2004 10:53, Chris Holmes wrote:

...

> No worries about not committing at all, thanks a ton for the patch.
> Just tested it and yeah, seems to work better, was not able to
> reproduce my out of memory error, doing like 20 very large getMap
> requests all at once, canceling 16 of them (just hit reload a few
times
> on 4 browser windows, one mozilla and three ie). Granted my cpu
was
> floored for quite awhile, but no out of memory errors.

Hum... that's probably due to scheduling problems... maybe the
processing
thread should get a lower priority than control threads so that the
latter
can notify aborting to the processing ones faster... just a wild
guess, and
probably in a container you're not allowed to change thread priority
anyway...

Yeah, I think you're probably right, as when the client hits cancel it
shows up in the console, and they don't show up for awhile, not until
the other requests are returned, if I remember right. I was thinking
that that may just be the logger not showing up the results, but your
explanation makes a lot more sense. Not sure about changing priorities
in a container, how would I if I wanted to? (I don't know threading
stuff very well)

> I also made one
> small improvment on the patch you gave me, held the graphic as a
> private variable and called dispose when abort was called if the
> graphic was not null. Seems like it might help free up memory, and
> doesn't seem to hurt anything.

Hmm... not sure about it. The LiteRenderer will continue to use the
Graphics object until it loops to the next feature, since the check
for
the abort is done when it starts to process a new feature. The API
says that after calling dispose you should not use it anymore, so I'm
not sure it's ok to keep or running over a disposed graphics object:
if it just throws and exception, that's not a problem, but may it
destabilize
things on lesser tested platforms? I don't know...

I'm not sure either. I didn't get any errors, but that also could be
due to the thread stuff above. I guess I'll comment it out for now and
test later. Does it free up a lot of memory though? Or not so much?
If it does I may be inclined to leave it in and then just remove it if
we actually have problems.

Chris

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

cholmes@anonymised.com wrote:

On Sunday 18 April 2004 15:42, cholmes@anonymised.com wrote:

On Sunday 18 April 2004 10:53, Chris Holmes wrote:

...

No worries about not committing at all, thanks a ton for the patch.
Just tested it and yeah, seems to work better, was not able to
reproduce my out of memory error, doing like 20 very large getMap
requests all at once, canceling 16 of them (just hit reload a few

times

on 4 browser windows, one mozilla and three ie). Granted my cpu

was

floored for quite awhile, but no out of memory errors.

Hum... that's probably due to scheduling problems... maybe the
processing
thread should get a lower priority than control threads so that the
latter
can notify aborting to the processing ones faster... just a wild
guess, and
probably in a container you're not allowed to change thread priority
anyway...

Yeah, I think you're probably right, as when the client hits cancel it
shows up in the console, and they don't show up for awhile, not until
the other requests are returned, if I remember right. I was thinking
that that may just be the logger not showing up the results, but your
explanation makes a lot more sense. Not sure about changing priorities
in a container, how would I if I wanted to? (I don't know threading
stuff very well)

I don't know either, sorry...

I also made one
small improvment on the patch you gave me, held the graphic as a
private variable and called dispose when abort was called if the
graphic was not null. Seems like it might help free up memory, and
doesn't seem to hurt anything.

Hmm... not sure about it. The LiteRenderer will continue to use the
Graphics object until it loops to the next feature, since the check
for
the abort is done when it starts to process a new feature. The API
says that after calling dispose you should not use it anymore, so I'm
not sure it's ok to keep or running over a disposed graphics object:
if it just throws and exception, that's not a problem, but may it
destabilize
things on lesser tested platforms? I don't know...

I'm not sure either. I didn't get any errors, but that also could be
due to the thread stuff above. I guess I'll comment it out for now and
test later. Does it free up a lot of memory though? Or not so much?

No idea as well... sorry....

Best regards
Andrea Aime

We used org.vfny.geoserver.ThreadedBatchTester, usage is included (if you have any other questions email me)

David*
*
jgarnett@anonymised.com wrote:

Quoting cholmes@anonymised.com:

On Sunday 18 April 2004 10:53, Chris Holmes wrote:
     

When we were benchmarking GeoServer we ran into an interesting
observation - it
looked for all the world like requests were being serialized.
         

This
     

is not cool
- but at the time we blamed the web container and went on.
         

Were you by any chance using mozilla to do this?
       
No we were not - we had a separate client app that was performing thousands of
getFeatre and Insert requests. We can post the tester to the list on Monday.

I was testing simultaneous requests today, checking to see if the
       

lite
     

renderer's abort method works (I think it does, but I think we
       

still
     

hold the image that it was drawing in memory, so I was getting some
       

out
     

of memory errors - did make use of the free memory admin tool
       

though,
     

which was nice (though it's got some issues with positive and
       

negative
     

values, reports it freed negative abounts of memory)),
       
Yes we should fix that one - although at the time the code looked correct.

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel