incubator-jena-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paolo Castagna (JIRA)" <>
Subject [jira] [Updated] (JENA-117) tdbloader2: Java external sorting using binary files vs. UNIX sort over text files
Date Mon, 19 Sep 2011 15:49:08 GMT


Paolo Castagna updated JENA-117:

    Attachment: TDB_JENA-117_r1171714.patch

This is a first and incomplete attempt, just to show a possible approach. 

It's incomplete because at the moment it is focusing only SPO and GSPO indexes.

Moreover, there must be something going wrong in relation to the SPO index, an exception is

ERROR **** Not the root: 11264
	at com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeRewriter.packIntoBPlusTree(
	at arq.cmdline.CmdMain.mainMethod(
	at arq.cmdline.CmdMain.mainRun(
	at arq.cmdline.CmdMain.mainRun(

I don't see why, at the moment.

> tdbloader2: Java external sorting using binary files vs. UNIX sort over text files
> ----------------------------------------------------------------------------------
>                 Key: JENA-117
>                 URL:
>             Project: Jena
>          Issue Type: Improvement
>          Components: TDB
>            Reporter: Paolo Castagna
>              Labels: performance, tdbloader2
>         Attachments: TDB_JENA-117_r1171714.patch
> There is probably a significant performance improvement for tdbloader2 in replacing the
UNIX sort over text files with an external sorting pure Java implementation.
> Since JENA-99 we now have a SortedDataBag which does exactly that.
>     ThresholdPolicyCount<Tuple<Long>> policy = new ThresholdPolicyCount<Tuple<Long>>(1000000);
>     SerializationFactory<Tuple<Long>> serializerFactory = new TupleSerializationFactory();
>     Comparator<Tuple<Long>> comparator = new TupleComparator();
>     SortedDataBag<Tuple<Long>> sortedDataBag = new SortedDataBag<Tuple<Long>>(policy,
serializerFactory, comparator);
> TupleSerializationFactory greates TupleInputStream|TupleOutputStream which are wrappers
around DataInputStream|DataOutputStream. TupleComparator is trivial.
> Preliminary results seems promising and show that the Java implementation can be faster
than UNIX sort since it uses smaller binary files (instead of text files) and it does comparisons
of long values rather than strings.
> An example of ExternalSort which compare SortedDataBag vs. UNIX sort is available here:
> A further advantage in doing the sorting with Java rather than UNIX sort is that we could
stream results directly into the BPlusTreeRewriter rather than on disk and then reading them
from disk into the BPlusTreeRewriter.
> I've not done an experiment yet to see if this is actually a significant improvement.
> Using compression for intermediate files might help, but more experiments are necessary
to establish if it is worthwhile or not.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message