Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions frameworks/JavaScript/ultimate-express/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
47 changes: 47 additions & 0 deletions frameworks/JavaScript/ultimate-express/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Ultimate-Express Benchmarking Test

This is the Ultimate Express portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
The Ultimate Express. Fastest http server with full Express compatibility, based on µWebSockets.

### JSON Encoding Test

* [JSON test source](app.js)

### Data-Store/Database Mapping Test

* [DB test controller/model](app.js)

## Infrastructure Software Versions
The tests were run with:
* [Node.js v20.12.2](http://nodejs.org/)
* [µExpress / Ultimate Express 1.3.7](https://github.com/dimdenGD/ultimate-express)

## Resources
* http://nodejs.org/api/cluster.html

## Test URLs
### JSON Encoding Test

http://localhost:8080/json

### Data-Store/Database Mapping Test

MongoDB:
http://localhost:8080/mongoose

MySQL:
http://localhost:8080/sequelize

PostgreSQL:
http://localhost:8080/db

### Variable Query Test

MongoDB:
http://localhost:8080/mongoose?queries=2

MySQL:
http://localhost:8080/sequelize?queries=2

PostgreSQL:
http://localhost:8080/queries?queries=2
45 changes: 45 additions & 0 deletions frameworks/JavaScript/ultimate-express/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

/**
* Module dependencies.
*/

const cluster = require('cluster'),
numCPUs = require('os').cpus().length,
express = require('ultimate-express');

const bodyParser = require('body-parser');

if (cluster.isPrimary) {
console.log(`Primary ${process.pid} is running`);

// Fork workers.
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
});
} else {
const app = module.exports = express();

// Configuration
app.use(bodyParser.urlencoded({ extended: true }));

// Set headers for all routes
app.use((req, res, next) => {
res.setHeader("Server", "Express");
return next();
});

app.set('view engine', 'jade');
app.set('views', __dirname + '/views');

// Routes
app.get('/json', (req, res) => res.send({ message: 'Hello, World!' }));

app.get('/plaintext', (req, res) =>
res.header('Content-Type', 'text/plain').send('Hello, World!'));

app.listen(8080);
}
123 changes: 123 additions & 0 deletions frameworks/JavaScript/ultimate-express/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"framework": "ultimate-express",
"tests": [{
"default": {
"json_url": "/json",
"plaintext_url": "/plaintext",
Copy link
Contributor

@joanhey joanhey Nov 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only json and plaintext test here !!
It's the same with PostgreSQL. !!!

Copy link
Contributor Author

@Pho3niX90 Pho3niX90 Nov 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not fully understanding this comment. Are you saying that there is something missing, or, that the only 2 properties in default should be json_url and plaintext_url?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each bench it's necessary to first create the docker image.
And later run the tests. Time is $$ and energy.

Do you think that running alone json and plaintext, and later again with Postgres will exist a difference.
Of course you can try it, because if it so the framework have a problem.

But please don't repeat tests.
If you need more info, ask me.
Thank you.

"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "NodeJS",
"platform": "nodejs",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express",
"versus": "nodejs"
},
"chakra": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "node-chakracore",
"platform": "nodejs",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express",
"versus": "nodejs"
},
"mongodb": {
"db_url": "/mongoose",
"query_url": "/mongooseq?queries=",
"update_url": "/mongoose-update?queries=",
"fortune_url": "/mongoose-fortune",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "MongoDB",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "NodeJS",
"platform": "nodejs",
"webserver": "None",
"orm": "Full",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3th Ultimate-express.
Please add in the name to display [normal, charka, mongo, ... ]

"notes": "",
"versus": "nodejs"
},
"mysql": {
"db_url": "/mysql-orm",
"query_url": "/mysql-orm-query?queries=",
"fortune_url": "/mysql-orm-fortune",
"update_url": "/mysql-orm-update?queries=",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "MySQL",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "NodeJS",
"platform": "nodejs",
"webserver": "None",
"orm": "Full",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express[mysql-sequelize]",
"notes": "",
"versus": "nodejs"
},
"postgres": {
"db_url": "/db",
"query_url": "/queries?queries=",
"update_url": "/updates?queries=",
"fortune_url": "/fortunes",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "NodeJS",
"platform": "nodejs",
"webserver": "None",
"orm": "Full",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express[postgres-sequelize]",
"notes": "",
"versus": "nodejs"
},
"postgresjs": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"db_url": "/db",
"query_url": "/queries?queries=",
"update_url": "/updates?queries=",
"fortune_url": "/fortunes",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"framework": "ultimate-express",
"language": "JavaScript",
"flavor": "NodeJS",
"platform": "nodejs",
"webserver": "None",
"orm": "Full",
"os": "Linux",
"database_os": "Linux",
"display_name": "ultimate-express[postgres.js]",
"notes": "",
"versus": "nodejs"
}
}]
}
69 changes: 69 additions & 0 deletions frameworks/JavaScript/ultimate-express/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[framework]
name = "ultimate-express"

