Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
First up: 3.5 MB of postdata where the properties all end up in the same hash bucket
einaros@dumpster:~/crashtest$ time curl -d @postdata_bucketcrash http://localhost:9999
279343: ok
real 0m52.142s
user 0m0.044s
sys 0m0.052s
Second: 3.5 MB of postdata where the properties (mostly) end up in different hash buckets
einaros@dumpster:~/crashtest$ time curl -d @postdata_plain http://localhost:9999
279343: ok
real 0m1.562s
user 0m0.028s
sys 0m0.052s
Conclusion:
For this test, with a relatively small amount of data, parsing the colliding properties takes roughly 33x the time. Generating a significantly larger data set is trivial => keeping a server busy is trivial.
The test application:
var express = require('express');
var app = express.createServer();
app.use(express.bodyParser());
app.listen(9999);
app.post('/', function(req, res) {
res.end(Object.keys(req.body).length + ': ok\n');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.