-
-
Save einaros/73944170aeb88634c599 to your computer and use it in GitHub Desktop.
This file contains 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
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