Mercurial > hg > Members > tatsuki > jungle-bench
changeset 23:5b6322bb6fe7
write disk Performance time for PerformanceComparisonJungleMongo.java
author | tatsuki |
---|---|
date | Sat, 02 May 2015 02:25:36 +0900 |
parents | 306441e23b8b |
children | e2f418db92e9 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/.DS_Store src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/PerformanceComparisonJungleMongo.java src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/readMongoThread.java |
diffstat | 3 files changed, 1 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/PerformanceComparisonJungleMongo.java Fri May 01 20:29:27 2015 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.tatsuki.mongo; - -import com.mongodb.MongoClient; -import com.mongodb.WriteConcern; -import com.mongodb.client.MongoCollection; -import com.mongodb.client.MongoDatabase; -import jp.ac.u_ryukyu.cr.ie.tatsuki.xmlTestBbs.JuGrix; -import jp.ac.u_ryukyu.ie.cr.tatsuki.xml.ReadJungleThread; -import jp.ac.u_ryukyu.ie.cr.tatsuki.xml.extendXmlTree; -import org.bson.Document; -import org.xml.sax.SAXException; - -import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; -import java.util.Arrays; - -/** - * Created by e115731 on 15/05/01. - */ -public class PerformanceComparisonJungleMongo { - - public static void main(String args[]) throws InterruptedException, IOException, SAXException, ParserConfigurationException { - if (args.length < 2) - System.out.println("args[0] = mongo or jungle ,args[1] = personCount"); - - if (args[0].equals("mongo")) - PerformanceCheckMongo(Integer.valueOf(args[1])); - else if (args[0].equals("jungle")) - // PerformanceCheckJungle(Integer.valueOf(args[1])); - System.out.println("end"); - - - } - - private static void PerformanceCheckJungle(Integer personCount) throws ParserConfigurationException, IOException, SAXException, InterruptedException { - JuGrix jugrix = extendXmlTree.createJuGrix(true, personCount); - ReadJungleThread readThread = new ReadJungleThread(jugrix); - readThread.start(); - Thread.sleep(10000); - readThread.set(false); - System.out.println("findCount = " + readThread.getFindCount()); - } - - private static void PerformanceCheckMongo(int PersonCount) throws InterruptedException { - MongoClient client = new MongoClient("localhost", 27017); - client.setWriteConcern(WriteConcern.JOURNALED); - client.dropDatabase("mydb"); - MongoDatabase database = client.getDatabase("mydb"); - MongoCollection<Document> coll = database.getCollection("Persons"); - for (int personCount = 0; personCount < Integer.valueOf(PersonCount); personCount++) { - Document person = new Document("Personid", "p:" + String.valueOf(personCount)) - .append("type", "Person") - .append("accountId", "a:" + String.valueOf(personCount)) - .append("lastName", "金川").append("name", "金川竜己") - .append("nameReading", "かながわたつきくん") - .append("roleRefIds" - , new Document("roleRefId", "r:3") - .append("roleRefId", "r:3")) - .append("parentOrganizations" - , new Document("type", "OrganizationMappedByRole") - .append("OrganizationMappedByRole", - Arrays.asList( - new Document("type", "OrganizationMappedByRole") - .append("organizationRefId", "o:2") - .append("roleRefId", "r:10") - , new Document("type", "OrganizationMappedByRole") - .append("organizationRefId", "o:4") - .append("roleRefId", "r:14"))) - ).append("priorities", - new Document("type", "PriorityMappedByRole") - .append("PriorityMappedByRole" - , Arrays.asList( - new Document("type", "PriorityMappedByRole") - .append("priority", "0") - .append("roleRefId", "r:10") - , new Document("type", "PriorityMappedByRole") - .append("priority", "1") - .append("roleRefId", "r:14"))) - ); - coll.insertOne(person); - } - coll.createIndex(new Document("Personid", 1)); - System.out.println("insertEnd"); - ReadMongoThread th = new ReadMongoThread(coll); - th.start(); - Thread.sleep(10000); - th.set(false); - System.out.println("findCount = " + th.getFindCount()); - } - -}
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/readMongoThread.java Fri May 01 20:29:27 2015 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/mongo/readMongoThread.java Sat May 02 02:25:36 2015 +0900 @@ -5,7 +5,7 @@ import org.bson.Document; -public class ReadMongoThread extends Thread { +class ReadMongoThread extends Thread { MongoCollection<Document> mongoDB; int findCount;