Run the benchmark:
$ npm i benchmark
# Run the AsyncLocalStorage benchmark
$ node async-local-storage.js ASL
ASL x 15,551 ops/sec ±3.30% (79 runs sampled)| 'use strict'; | |
| var modelConfig = require('../model-config.json'); | |
| module.exports = function(app) { | |
| app.use(function(req, res, next) { | |
| // set tenant based subdomain or use public | |
| var subdomain = (req.subdomains.length > 1) ? req.subdomains.pop() : req.subdomains[0]; | |
| var tenant = req.subdomains.pop() || 'public'; |