-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: add ultimate express #9390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
NateBrady23
merged 15 commits into
TechEmpower:master
from
Pho3niX90:feature/add_uexpress
Dec 13, 2024
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
98c2a34
feat: add ultimate express
Pho3niX90 11e2bd7
feat: add ultimate express
Pho3niX90 d468cd8
refactor(express): simplify response handling by removing writeRespon…
Pho3niX90 16db140
fix: unique display names
Pho3niX90 96bba27
fix: names
Pho3niX90 b1ea37d
fix: add db/query/update/fortune urls
Pho3niX90 d45b608
fix: missing orm value
Pho3niX90 543092f
fixes
Pho3niX90 3017dc6
fixes
Pho3niX90 c752e2a
fixes
dimdenGD c89ade1
full refactor
dimdenGD fcdf324
fix etag and disable x-powered-by
dimdenGD 4fcc1db
generate json dynamically
dimdenGD b9b29fa
fix space
dimdenGD 8f5b177
use fjs
dimdenGD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| package-lock=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
123
frameworks/JavaScript/ultimate-express/benchmark_config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| "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", | ||
|
||
| "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" | ||
| } | ||
| }] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
37
frameworks/JavaScript/ultimate-express/graphql-mongodb-app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
28
frameworks/JavaScript/ultimate-express/graphql-mysql-app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
29
frameworks/JavaScript/ultimate-express/graphql-postgres-app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}`); | ||
| }); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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. !!!
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.