Skip to content
This repository has been archived by the owner on Dec 16, 2017. It is now read-only.

Update repo to latest releases and run tests. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@ The tests are using the database `performance_analysis_sequelize` with the user
bundle
ruby sh/performance-test.rb

## Test-results on small vm (1GB Ram, 2 Cores) Centos 5.3 (test ran on 4/5/2013)

node-mysql#insertSerially (25 runs): 1061.36ms
node-mysql#insertAsync (25 runs): 912.08ms
node-mysql#updateSerially (25 runs): 1093.96ms
node-mysql#updateAsync (25 runs): 819.32ms
node-mysql#read (25 runs): 9.24ms
node-mysql#deleteSerially (25 runs): 1069.08ms
node-mysql#deleteAsync (25 runs): 490.56ms

node-orm#insertSerially (25 runs): 678ms
node-orm#insertAsync (25 runs): 584.28ms
node-orm#updateSerially (25 runs): 628.88ms
node-orm#updateAsync (25 runs): 528.64ms
node-orm#read (25 runs): 16.64ms
node-orm#deleteSerially (25 runs): 663ms
node-orm#deleteAsync (25 runs): 556.6ms

persistencejs#insertSerially (25 runs): 2677ms
persistencejs#insertAsync (25 runs): 2177.84ms
persistencejs#updateSerially (25 runs): 2656.16ms
persistencejs#updateAsync (25 runs): 15.8ms
persistencejs#read (25 runs): 709.48ms
persistencejs#deleteSerially (25 runs): 4573.24ms
persistencejs#deleteAsync (25 runs): 799.6ms

sequelize#insertSerially (25 runs): 2473.76ms
sequelize#insertAsync (25 runs): 943.88ms
sequelize#updateSerially (25 runs): 2359.12ms
sequelize#updateAsync (25 runs): 860.24ms
sequelize#read (25 runs): 27.32ms
sequelize#deleteSerially (25 runs): 2090.2ms
sequelize#deleteAsync (25 runs): 810.32ms

no ruby tests...

## Test-results on ec2 micro instance (ami-cb340abf)

node-mysql#insertSerially (25 runs): 9898.8ms
Expand Down
11 changes: 5 additions & 6 deletions mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ const MySQL = require("mysql")

var LIMIT = 10000

var client = MySQL.createClient({
var client = MySQL.createConnection({
multipleStatements: true,
host: 'localhost',
user: 'root',
database: 'performance_analysis_sequelize'
})

client.connect()

var createTable = function(callback) {
var sql = "DROP TABLE IF EXISTS `Entries`;CREATE TABLE IF NOT EXISTS `Entries` (`number` INTEGER, `string` VARCHAR(255), `id` INTEGER NOT NULL auto_increment , `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;"
client.query(sql, function(err, results, fields) {
Expand Down Expand Up @@ -99,11 +103,6 @@ var testRead = function(testReadCallback) {
, sql = 'SELECT * FROM Entries'
, duration = null

client = MySQL.createClient({
user: 'root',
database: 'performance_analysis_sequelize'
})

client.query(sql, function(err, results, fields) {
if(err) throw new Error(err)

Expand Down
14 changes: 8 additions & 6 deletions node-orm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ module.exports = function(times, limit, runCallback) {
LIMIT = limit

var runTestsOnce = function(callback) {
orm.connect(server, function(success, db) {
orm.connect(server, function(err, db) {
if (err) throw err;

var Entry = db.define('EntryORM', {
number: { type: 'integer' },
string: { type: 'string' }
number: { type: 'number' },
string: { type: 'text' }
})

var testInserts = function(async, testInsertsCallback, disableLogging) {
Expand Down Expand Up @@ -56,7 +58,7 @@ module.exports = function(times, limit, runCallback) {
}

var testUpdates = function(async, testUpdatesCallback) {
Entry.find(function(entries) {
Entry.find(function(err, entries) {
var done = 0
, start = +new Date()
, duration = null
Expand Down Expand Up @@ -99,7 +101,7 @@ module.exports = function(times, limit, runCallback) {
var start = +new Date
, duration = null

Entry.find(function(entries) {
Entry.find(function(err, entries) {
duration = (+new Date) - start
console.log('Reading ' + entries.length + ' database entries took ' + duration + 'ms')
testReadCallback && testReadCallback(duration)
Expand All @@ -108,7 +110,7 @@ module.exports = function(times, limit, runCallback) {

var testDelete = function(async, testDeleteCallback) {
testInserts(true, function() {
Entry.find(function(entries) {
Entry.find(function(err, entries) {
var done = 0
, start = +new Date()
, duration = null
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"node": "~0.6.2"
},
"dependencies": {
"mysql": "0.9.5",
"sequelize": "1.3.1",
"orm": "0.1.8-3"
"mysql": "2.0.0-alpha7",
"sequelize": "~1.6.0",
"orm": "~2.0.0"
},
"devDependencies": {}
}