diff --git a/CHANGELOG b/CHANGELOG index e255f27c6b6c41a715889c492218522a2c3f6df9..539393e6042dbcb525350b4665fb1ab0933c158a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -29,6 +29,7 @@ - gh-59 Cassandra 1.0.6 (akkumar) - gh-62 Oracle NoSQL Database Client (y-namiki) - gh-64 Mavenisation of YCSB with a (tar ball) distribution packager (hariprasad-k) +- gh-65 Patch for improving the MongoDB Client (singhsiddharth) 0.1.3 - 10/26/10 diff --git a/README b/README index 91d7896d864613b1429cac050b191a1579a91250..de662cd30d8ec58bf5f29f083422240d5d68c4d2 100644 --- a/README +++ b/README @@ -1,42 +1,29 @@ Yahoo! Cloud System Benchmark (YCSB) +==================================== +Links +----- http://wiki.github.com/brianfrankcooper/YCSB/ http://research.yahoo.com/Web_Information_Management/YCSB ycsb-users@yahoogroups.com +Getting Started +--------------- -Overview -======== +1. Download the latest release of YCSB: -It is difficult to decide which system is right for your application, -partially because the features differ between systems, and partially -because there is not an easy way to compare the performance of one -system versus another. + wget https://github.com/downloads/brianfrankcooper/YCSB/ycsb-0.1.4.tar.gz + tar xfvz ycsb-0.1.4 + cd ycsb-0.1.4 -The goal of the YCSB project is to develop a framework and common set -of workloads for evaluating the performance of different "key-value" -and "cloud" serving stores. The project comprises two things: +2. Set up a database to benchmark. There is a README file under each binding + directory. -* The YCSB Client, an extensible workload generator +3. Run YCSB command. -* The Core workloads, a set of workload scenarios to be executed by - the generator + bin/ycsb load basic workloads/workloada + bin/ycsb run basic workloads/workloada -Although the core workloads provide a well rounded picture of a -system's performance, the Client is extensible so that you can define -new and different workloads to examine system aspects, or application -scenarios, not adequately covered by the core workload. Similarly, the -Client is extensible to support benchmarking different -databases. Although we include sample code for benchmarking HBase and -Cassandra, it is straightforward to write a new interface layer to -benchmark your favorite database. - -A common use of the tool is to benchmark multiple systems and compare -them. For example, you can install multiple systems on the same -hardward configuration, and run the same workloads against each -system. Then you can plot the performance of each system (for example, -as latency versus throughput curves) to see when one system does -better than another. - -Detailed information about using the benchmark is available in the -doc/index.html file. + Running the `ycsb` command without any argument will print the usage. See + https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties for the list + of available workload properties. diff --git a/distribution/src/main/bin/ycsb b/bin/ycsb similarity index 95% rename from distribution/src/main/bin/ycsb rename to bin/ycsb index 8e4d42eb155830648f8473f658f6f46869b6efb1..6771c8bd42f0e41bd3ff96787f232fd06cc78e96 100755 --- a/distribution/src/main/bin/ycsb +++ b/bin/ycsb @@ -43,7 +43,7 @@ def usage(): print "\nCommands:" for command in sorted(COMMANDS.keys()): - print " {0:13} {1}".format(command, COMMANDS[command]["description"]) + print " %s %s" % (command.ljust(13), COMMANDS[command]["description"]) print "\nDatabases:" for db in sorted(DATABASES.keys()): @@ -56,7 +56,7 @@ def usage(): print "\nOptions:" for option in sorted(OPTIONS.keys()): - print " {0:13} {1}".format(option, OPTIONS[option]) + print " %s %s" % (option.ljust(13), OPTIONS[option]) sys.exit(1) def find_jars(dir, database): diff --git a/distribution/src/main/bin/ycsb.sh b/bin/ycsb.sh similarity index 100% rename from distribution/src/main/bin/ycsb.sh rename to bin/ycsb.sh diff --git a/distribution/src/main/assembly/distribution.xml b/distribution/src/main/assembly/distribution.xml index a4394eb31c0cb1952ecdf76756a6bdea43e1e730..4715e71fc1801fda2e315686530e263330bf2995 100644 --- a/distribution/src/main/assembly/distribution.xml +++ b/distribution/src/main/assembly/distribution.xml @@ -5,19 +5,42 @@ <format>tar.gz</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>..</directory> + <outputDirectory>.</outputDirectory> + <fileMode>0644</fileMode> + <includes> + <include>README</include> + <include>CHANGELOG</include> + <include>LICENSE.txt</include> + <include>NOTICE.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>../bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>../workloads</directory> + <outputDirectory>workloads</outputDirectory> + <fileMode>0644</fileMode> + </fileSet> + </fileSets> <moduleSets> <moduleSet> <useAllReactorProjects>true</useAllReactorProjects> <includeSubModules>true</includeSubModules> <sources> - <includeModuleDirectory>false</includeModuleDirectory> + <includeModuleDirectory>true</includeModuleDirectory> + <fileSets> <fileSet> - <directory>../</directory> - <outputDirectory>.</outputDirectory> - <includes> + <directory>.</directory> + <fileMode>0644</fileMode> + <includes> <include>README</include> - <include>CHANGELOG</include> </includes> </fileSet> <fileSet> @@ -25,16 +48,6 @@ <outputDirectory>conf</outputDirectory> <fileMode>0644</fileMode> </fileSet> - <fileSet> - <directory>src/main/bin</directory> - <outputDirectory>bin</outputDirectory> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>src/main/resources/workloads</directory> - <outputDirectory>workloads</outputDirectory> - <fileMode>0644</fileMode> - </fileSet> <fileSet> <outputDirectory>lib</outputDirectory> <directory>target</directory> diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java index df70e148f7ba34b106ce009c6e3fcfa79ca975cf..1ca83ef1fa929b229a320f5024ed9198d8dd22ab 100644 --- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java +++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java @@ -27,6 +27,7 @@ import com.mongodb.DBObject; import com.mongodb.Mongo; import com.mongodb.ServerAddress; import com.mongodb.WriteConcern; +import com.mongodb.WriteResult; import com.yahoo.ycsb.DB; import com.yahoo.ycsb.DBException; @@ -87,6 +88,7 @@ public class MongoDbClient extends DB { System.err.println( "Could not initialize MongoDB connection pool for Loader: " + e1.toString()); + e1.printStackTrace(); return; } @@ -107,15 +109,8 @@ public class MongoDbClient extends DB { db.requestStart(); DBCollection collection = db.getCollection(table); DBObject q = new BasicDBObject().append("_id", key); - if (writeConcern.equals(WriteConcern.SAFE)) { - q.put("$atomic", true); - } - collection.remove(q); - - // see if record was deleted - DBObject errors = db.getLastError(); - - return ((Integer) errors.get("n")) == 1 ? 0 : 1; + WriteResult res = collection.remove(q, writeConcern); + return res.getN() == 1 ? 0 : 1; } catch (Exception e) { System.err.println(e.toString()); return 1; @@ -149,17 +144,10 @@ public class MongoDbClient extends DB { DBCollection collection = db.getCollection(table); DBObject r = new BasicDBObject().append("_id", key); for(String k: values.keySet()) { - r.put(k, values.get(k).toString()); + r.put(k, values.get(k).toArray()); } - collection.setWriteConcern(writeConcern); - - collection.insert(r); - - // determine if record was inserted, does not seem to return - // n=<records affected> for insert - DBObject errors = db.getLastError(); - - return ((Double) errors.get("ok") == 1.0) && errors.get("err") == null ? 0 : 1; + WriteResult res = collection.insert(r,writeConcern); + return res.getError() == null ? 0 : 1; } catch (Exception e) { System.err.println(e.toString()); return 1; @@ -244,23 +232,15 @@ public class MongoDbClient extends DB { DBObject u = new BasicDBObject(); DBObject fieldsToSet = new BasicDBObject(); Iterator<String> keys = values.keySet().iterator(); - String tmpKey = null, tmpVal = null; while (keys.hasNext()) { - tmpKey = keys.next(); - tmpVal = values.get(tmpKey).toString(); - fieldsToSet.put(tmpKey, tmpVal); + String tmpKey = keys.next(); + fieldsToSet.put(tmpKey, values.get(tmpKey).toArray()); } u.put("$set", fieldsToSet); - - collection.setWriteConcern(writeConcern); - - collection.update(q, u); - - // determine if record was inserted - DBObject errors = db.getLastError(); - - return (Integer) errors.get("n") == 1 ? 0 : 1; + WriteResult res = collection.update(q, u, false, false, + writeConcern); + return res.getN() == 1 ? 0 : 1; } catch (Exception e) { System.err.println(e.toString()); return 1; diff --git a/distribution/src/main/resources/workloads/workloada b/workloads/workloada similarity index 100% rename from distribution/src/main/resources/workloads/workloada rename to workloads/workloada diff --git a/distribution/src/main/resources/workloads/workloadb b/workloads/workloadb similarity index 100% rename from distribution/src/main/resources/workloads/workloadb rename to workloads/workloadb diff --git a/distribution/src/main/resources/workloads/workloadc b/workloads/workloadc similarity index 100% rename from distribution/src/main/resources/workloads/workloadc rename to workloads/workloadc diff --git a/distribution/src/main/resources/workloads/workloadd b/workloads/workloadd similarity index 100% rename from distribution/src/main/resources/workloads/workloadd rename to workloads/workloadd diff --git a/distribution/src/main/resources/workloads/workloade b/workloads/workloade similarity index 100% rename from distribution/src/main/resources/workloads/workloade rename to workloads/workloade diff --git a/distribution/src/main/resources/workloads/workloadf b/workloads/workloadf similarity index 100% rename from distribution/src/main/resources/workloads/workloadf rename to workloads/workloadf