<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Re: [UMN_MAPSERVER-USERS] Java MapScript issues Servlet</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText68143 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>To All,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Umberto and Mario are correct about the
problems I've had. They are definitely related to the lack of thread
safety in my mapscript.dll that I built using MS Visual C tools. Can
anyone tell me why I don't have the option to turn on thread safety in nmake.opt
(unlike in *Nix flavors of the build option files)? Was it an oversight,
future feature or excluded because it is included by default whenever mapserver
is built in Windows and there is no need to turn it off?</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>Joe Miller</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List on behalf of
Umberto Nicoletti<BR><B>Sent:</B> Mon 2/28/2005 10:31 AM<BR><B>To:</B>
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS] Java
MapScript issues Servlet<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Quoting "Mario H. Basa" <mhbasa@YAHOO.COM>:<BR><BR>>
Hi.<BR>><BR>> >From my experience, Java Mapscript still has
some<BR>> problems with threads, and can still easily bring down<BR>>
Tomcat even with the thread compile option is set.<BR>> Please correct me if
I am wrong.<BR>><BR><BR>Yes, that is probably correct, although it is not
*that easy*. I have also<BR>stressed mapscript with jmeter and actually not
found errors, but I did not<BR>cover querying.<BR>That is why I voted for
improved thread safety when the devs showed their wishlists.<BR><BR><BR>>
What I did was I synchronized the class that does the<BR>> map processing,
and now my test app can survive<BR>> benchmarking with JMeter. Here are my
results as<BR>> compared with a simillar PHP CGI program:<BR>><BR><BR>This
is definitely a correct workaround.<BR><BR>> 4 threads (requests) per second,
repeated 25 times<BR>><BR>> PHP Mapscript 1.8 to 1.9 pages per
second<BR>> Java Mapscript 2.3 to 2.5 pages per second<BR>><BR>> I was
honestly surprised with the result and it is<BR>> encouraging me to work with
Java Mapscript even in a<BR>> synchronized mode.<BR>><BR><BR>Were you
using apache 1.3 or 2.x in the php tests? Apache 1.3 uses a fork based<BR>model,
that while being extremely safe and sound is not as fast as a threaded<BR>model.
Apache 2.x has threads and should be
faster.<BR><BR>Regards,<BR>Umberto<BR><BR>> mario<BR>>
yokohama,japan<BR>><BR>><BR>> --- Joseph Miller
<miller_joseph@BAH.COM> wrote:<BR>><BR>> > Umberto,<BR>>
><BR>> > 1)I don't think I compiled specifically with<BR>> >
multi-threading because it<BR>> > wasn't an option listed in the nmake.opt
for<BR>> > Microsoft Visual C++ options<BR>> > file???
The last I heard multithreading was not<BR>> > even on the horizon
for<BR>> > mapserver and yet I see it in the Unix build options<BR>>
> file? What do I need<BR>> > to do this?<BR>> ><BR>>
> 2)I tried both options you mentioned, I had the<BR>> > problem when
passed the<BR>> > same mapObj from request to request and stored it
in<BR>> > the session and when I<BR>> > set it to null after every
request and instantiated<BR>> > it and assigned<BR>> > attributes
based on other variables stored in the<BR>> > requests and
sessions?<BR>> > I'm assuming the latter is preferred?<BR>>
><BR>> > Thanks,<BR>> > Joe Miller<BR>> ><BR>> > On
Mon, 28 Feb 2005 09:44:21 +0100, Umberto<BR>> > Nicoletti<BR>> >
<unicoletti@PROMETEO.IT> wrote:<BR>> ><BR>> > >Did you
enable threads support?<BR>> > >Java, and especially servlets, are
definitely<BR>> > highly concurrent<BR>> > >environment, so you
have to enable thread support<BR>> > when compiling<BR>> >
>mapserver and mapscript. One very problematic spot<BR>> > with regards
to<BR>> > >threads is in fact the parser of .map files.<BR>> >
><BR>> > >Do you attempt to reuse the same mapObj across<BR>>
> multiple requests or just<BR>> > >create one and dispose as soon
as you are done<BR>> > within a single request?<BR>> > ><BR>>
> >HTH,<BR>> > >Umberto<BR>> > ><BR>> >
><BR>> > >On Mon, 2005-02-28 at 00:53 -0500, Miller Joseph<BR>>
> wrote:<BR>> > >> Hi,<BR>> > >> I'm having a
baffling problem with a nightly<BR>> > build of Java Mapscript<BR>>
> >> from about a month ago that I am running on<BR>> > Windows
2000 with Tomcat<BR>> > >> 5.5.4.<BR>> > >><BR>> >
>> The symptom I see is that I can generate the<BR>> > default image
but after the<BR>> > >> fourth or fifth time that I pass a new
envelope<BR>> > to change the extent of<BR>> > >> the image I
get the following error:<BR>> > >><BR>> > >> The
relevant part of the stack trace:<BR>> > >> java.lang.UnknownError:
Failed to draw layer<BR>> > named 'world'.<BR>> >
>> at<BR>> ><BR>>
edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native<BR>> >
Method)<BR>> > >>
at<BR>> > edu.umn.gis.mapscript.mapObj.draw(mapObj.java:397)<BR>> >
>><BR>> > >> Occasionally I'll get a flex scanner error
or<BR>> > tomcat will crash with an<BR>> > >>
Exception_Access_Violation memmove error similar<BR>> > to the one
referred to<BR>> > >> here:<BR>> > >><BR>>
><BR>> <A
href="http://forum.java.sun.com/thread.jspa?forumID=52&messageID=1124599&threa">http://forum.java.sun.com/thread.jspa?forumID=52&messageID=1124599&threa</A><BR>>
> >> dID=286832<BR>> > >><BR>> > >> All of this
happens whether I instatiate new<BR>> > instances of the mapObj
and<BR>> > >> set everything to null or if I use the same<BR>>
> mapObj throughout and only<BR>> > >> after a few passes,
suggesting to me that there<BR>> > is a memory issue<BR>> > >>
somewhere. I can pass on some specific code, but<BR>> > all I am
really doing<BR>> > >> is creating new envelopes to store extents
and<BR>> > then assigning them to<BR>> > >> the mapObj or
extracting the corner coordinates<BR>> > and setting the extent<BR>>
> >> with them.<BR>> > >><BR>> > >> I've been
fighting this for a frustrating week<BR>> > now. Does anyone
have<BR>> > >> any advice?<BR>> > >><BR>> >
>> Thanks,<BR>> > >> Joe Miller<BR>> > >--<BR>>
> >Umberto Nicoletti<BR>> > <Mercury> At that point it<BR>>
> will<BR>> > >+390415701366
unicoletti@prometeo.it<BR>> > compile, but segfault, as<BR>> > it
should..<BR>> > >Prometeo S.R.L. The Software Experience<BR>>
><BR>> > Umberto,<BR>> ><BR>> > 1)I don't think I compiled
specifically with<BR>> > multi-threading because it<BR>> > wasn't an
option listed in the nmake.opt for<BR>> > Microsoft Visual C++
options<BR>> > file??? The last I heard multithreading was
not<BR>> > even on the horizon for<BR>> > mapserver and yet I see it
in the Unix build options<BR>> > file? What do I need<BR>> >
to do this?<BR>> ><BR>> > 2)I tried both options you mentioned, I
had the<BR>> > problem when passed the<BR>> > same mapObj from
request to request and stored it in<BR>> > the session and when I<BR>>
> set it to null after every request and instantiated<BR>> > it and
assigned<BR>> > attributes based on other variables stored in the<BR>>
> requests and sessions?<BR>> > I'm assuming the latter is
preferred?<BR>> ><BR>> > Thanks,<BR>> > Joe Miller<BR>>
><BR>><BR>><BR>><BR>><BR>>
__________________________________<BR>> Do you Yahoo!?<BR>> Yahoo! Sports
- Sign up for Fantasy Baseball.<BR>> <A
href="http://baseball.fantasysports.yahoo.com/">http://baseball.fantasysports.yahoo.com/</A><BR>><BR></FONT></P></DIV>
</BODY>
</HTML>