since 2006 • Worked in countless projects • Contact me if you are looking for work gigs! • A FOSS supporter, and contributor • CakePHP 1.3 book recently published • Survived Node Knockout 2011
What can I do then? • Add caching • Add workers • Faster DB • Vertical scale: add more resources • Horizontal scale: add more servers • Still can't get n10K concurrent users?
running in Node.js • No parallel execution... for YOUR code var http = require('http'); http.createServer(function(req, res) { console.log('New request'); // Block for five seconds var now = new Date().getTime(); while(new Date().getTime() < now + 5000) ; // Response res.writeHead(200, { 'Content-type': 'text/plain' }); res.end('Hello world!'); }).listen(1337); console.log('Server running at http://localhost:1337');
port = 1337; var app = express.createServer(); app.get('/messages/incoming/:id', function(req, res){ var r = ... var userId = req.params.id; if (!userId) { return r(new Error('No user ID provided')); } var since = req.query.since ? req.query.since : false; if (!since || !/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(since)) { since = '0000-00-00 00:00:00'; } new mysql.Database(...).connect(function(err) { if (err) { return r(err); } ... }); }); app.listen(port); console.log('Server running at http://localhost:' + port);