Why so difficult? Nginx for all your static files and proxy to your node/express server.

I use nginx in front of Node on some of my projects — I can see its utility, but it adds a layer to the stack which I try to avoid if I can (memory footprint, configuration / administration complexity). I would be curious to see head-to-head performance comparison of serving large text files between Express(static) and nginx.

You’re right — the round trips, while short compared to a http round trip, slow down using Redis, but it’s a trade off. Caching with variables in-process (object[key]=value) didn’t prove to be a good method in my experience. Javascript isn’t very memory efficient for storing lots of string data (I talk about Node vs Redis memory efficiency here) and GC can cause problems in some situations. Also, if you have multiple node processes, you’re storing the data multiple times which eats memory needlessly.

Like what you read? Give Kyle a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.