cancel
Showing results for 
Search instead for 
Did you mean: 

OutOfMemory errors while uploading files through web service

sabsurendran
Champ in-the-making
Champ in-the-making
We are evaluating the performance of Alfresco for our project, and are trying to test the performance under heavy loads.
We have 3 different java clients which use the Alfresco Webservice API to upload 100 files of 4 MB each to the same space. We frequently get OutOfMemory exceptions on the Java heap space, and tweaking the Java memory params has not helped.

This is what we have in alfresco.bat:
-Xms518m -Xmx1024m -Xss96k -XX:MaxPermSize=128m -server

The machine where Alfresco repository is hosted has 2 GB RAM. Does anyone know if we need to tweak something else?
14 REPLIES 14

kebbs
Champ in-the-making
Champ in-the-making
Here is what worked for me…


            ContentFormat format = new ContentFormat(properties.getString("contentType"), "UTF-8");
            DataHandler attachmentFile = new DataHandler(new FileDataSource(file));
            // commented out since this results in an exception
            //_contentService._setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT, Call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
            _contentService.addAttachment(attachmentFile);
            _contentService.writeWithAttachment(obj.getNode().getReference(), Constants.PROP_CONTENT, format);

akoudrin
Champ in-the-making
Champ in-the-making
Could you please post all your includes to make the above work, please?

junieboy
Champ in-the-making
Champ in-the-making
Hi,
With WebServices, there is a very definite wrong and right way to upload files.  You need to tweak your code to upload the content direct to the server over http, otherwise WebServices (and this is just how it is) will be sucking the binary data into memory before pushing it into Alfresco.  Alfresco itself does not pull the binaries into memory first.
Regards

Hi Derek,

Good evening. It is very probable by this quarter that we start our development for Alfresco for our Document Management, and our communication would be through web services (more importantly "both saving of files and metadata"). We will be saving files from our system to Alfresco through the Alfresco web service API and basically, we'll develop a custom content model and all the metadata  will be coming from our system will be attached to files and these metadata will be used in searching for these files in Alfresco.

My question is how reliable will this Alfresco web services API approach be since I'm seeing in this post that there's an issue saving files through web service? Also, I was having some question since I am seeing relatively limited Javadoc/API documentation regarding web services.

Also, could I ask you to please further elaborate the solution? How do we tweak the code such that we upload direct to the server over http? What Java API should be used to do this? Please share some examples or diagrams for our reference. Thanks a lot!

Best Regards,
Junie

derek
Star Contributor
Star Contributor
Hi,
If you're starting from scratch, you should consider using CMIS as your starting point.  There are servers available for testing directly e.g. http://cmis.alfresco.com/cmis.
Regards

junieboy
Champ in-the-making
Champ in-the-making
Hi,
If you're starting from scratch, you should consider using CMIS as your starting point.  There are servers available for testing directly e.g. http://cmis.alfresco.com/cmis.
Regards

Hi Derek,

Unfortunately we are using Alfresco 3.0 (the instance is already existing for sometime in our infrastructure and is already being used by our domains but with no web services integration) and I believe CMIS is only available at 3.3. So this is the first time we're doing it. Could I ask for more insights re my questions? Thanks a lot.

Regards.