Skip to content
Browse files

added more performance tests

  • Loading branch information...
1 parent fb6e37e commit 1d58fa9bbcf5e5d5cfb907456a8045bd1a8e1158 @stevedekorte committed May 29, 2010
Showing with 148 additions and 28 deletions.
  1. +6 −10 README.txt
  2. +33 −7 tests/speed/AbProcess.js
  3. +108 −8 tests/speed/VertexSpeedTest.js
  4. +1 −3 tests/speed/data.txt
View
16 README.txt
@@ -12,11 +12,11 @@ Vertex.js is schemaless allowing it to naturally model arbitrary graphs and irre
Uptime
-Fine grain migrations. The database is not locked during migrations (due to creation of large indexes).
+Fine grain migrations. The database is not locked during migrations due to creation of large indexes.
Extensibility
-Vertex.js supports addons. You can extent and modify the API to implement complex queries, all using javascript.
+Vertex.js supports addons. You can extend and modify the API to implement complex queries or other protocols (e.g. memcache, Facebook graph API, etc), all using javascript.
Simplicity
@@ -224,7 +224,8 @@ mrm(path, name)
sync(dt)
- Writes: Tells vertex to do a hard sync within dt seconds. If dt is 0 or unspecified, a hard sync will be done before the response is sent.
+ Writes: Tells vertex to do a hard sync within dt seconds.
+ If dt is 0 or unspecified, a hard sync will be done before the response is sent.
Errors: none
Returns: null
@@ -233,13 +234,8 @@ TODO
Security:
node permissions and cookies
- db internal node /_internal/users/username/passwordhash
+ eg. db internal node /_internal/users/username/passwordhash
Tests:
- single script to run all tests
- run on separate port
- performance tests report
-
-
-
+ complete tests for all action options
View
40 tests/speed/AbProcess.js
@@ -1,4 +1,5 @@
var sys = require('sys');
+var fs = require('fs');
var spawn = require('child_process').spawn;
require("../../lib/lib");
@@ -11,26 +12,51 @@ AbProcess = Proto.clone().newSlots({
url: 'http://127.0.0.1:8123/',
requestsPerSecond: null,
output: "",
- delegate: null
+ delegate: null,
+ description: "",
+ postData: null,
+ multiplier: 1
}).setSlots({
launch: function()
{
+ if (this.postData())
+ {
+ var self = this;
+ fs.writeFile('data.txt', this.postData(),
+ function (e)
+ {
+ if (e) throw e;
+ self.launch2();
+ }
+ );
+ }
+ else
+ {
+ this.launch2();
+ }
+ },
+
+ launch2: function()
+ {
//writeln("AbProcess launch()")
- var ab = spawn('ab', [
- '-n', new String(this.numberOfRequests()),
- '-c', new String(this.concurrency()),
- '-T', this.requestType(),
- '-p', this.postData(),
- this.url()]);
+ var args = [
+ '-n', new String(this.numberOfRequests()),
+ '-c', new String(this.concurrency()),
+ '-T', this.requestType(),
+ '-p', 'data.txt',
+ this.url()];
+ var ab = spawn('ab', args);
var self = this;
+ //writeln("ab " + args.join(" "))
this.setOutput("")
ab.stdout.addListener('data', function (data) { self._output = self._output + data });
//ab.stderr.addListener('data', function (data) { sys.puts(data); });
ab.stderr.addListener('data', function (data) { });
ab.addListener('exit', function (code) {
+ //writeln("self._output = '", self._output, "'");
var rps = self._output.after("Requests per second:").before("[").trim();
self.setRequestsPerSecond(Math.floor(new Number(rps)));
//sys.puts("requestsPerSecond: " + rps);
View
116 tests/speed/VertexSpeedTest.js
@@ -5,30 +5,130 @@ require("./AbProcess");
VertexSpeedTest = Proto.clone().newSlots({
protoType: "VertexSpeedTest",
vertexProcess: VertexProcess.clone(),
- abProcess: AbProcess.clone()
+ testQueue: null
}).setSlots({
run: function()
{
this.vertexProcess().setDelegate(this).launch();
+ this._testQueue = [];
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mk", "foo"], ["sync", 0]')
+ .setDescription("mk requests/second [synced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mk", "foo"]]')
+ .setDescription("mk requests/second [unsynced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mk", "f1"], ["mk", "f2"], ["mk", "f3"], ["mk", "f4"], ["mk", "f5"], ["mk", "f6"], ["mk", "f7"], ["mk", "f8"], ["mk", "f9"], ["mk", "f10"]]')
+ .setDescription("mk (10 pack) requests/second [unsynced]\n")
+ .setMultiplier(10)
+ )
+
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["link", "f1", "f2"], ["sync", 0]')
+ .setDescription("link requests/second [synced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["link", "f1", "f2"]]')
+ .setDescription("link requests/second [unsynced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"], ["link", "f1", "f2"]]')
+ .setDescription("link (10 pack) requests/second [unsynced]\n")
+ .setMultiplier(10)
+ )
+
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["ls", "foo"]]')
+ .setDescription("ls requests/second [unsynced]\n")
+ )
+
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mwrite", "foo", "data", "hello"], ["sync", 0]]')
+ .setDescription("mwrite requests/second [synced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mwrite", "foo", "data", "hello"]]')
+ .setDescription("mwrite requests/second [unsynced]")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"], ["mwrite", "foo", "data", "hello"]]')
+ .setDescription("mwrite (10 pack) requests/second [unsynced]\n")
+ .setMultiplier(10)
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mread", "data"]]')
+ .setDescription("mreads requests/second")
+ )
+
+ this._testQueue.push(
+ AbProcess.clone().setDelegate(this)
+ .setPostData('[["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"]]')
+ .setDescription("mreads (10 pack) requests/second")
+ .setMultiplier(10)
+ )
+
+ writeln("VertexPerformance test:")
+ },
+
+ next: function()
+ {
+ var ab = this._testQueue.shift()
+ ab.launch();
},
didStart: function(proc)
{
- //writeln("VertexPerfTest didStart(", proc.protoType(), ")")
if(proc == this.vertexProcess())
{
- this.abProcess().setDelegate(this).launch();
+ this.next()
}
},
didExit: function(proc)
{
- //writeln("VertexPerfTest didExit(", proc.protoType(), ")")
- if(proc == this.abProcess())
+ if(proc != this.vertexProcess())
{
- this.vertexProcess().kill();
- writeln("VertexPerformance test:")
- writeln(" ", this.abProcess().requestsPerSecond(), " requests per second");
+ if(proc.multiplier() != 1)
+ {
+ writeln(" ", proc.requestsPerSecond(), " (", proc.multiplier()*proc.requestsPerSecond(), " total ops) ", proc.description());
+ }
+ else
+ {
+ writeln(" ", proc.requestsPerSecond(), " ", proc.description());
+ }
+
+ if (this._testQueue.length == 0)
+ {
+ this.vertexProcess().kill();
+ }
+ else
+ {
+ this.next()
+ }
}
}
}).run();
View
4 tests/speed/data.txt
@@ -1,3 +1 @@
-[["null"]]
-
-
+[["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"],["mread", "data"]]

0 comments on commit 1d58fa9

Please sign in to comment.
Something went wrong with that request. Please try again.