I have a (stupid) node.js server, which is here for the sole purpose of calling a function from the data that it passed with each request, and responding to the result of that function. Here is the code I'm using:
var pageDown = require('./PageDown/Markdown.Sanitizer').getSanitizingConverter(), http = require('http'); http.createServer(function (req, res) { var data = ""; res.writeHead(200, {'Content-Type': 'text/plain'}); req.on('data', function (chunk) { data += chunk; }); req.on('end', function() { res.end(pageDown.makeHtml(data)); }); }).listen(1337, '127.0.0.1'); console.log('HServer running at http://127.0.0.1:1337/');
I am using this server from python with the following code (atm I just compare, so this is just a stress test):
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests for i in range(1, 100000): r = requests.post('http://localhost:1337/', data="lol") print i print "I'm done :')"
My problem is that this method of success is slow. I have a large database that needs to be processed using this javascript function, and I am looking for ways to make this process faster. Therefore, suggestions are welcome!
source share