jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: performance (again)
Date Fri, 14 Oct 2005 10:26:43 GMT
hi eugeny,

the *bad* performance you're experiencing doesn't surprise me
at all as there are a number of issues with your code:

1. you think that you're creating 20 properties per node (10 String
   and 10 Binary properties) whereas in fact you're only creating
   2 properties.
2. you're using BLOBFileValue for setting a binary value. this is
   an internal class from jackrabbit's core and should never be
   used by an application. for setting binary values you can use
   any of the following:
     - javax.jcr.Node.setProperty(..., InputStream)
     - javax.jcr.Property.setValue(InputStream)
     - or use javax.jcr.ValueFactory to create a binary Value object
3. you only save after you/ve transiently created 20000 nodes.
    with your current code this would be a total of 80'000 transient items!
    (per node: 2 explicitly created properties and 1 autocreated property
    jcr:primaryType; that's three items per node)
    i would recommend to save smaller sets of transient changes, e.g.
    every 100 or 1000 nodes.
4. you're creating a lot of binary properties. binary properties are,
    for obvious reasons, more *expensive* than non-binary properties as
    they're taking up more resources.

i suggest you fix your code with something like this:

    //private static final int SAVE_INTERVAL = 20000;
    private static final int SAVE_INTERVAL = 100;

...

/*
            for (int j = 0; j < PROPERTY_COUNT; j++) {
                n.setProperty("prop_blob", new BLOBFileValue((level + "_" + i
                        + "_" + j).getBytes()));
                n.setProperty("prop", session.getValueFactory().createValue(
                        level + "_" + i + "_" + j));
            }
*/
            n.setProperty("prop_blob", new
FileInputStream("repotest/repository.xml"));
            for (int j = 0; j < PROPERTY_COUNT; j++) {
                n.setProperty("prop" + j, level + "_" + i + "_" + j);
            }


cheers
stefan



On 10/13/05, Eugeny N Dzhurinsky <eugenydzh@jdevelop.com> wrote:
> On Thu, Oct 13, 2005 at 06:34:05PM +0300, Eugeny N Dzhurinsky wrote:
> > Well, i'm really stucked.
> > I created this code (see attachment) to create respository. It creates
> > 5-leaves tree with depth = 5. (each node has 6 children nodes and 10
> > properties).
> >
> > I started this at 5:20 PM and it is 6:30 PM now, but it's still working.
> > It seem to create complete tree with 30 minutes, and started to write it on
> > the disk. Previous time it wrote 19300 nodes (or soemthing like this) in 1.5
> > hour.
>
> okay, here is the output:
> [java] DEBUG 13/36/05 06:36:17 [main] (JCRTest:116) - Build 19530 in 4119509
> ms
> [java] DEBUG 13/36/05 06:36:17 [main] (JCRTest:119) - Traverse 19530 in 25234
> ms
> [java] DEBUG 13/36/05 06:36:17 [main] (JCRTest:121) - node  found in 1 ms
>
> search and traverse speed is really impressive (traverse includes log4j, so I
> assume clean time will be something like 15 seconds or so)
>
> Getting node by name looks cool too, but what about building time???
>
> I'm running FreeBSD 4.11 with native BSD JDK 1.4.2 on P-IV 2.6 GHz with 512 Mb
> ram
>
> the JVM parameters are -Xms128m -XMX512m
>
> --
> Eugene N Dzhurinsky
>

Mime
View raw message