http://spdn.ifas.ufl.edu/docs/config/http.html


        (int)The socket receive buffer (SO_RCVBUF) size in bytes. Default value 
is 25188
socket.bufferPoolSize
        (int)The NioChannel pool can also be size based, not used object based. 
The size is calculated as follows:

        NioChannel buffer size = read buffer size + write buffer size

        SecureNioChannel buffer
size = application read buffer size + application write buffer size +
network read buffer size + network write buffer size

        The value is in bytes, the default value is 1024*1024*100 (100MB)
        
here is an example from $CATALINA_HOME/conf/server.xml

   <Connector port="8080" 
    useSendfile="true" 
    useExecutor="true" 
    acceptorThreadCount="1"
    pollerThreadCount="1"
    pollerThreadPriority="java.lang.Thread#NORM_PRIORITY"
    selectorTimeout="1000"
    useComet="true"
    prcessCache="200"
    socket.directBuffer="false"
    socket.rxBufSize="25188"
    socket.txBufSize="43800"
    socket.appReadBufSize="8192"
    socket.appWriteBufSize="8192"
    socket.bufferPool="500"
    socket.bufferPoolSize="100000000"
    socket.processorCache="500"
    socket.keyCache="500"
    socket.eventCache="500"
    socket.tcpNoDelay="false"
    socket.soKeepAlive="true"
    socket.soTimeout="5000"
    protocol="org.apache.coyote.http11.Http11NioProtocol" 
    maxThreads="150" 
    connectionTimeout="60000" 
    redirectPort="8443" />
if your OS and container supports sendfile you may want to enable sendfile for 
static files

HTH
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Thu, 4 Jun 2009 15:05:28 -0400
> Subject: Re: Huge File upload in struts 2
> From: greg.lindh...@gmail.com
> To: user@struts.apache.org
> 
> I'm not having any problem with 20mb files using Struts 2.1.6 and the
> standard fileUpload interceptor.
> From what I see, Sir Evans is warning you that loading the entire file into
> memory may be a problem if your files are very large.  Nowadays 10mb is not
> really that large.  If you want to put 10mb pictures into a database as a
> byte array then you really don't have much choice but to load them into
> memory.
> 
> Now if you were actually talking about really HUGH files like hundreds of mb
> or multiple gb files (just like Evans said) that is larger then your memory
> then you will need take a different approach such as splitting the file or
> not putting it into the database, instead just store a reference to the
> file.
> 
> Have you tried this solution? Have you confirmed you actually have a
> problem?
> 
> On Thu, Jun 4, 2009 at 9:58 AM, Johnson nickel <sarava...@elogic.co.in>wrote:
> 
> >
> >
> >
> > Hi Evans,
> >
> >                 I'm facing problem to upload huge file like (size is
> > 7mb,10mb). In your last thread
> > you have specified it will work in only small datas or files. I want to
> > know
> > any other method
> > to solve in struts2 framework.
> >
> >
> > Disclaimer: This approach is limited to small files (multiple megabytes
> > > rather than hundreds/gigs) because of the inefficient memory
> > > consumption.  It's also quite slow as the commons fileuploader first
> > > receives all the data, then writes the entire temporary file, then it's
> > > read again entirely  into memory, then written back to your
> > > database/filesystem.  There's no other built-in approach in Struts2 but
> > > you'll find ajax fileuploaders on the web that handle massive files
> > > better than this.
> >
> > Jeromy Evans - Blue Sky Minds wrote:
> > >
> > >
> > >
> > > Johnson nickel wrote:
> > >> Hi Jeromy Evans,
> > >>
> > >>               Thanks for your reply. I would like to insert the images
> > >> into
> > >> my
> > >>       Databases. For that, i'm using byte[] array.
> > >>   In Struts 1.3,
> > >>                  I used FormFile class. From this class i got the method
> > >> getFileData();
> > >>
> > >>                 In my db, ps.setBytes(1,filedata); // to store the
> > binary
> > >> datas in DB.
> > >>
> > >>                 /*FormFile mtfile = form.getTheFile();
> > >>  byte[] filedata = mtfile.getFileData();*/
> > >>
> > >>
> > >>
> > > Ahh, ok.
> > >
> > > In Struts2, the file is a reference to a temporary file created on your
> > > server.  If it's not HUGE, just read it into a byte array.
> > > The code follows.  This code is a fairly standard approach to read an
> > > arbitrary length inputstream into a byte array one chunk at a time.
> > > If the file can be HUGE, see my comment at bottom.
> > >
> > > byte[] filedata = readInputStream(new FileInputStream(upload));
> > >
> > > /** Read an input stream in its entirety into a byte array */
> > >     public static byte[] readInputStream(InputStream inputStream) throws
> > > IOException {
> > >         int bufSize = 1024 * 1024;
> > >         byte[] content;
> > >
> > >         List<byte[]> parts = new LinkedList();
> > >         InputStream in = new BufferedInputStream(inputStream);
> > >
> > >         byte[] readBuffer = new byte[bufSize];
> > >         byte[] part = null;
> > >         int bytesRead = 0;
> > >
> > >         // read everyting into a list of byte arrays
> > >         while ((bytesRead = in.read(readBuffer, 0, bufSize)) != -1) {
> > >             part = new byte[bytesRead];
> > >             System.arraycopy(readBuffer, 0, part, 0, bytesRead);
> > >             parts.add(part);
> > >         }
> > >
> > >         // calculate the total size
> > >         int totalSize = 0;
> > >         for (byte[] partBuffer : parts) {
> > >             totalSize += partBuffer.length;
> > >         }
> > >
> > >         // allocate the array
> > >         content = new byte[totalSize];
> > >         int offset = 0;
> > >         for (byte[] partBuffer : parts) {
> > >             System.arraycopy(partBuffer, 0, content, offset,
> > > partBuffer.length);
> > >             offset += partBuffer.length;
> > >         }
> > >
> > >         return content;
> > >     }
> > >
> > > Disclaimer: This approach is limited to small files (multiple megabytes
> > > rather than hundreds/gigs) because of the inefficient memory
> > > consumption.  It's also quite slow as the commons fileuploader first
> > > receives all the data, then writes the entire temporary file, then it's
> > > read again entirely  into memory, then written back to your
> > > database/filesystem.  There's no other built-in approach in Struts2 but
> > > you'll find ajax fileuploaders on the web that handle massive files
> > > better than this.
> > >
> > > regards,
> > >  Jeromy Evans
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > > For additional commands, e-mail: user-h...@struts.apache.org
> > >
> > >
> > >
> > Quoted from:
> >
> > http://www.nabble.com/Struts-2-File-upload-to-store-the-filedata-tp14168069p14169822.html
> >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Huge-File-upload-in-struts-2-tp23870472p23870472.html
> > Sent from the Struts - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >

_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

Reply via email to