Use a small footprint setup for the system database. Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/7d17f2d5 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/7d17f2d5 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/7d17f2d5
Branch: refs/heads/hadoop-rdf Commit: 7d17f2d5e33caea93731c42c7419ff57144f4141 Parents: 45985af Author: Andy Seaborne <a...@apache.org> Authored: Sun Nov 16 14:22:40 2014 +0000 Committer: Andy Seaborne <a...@apache.org> Committed: Sun Nov 16 14:22:40 2014 +0000 ---------------------------------------------------------------------- .../apache/jena/fuseki/server/FusekiServer.java | 3 +-- .../apache/jena/fuseki/server/SystemState.java | 24 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/7d17f2d5/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/FusekiServer.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/FusekiServer.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/FusekiServer.java index bb651b4..17f1da6 100644 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/FusekiServer.java +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/FusekiServer.java @@ -62,8 +62,7 @@ public class FusekiServer public static Path FUSEKI_BASE = null ; public static final boolean isWindows = SystemTDB.isWindows ; - - + /** Unused */ //public static final String DFT_FUSEKI_HOME = // isWindows ? /*What's correct here?*/ "/usr/share/fuseki" : "/usr/share/fuseki" ; http://git-wip-us.apache.org/repos/asf/jena/blob/7d17f2d5/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/SystemState.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/SystemState.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/SystemState.java index ff5775d..74117c9 100644 --- a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/SystemState.java +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/server/SystemState.java @@ -20,11 +20,15 @@ package org.apache.jena.fuseki.server; import org.apache.jena.atlas.lib.FileOps ; import org.apache.jena.atlas.lib.StrUtils ; +import org.apache.jena.fuseki.Fuseki ; import com.hp.hpl.jena.query.Dataset ; +import com.hp.hpl.jena.tdb.StoreConnection ; import com.hp.hpl.jena.tdb.TDB ; import com.hp.hpl.jena.tdb.TDBFactory ; +import com.hp.hpl.jena.tdb.base.block.FileMode ; import com.hp.hpl.jena.tdb.base.file.Location ; +import com.hp.hpl.jena.tdb.setup.StoreParams ; import com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction ; public class SystemState { @@ -50,6 +54,21 @@ public class SystemState { init$() ; } + /** Small footprint database. The system database records the server state. + * It should not be performance critical, mainly being used for system admin + * functions. + * <p>Direct mode so that it is not competing for OS file cache space. + * <p>Small caches - + */ + private static final StoreParams systemDatabaseParams = StoreParams.builder() + .fileMode(FileMode.direct) + .blockReadCacheSize(20) + .blockWriteCacheSize(20) + .node2NodeIdCacheSize(5000) + .nodeId2NodeCacheSize(5000) + .nodeMissCacheSize(100) + .build() ; + public /* for testing */ static void init$() { if ( initialized ) return ; @@ -61,6 +80,11 @@ public class SystemState { if ( ! location.isMem() ) FileOps.ensureDir(location.getDirectoryPath()) ; + // Force it into the store connection as a low footprint + if ( StoreConnection.getExisting(location) != null ) + Fuseki.serverLog.warn("System database already in the StoreConnection cache") ; + StoreConnection.make(location, systemDatabaseParams) ; + dataset = TDBFactory.createDataset(location) ; dsg = (DatasetGraphTransaction)(dataset.asDatasetGraph()) ; dsg.getContext().set(TDB.symUnionDefaultGraph, false) ;