Ticket #933 (closed defect: fixed)

Opened 7 months ago

Last modified 1 month ago

Avoid the additional copy of blobs in PlosStreamResult

Reported by: pradeep Assigned to: alex
Priority: critical Milestone: 0.9.0
Component: ambra Version: 0.9-SNAPSHOT
Keywords: blob, Struts, performance Cc:
Blocking: Blocked By:

Description

PlosStreamResult? expects the action to generate an inputstream to read from. It then proceeds to read the entire stream into a buffer before writing it out to the outputstream.

With blobs, the buffer is already there. So all it needs to do is to write it out.

This is to speed up the content delivery for images, xml, pdf files.

Dependency Graph

Change History

05/07/08 11:13:15 changed by amit

  • owner changed from jsuttor to alex.
  • priority changed from unassigned to critical.
  • milestone set to 0.9.0.

Yikes. This needs to be fixed. Assigning to Alex as one of the first things to do after he gets back.

05/07/08 12:51:57 changed by amit

  • type changed from enhancement to defect.

05/19/08 09:35:32 changed by alex

  • status changed from new to assigned.

(follow-up: ↓ 6 ) 05/19/08 09:52:29 changed by alex

Hi,

I've looked over the code and I don't see where the entire input stream is copied into a buffer before being written to the output stream.

If I'm missing something, please can you tell me which lines of code are doing this. I do see where the content from the input stream is written to the output stream via a temporary buffer. I can't think of any other way to get content from one input stream and copy it to an output stream - so if this is what you are referring to, please explain how else this can be achieved.

05/19/08 09:53:55 changed by alex

FYI - In my comment above I'm referring to the while loop at line 105

(in reply to: ↑ 4 ) 05/19/08 11:27:10 changed by pradeep

Replying to alex: To be more specific, the double copy is occurring because the blob is converted to a ByteArrayInputStream? and then read into a buffer before writing it out. So what is needed is to bypass the InputStream? and instead use the byte[] content from the blob in the PlosStreamResult?.

05/22/08 17:33:54 changed by alex

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [5806]) fixes #933 - Made the blob representation body available from FetchObjectAction?. The PlosStreamResult? response object will check if this is available and use it instead of the inputStream.

10/17/08 21:55:17 changed by ronald

  • keywords changed from Blob, Struts, Performance to blob, Struts, performance.