Re: Newbie question-WO and data uploading
Re: Newbie question-WO and data uploading
- Subject: Re: Newbie question-WO and data uploading
- From: Chuck Hill <email@hidden>
- Date: Mon, 03 Feb 2003 10:53:43 -0800
- Organization: Global Village Consulting, Inc.
Hi,
Richard L. Peskin wrote:
As a newbie to WO, I have a question about how WO can help with a web
based application that involves client upload of large (~10MB) files.
Unless this is over a low bandwidth connection, I'd not consider this to be
especially large.
The particular application involves client upload of images, and for
"business" reasons, the user environment needs to be web browser based
(as opposed to, say, ftp based). I realize that WO is not going to
solve bandwidth problems.
:-)
But does WO support data object streaming
As of 5.2 there is support for streaming an upload to disk. Prior to 5.2 there
was not. There are some other things you can do to help manage memory usage
(these are from 5.1 but may still apply in 5.2 - I've not tested them yet).
- add the undocumented binding to the WOFileUpload component:
copyData = false;
- don't hold any references to the uploaded file after the upload has been
processed.
- either keep the page cache size small or use this in your Application
constructor to reduce / eliminate caching of uploaded data:
setPageRefreshOnBacktrackEnabled(false);
- prod the garbage collector when there are large uploads with code like this (only tested on Win2K, may not be as effective on other platforms):
public WOResponse dispatchRequest(WORequest request)
{
// If this does not happen first time through and after each large upload,
about 30 MB of memory just "goes missing" and is never recovered! I'd love to
see an explanation of that. I can see that more would get collected here are
there is no longer a reference to the last request. However if this is delayed
until after the next request is dispatched the memory is never recovered. It
must be done here. I expect that will multi threading enabled that this would
just not work. This also requires setPageRefreshOnBacktrackEnabled(false) for
this to work, otherwise the upload is cached in the session and all the garbage
collecting in the world won't do any good.
if (shouldCleanupPreviousRequest)
{
shouldCleanupPreviousRequest = false;
Runtime.getRuntime().gc();
}
WOResponse result = super.dispatchRequest(request);
// If the last request was large force garbage collection and flag it to be
done again before the next request is processed.
if (request.content().length() > 1000000)
{
shouldCleanupPreviousRequest = true;
Runtime.getRuntime().gc();
}
return result;
}
and/or session persistence such that customers can be assured (assuming
no broken communications) of data transfer completion?
Yes. Just ensure that the Session timeout is set to be larger that the longest
anticipated time to upload a file.
If so, where can I learn more about it?
Read the javadocs, attend the Apple training.
Chuck
--
Chuck Hill - Village Idiot Savant email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.