Performance issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance issues

snowch
Hi Forum,

My application needs to serve images to users but each image request is checked to ensure the user has permission to view the image.  To do this, I have created a custom bsh servlet to serve the images for a ftl page (which are included using  tags).  There can be 20 to 30 images per page.  The images are around 40Kb.  The page is currently taking 20+ seconds to load the images.  I have noticed in the log that there be a few second delay between the ImageServlet finishing and the next request being handled by the ContextFilter (see below).

Does anyone on this forum have any idea what can be causing the delay?

Many thanks in advance,

Chris

2009-05-11 20:37:56,097 (TP-Processor3) [     ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, Servlet Finished- total:0.188,since last([ImageServlet] Se...):0.125]]
2009-05-11 20:37:56,112 (TP-Processor2) [    TransactionUtil.java:187:DEBUG] [TransactionUtil.commit] transaction committed
2009-05-11 20:37:56,112 (TP-Processor2) [     ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, Servlet Finished- total:0.203,since last([ImageServlet] Se...):0.14]]
2009-05-11 20:38:01,597 (TP-Processor2) [      ContextFilter.java:182:INFO ] [Request]: /xxx/control/ImageServlet
2009-05-11 20:38:01,612 (TP-Processor3) [      ContextFilter.java:182:INFO ] [Request]: /xxx/control/ImageServlet
Reply | Threaded
Open this post in threaded view
|

Re: Performance issues

BJ Freeman
Start with memory allocation, then CPU usage.
Also check if you have the cache turned on

other thing you can do on you page is put a start and stop time that
shows page load time.
see if this is the same as the real time you experience.

there also could be some ways for streamlining your code
however that is beyond the scope of the mailing list.

snowch sent the following on 5/11/2009 1:07 PM:

> Hi Forum,
>
> My application needs to serve images to users but each image request is
> checked to ensure the user has permission to view the image.  To do this, I
> have created a custom bsh servlet to serve the images for a ftl page (which
> are included using   tags).  There can be 20 to 30 images per page.  The
> images are around 40Kb.  The page is currently taking 20+ seconds to load
> the images.  I have noticed in the log that there be a few second delay
> between the ImageServlet finishing and the next request being handled by the
> ContextFilter (see below).
>
> Does anyone on this forum have any idea what can be causing the delay?
>
> Many thanks in advance,
>
> Chris
>
> 2009-05-11 20:37:56,097 (TP-Processor3) [     ControlServlet.java:256:DEBUG]
> [[[ImageServlet] Done rendering page, Servlet Finished- total:0.188,since
> last([ImageServlet] Se...):0.125]]
> 2009-05-11 20:37:56,112 (TP-Processor2) [    TransactionUtil.java:187:DEBUG]
> [TransactionUtil.commit] transaction committed
> 2009-05-11 20:37:56,112 (TP-Processor2) [     ControlServlet.java:256:DEBUG]
> [[[ImageServlet] Done rendering page, Servlet Finished- total:0.203,since
> last([ImageServlet] Se...):0.14]]
> 2009-05-11 20:38:01,597 (TP-Processor2) [      ContextFilter.java:182:INFO ]
> [Request]: /xxx/control/ImageServlet
> 2009-05-11 20:38:01,612 (TP-Processor3) [      ContextFilter.java:182:INFO ]
> [Request]: /xxx/control/ImageServlet
>

--
BJ Freeman
http://www.businessesnetwork.com/automation
http://bjfreeman.elance.com
http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro
Systems Integrator.

Reply | Threaded
Open this post in threaded view
|

Re: Performance issues

Harmeet Bedi
In reply to this post by snowch
For us the following worked
- Look at cache.properties. Change that to cache information. In default dev friendly environment xml documents for forms/screens are parsed almost on each request
- We were serving images from a remote location. The way ofbiz was serving images was Browser -> Ofbiz -> Fetch remote content. Instead we changed to display actual URL of image. Check to see if you your html page has the Image URLs.

Hope it helps,
Harmeet

