I am new to performance optimization, and while I recognize nodejs may not be the most beginner friendly place to start, it's the task at hand.
The observation: simple JSON API requests take in the order of hundreds of milliseconds on a staging server with no load and <10 users in the database. Particularly, the call to /api/get_user is taking ~300ms
to execute this code:
exports.get_user = function(req, res) {
return res.json(req.user)
}
(Note: we store our sessions in Redis)
The stack:
- Nodejs
- Express
- Redis
- Mongo
Where do I start?