[postgres]
urls.db = "/db"
urls.query = "/queries?queries="
urls.update = "/updates?queries="
urls.fortune = "/fortunes"
approach = "Realistic"
classification = "Micro"
database = "Postgres"
database_os = "Linux"
os = "Linux"
orm = "Full"
platform = "nodejs"
webserver = "None"
versus = "nodejs"

[main]
urls.plaintext = "/plaintext"
urls.json = "/json"
approach = "Realistic"
classification = "Micro"
database_os = "Linux"
os = "Linux"
platform = "nodejs"
webserver = "None"
versus = "nodejs"

[mongodb]
urls.db = "/mongoose"
urls.query = "/mongooseq?queries="
urls.update = "/mongoose-update?queries="
urls.fortune = "/mongoose-fortune"
approach = "Realistic"
classification = "Micro"
database = "MongoDB"
database_os = "Linux"
os = "Linux"
orm = "Full"
platform = "nodejs"
webserver = "None"
versus = "nodejs"

[mysql]
urls.db = "/mysql-orm"
urls.query = "/mysql-orm-query?queries="
urls.update = "/mysql-orm-update?queries="
urls.fortune = "/mysql-orm-fortune"
approach = "Realistic"
classification = "Micro"
database = "MySQL"
database_os = "Linux"
os = "Linux"
orm = "Full"
platform = "nodejs"
webserver = "None"
versus = "nodejs"

[chakra]
urls.plaintext = "/plaintext"
urls.json = "/json"
approach = "Realistic"
classification = "Micro"
database_os = "Linux"
os = "Linux"
platform = "nodejs"
webserver = "None"
versus = "nodejs"
37 changes: 37 additions & 0 deletions frameworks/JavaScript/ultimate-express/graphql-mongodb-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const cluster = require('cluster')
const numCPUs = require('os').cpus().length
const express = require('ultimate-express');
const mongoose = require('mongoose');
const app = express();
const bodyParser = require('body-parser');
const port = 8080;

mongoose.Promise = global.Promise;

mongoose.connect('mongodb://tfb-database/hello_world').then(() => {
console.log('connected to mongo tfb-database hello_world');
}).catch((err) => {
console.log('Failed connection attempt to Mongo: ', err);
});

if (cluster.isPrimary) {
// Fork workers.
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', (worker, code, signal) =>
console.log('worker ' + worker.pid + ' died'));
} else {
app.use(bodyParser.urlencoded({ extended:false }));
app.use(bodyParser.json());

const resolvers = require('./resolver-mongo');

// Routes
require('/routes.js')(app, resolvers);

app.listen(port, () => {
console.log(`Listening on localhost:${port}`);
});
}
28 changes: 28 additions & 0 deletions frameworks/JavaScript/ultimate-express/graphql-mysql-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const cluster = require('cluster')
const numCPUs = require('os').cpus().length
const express = require('ultimate-express');
const app = express();
const bodyParser = require('body-parser');
const port = 8080;

if (cluster.isPrimary) {
// Fork workers.
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', (worker, code, signal) =>
console.log('worker ' + worker.pid + ' died'));
} else {
app.use(bodyParser.urlencoded({ extended:false }));
app.use(bodyParser.json());

const resolvers = require('./resolver');

// Routes
require('./routes')(app, resolvers);

app.listen(port, () => {
console.log(`Listening on localhost:${port}`);
});
}
29 changes: 29 additions & 0 deletions frameworks/JavaScript/ultimate-express/graphql-postgres-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const cluster = require('cluster')
const numCPUs = require('os').cpus().length
const express = require('ultimate-express');
const app = express();
const bodyParser = require('body-parser');
const port = 8080;

if (cluster.isPrimary) {
// Fork workers.
for (let i = 0; i < numCPUs; i++) {
cluster.fork();
}

cluster.on('exit', (worker, code, signal) =>
console.log('worker ' + worker.pid + ' died'));
} else {

app.use(bodyParser.urlencoded({ extended:false }));
app.use(bodyParser.json());

const resolvers = require('./resolver-postgres');

// Routes
require('./routes')(app, resolvers);

app.listen(port, () => {
console.log(`Listening on localhost:${port}`);
});
}
Loading