jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guo Du <mrdu...@gmail.com>
Subject Re: Performance of Jackrabbit
Date Mon, 27 Jul 2009 14:25:38 GMT
On Mon, Jul 27, 2009 at 2:56 PM, Ajai<ajaiking@gmail.com> wrote:
>
> Hi Guo,
>
> Yes, i am adding a document to the repository.
> Is there multiple ways to do a save?
>
> I am doing it the following way,
>
> fileNode = matterNode.addNode(fileName, "nt:file");
> fileNode.addMixin("mix:versionable");
> fileNode.addMixin("mix:referenceable");
> Node resNode = fileNode.addNode("jcr:content", "nt:resource");
> resNode.addMixin("mix:versionable");
> resNode.addMixin("mix:referenceable");
> resNode.setProperty("jcr:mimeType", mimeType);
> resNode.setProperty("jcr:encoding", ENCODING_UTF_8);
> resNode.setProperty("jcr:data", new FileInputStream(file));
> Calendar lastModified = Calendar.getInstance();
> lastModified.setTimeInMillis(file.lastModified());
> resNode.setProperty("jcr:lastModified", lastModified);
> // finally
> session.save();
>
> Please suggest if any changes can be done.
>


Your code doesn't show details of the loop.


WRONG
==============
loop{ // 375000 times
  addNode(...)
}
session.save();
==============



CORRECT
==============
loop{ // 375000 times
  addNode(...)
  session.save();
}
==============
You may also add multiple documents before call session.save() to take
advantage of batch process more efficiently. But not after add all
375000 documents.

--Guo

Mime
View raw message