----- Original Message -----
From: "snowch" <[hidden email]>
To: [hidden email]
Sent: Monday, May 11, 2009 4:07:14 PM GMT -05:00 US/Canada Eastern
Subject: Performance issues


Hi Forum,

My application needs to serve images to users but each image request is
checked to ensure the user has permission to view the image.  To do this, I
have created a custom bsh servlet to serve the images for a ftl page (which
are included using   tags).  There can be 20 to 30 images per page.  The
images are around 40Kb.  The page is currently taking 20+ seconds to load
the images.  I have noticed in the log that there be a few second delay
between the ImageServlet finishing and the next request being handled by the
ContextFilter (see below).

Does anyone on this forum have any idea what can be causing the delay?

Many thanks in advance,

Chris

2009-05-11 20:37:56,097 (TP-Processor3) [     ControlServlet.java:256:DEBUG]
[[[ImageServlet] Done rendering page, Servlet Finished- total:0.188,since
last([ImageServlet] Se...):0.125]]
2009-05-11 20:37:56,112 (TP-Processor2) [    TransactionUtil.java:187:DEBUG]
[TransactionUtil.commit] transaction committed
2009-05-11 20:37:56,112 (TP-Processor2) [     ControlServlet.java:256:DEBUG]
[[[ImageServlet] Done rendering page, Servlet Finished- total:0.203,since
last([ImageServlet] Se...):0.14]]
2009-05-11 20:38:01,597 (TP-Processor2) [      ContextFilter.java:182:INFO ]
[Request]: /xxx/control/ImageServlet
2009-05-11 20:38:01,612 (TP-Processor3) [      ContextFilter.java:182:INFO ]
[Request]: /xxx/control/ImageServlet

--
View this message in context: http://www.nabble.com/Performance-issues-tp23490557p23490557.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Performance issues

snowch
In reply to this post by snowch
Problem solved:

Many thanks for the replies...

Chris

...
FileInputStream in = new FileInputStream(filename);
bytes = IOUtils.toByteArray(in);
in.close();

response.setHeader("Content-Type", "image/jpeg");
response.setDateHeader("Expires",  System.currentTimeMillis(  ) + 24*60*60*1000);
response.setHeader("Content-Disposition", "attachment;filename=" + upliftNumber + "_" + imgNum + ".jpg");

OutputStream out;
if (MyUtil.acceptsGZIP(request))
{
        response.setHeader("Content-Encoding", "gzip");
  out = new GZIPOutputStream(response.getOutputStream(  ));
}
else {
  out = response.getOutputStream(  );
}
IOUtils.write(bytes, out);
out.flush();
out.close();


snowch wrote
Hi Forum,

My application needs to serve images to users but each image request is checked to ensure the user has permission to view the image.  To do this, I have created a custom bsh servlet to serve the images for a ftl page (which are included using  tags).  There can be 20 to 30 images per page.  The images are around 40Kb.  The page is currently taking 20+ seconds to load the images.  I have noticed in the log that there be a few second delay between the ImageServlet finishing and the next request being handled by the ContextFilter (see below).

Does anyone on this forum have any idea what can be causing the delay?

Many thanks in advance,

Chris

2009-05-11 20:37:56,097 (TP-Processor3) [     ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, Servlet Finished- total:0.188,since last([ImageServlet] Se...):0.125]]
2009-05-11 20:37:56,112 (TP-Processor2) [    TransactionUtil.java:187:DEBUG] [TransactionUtil.commit] transaction committed
2009-05-11 20:37:56,112 (TP-Processor2) [     ControlServlet.java:256:DEBUG] [[[ImageServlet] Done rendering page, Servlet Finished- total:0.203,since last([ImageServlet] Se...):0.14]]
2009-05-11 20:38:01,597 (TP-Processor2) [      ContextFilter.java:182:INFO ] [Request]: /xxx/control/ImageServlet
2009-05-11 20:38:01,612 (TP-Processor3) [      ContextFilter.java:182:INFO ] [Request]: /xxx/control/ImageServlet