use of org.apache.rya.benchmark.query.Rya.SecondaryIndexing in project incubator-rya by apache.
the class QueryBenchmark method setup.
@Setup
public void setup() throws Exception {
// Setup logging.
final ConsoleAppender console = new ConsoleAppender();
console.setLayout(new PatternLayout("%d [%p|%c|%C{1}] %m%n"));
console.setThreshold(Level.INFO);
console.activateOptions();
Logger.getRootLogger().addAppender(console);
// Load the benchmark's configuration file.
final InputStream queriesStream = Files.newInputStream(QUERY_BENCHMARK_CONFIGURATION_FILE);
final QueriesBenchmarkConf benchmarkConf = new QueriesBenchmarkConfReader().load(queriesStream);
// Create the Rya Configuration object using the benchmark's configuration.
final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration();
final Rya rya = benchmarkConf.getRya();
ryaConf.setTablePrefix(rya.getRyaInstanceName());
final Accumulo accumulo = rya.getAccumulo();
ryaConf.set(ConfigUtils.CLOUDBASE_USER, accumulo.getUsername());
ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, accumulo.getPassword());
ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, accumulo.getZookeepers());
ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, accumulo.getInstanceName());
// Print the query plan so that you can visually inspect how PCJs are being applied for each benchmark.
ryaConf.set(ConfigUtils.DISPLAY_QUERY_PLAN, "true");
// Turn on PCJs if we are configured to use them.
final SecondaryIndexing secondaryIndexing = rya.getSecondaryIndexing();
if (secondaryIndexing.isUsePCJ()) {
ryaConf.set(ConfigUtils.USE_PCJ, "true");
ryaConf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinStorageType.ACCUMULO.toString());
ryaConf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinUpdaterType.NO_UPDATE.toString());
} else {
ryaConf.set(ConfigUtils.USE_PCJ, "false");
}
// Create the connections used to execute the benchmark.
sail = RyaSailFactory.getInstance(ryaConf);
sailConn = sail.getConnection();
}
use of org.apache.rya.benchmark.query.Rya.SecondaryIndexing in project incubator-rya by apache.
the class QueriesBenchmarkConfReaderIT method load.
@Test
public void load() throws JAXBException, SAXException, ParserConfigurationException, IOException {
// Unmarshal some XML.
final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<QueriesBenchmarkConf>\n" + " <Rya>\n" + " <ryaInstanceName>test_</ryaInstanceName>\n" + " <accumulo>\n" + " <username>test</username>\n" + " <password>t3stP@ssw0rd</password>\n" + " <zookeepers>zoo-server-1,zoo-server-2</zookeepers>\n" + " <instanceName>testInstance</instanceName>\n" + " </accumulo>\n" + " <secondaryIndexing>\n" + " <usePCJ>true</usePCJ>\n" + " </secondaryIndexing>\n" + " </Rya>\n" + " <Parameters>" + " <NumReadsRuns>" + " <NumReads>1</NumReads>" + " <NumReads>10</NumReads>" + " <NumReads>100</NumReads>" + " <NumReads>ALL</NumReads>" + " </NumReadsRuns>" + " <Queries>\n" + " <SPARQL><![CDATA[SELECT ?a WHERE { ?a <http://likes> <urn:icecream> . }]]></SPARQL>\n" + " <SPARQL><![CDATA[SELECT ?a ?b WHERE { ?a <http://knows> ?b . }]]></SPARQL>\n" + " </Queries>\n" + " </Parameters>" + "</QueriesBenchmarkConf>";
final InputStream xmlStream = new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8));
final QueriesBenchmarkConf benchmarkConf = new QueriesBenchmarkConfReader().load(xmlStream);
// Ensure it was unmarshalled correctly.
final Rya rya = benchmarkConf.getRya();
assertEquals("test_", rya.getRyaInstanceName());
final Accumulo accumulo = rya.getAccumulo();
assertEquals("test", accumulo.getUsername());
assertEquals("t3stP@ssw0rd", accumulo.getPassword());
assertEquals("zoo-server-1,zoo-server-2", accumulo.getZookeepers());
assertEquals("testInstance", accumulo.getInstanceName());
final SecondaryIndexing secondaryIndexing = rya.getSecondaryIndexing();
assertTrue(secondaryIndexing.isUsePCJ());
final Parameters parameters = benchmarkConf.getParameters();
final List<String> expectedNumReads = Lists.newArrayList("1", "10", "100", "ALL");
final NumReadsRuns NumReads = parameters.getNumReadsRuns();
assertEquals(expectedNumReads, NumReads.getNumReads());
final List<String> expectedQueries = Lists.newArrayList("SELECT ?a WHERE { ?a <http://likes> <urn:icecream> . }", "SELECT ?a ?b WHERE { ?a <http://knows> ?b . }");
final Queries queries = parameters.getQueries();
assertEquals(expectedQueries, queries.getSPARQL());
}
Aggregations