Fastest Way to get node.js to respond with a GIF under load
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

We spent a lot of time today working on making a node app respond quickly to a request for a gif usign ActionHero.js. We noticed some latency we didnt think was caused by backend logic which then caused a long rabbit hole for the team to make/combine/cook different solutions in node that can serve just a single static asset...really fast to prove if the issue was in fact on actionhero, our host, or just limitations of node in general. We seemed to be unable to get nodejitsu / joyent/aws run node code that would take the request and respond in less than ~100ms. sometimes more or less. At times we were able to get it to 60ms but at no point under load could we get it stable, under load 500/1000/s it would fall out to 300ms +

Id like to get some out of the box thinking on how to make a really high performance nodejs app serve a gif back to the end user in the fastest time possible. (caveat I know client connection speed plays a huge part in this but I know we are doing something wrong that we need to solve) When I look at our erlang app that does similar it has a rock solid 40-45ms response even much larger load on equal hardware. I am sure nodejs can do it I just need a concept app that we can take and use for some proof points.

This bounty is for an node app that will scale to handle 1K requests per sec with a response time at or below 50ms. Granted hosting variables are some consideration but between aws nodejitsu and joyent we should be able see this thing serving a gif really quickly. If you want to be fancy use ActionHero and see if you can get it to serve the gif quickly to a request.

I dont mind choosing the bounty base on a hosted version of the solution and then after selection you can share installation information.

For inspiration I checked out a few random sites and found that obviously things can be sub 40ms like this from google

or this image from imgur 15ms

I don't mind 3rd party code if there is a nodejs project already that can help prove some of this out for us

It's not fair to compare your servers with Google / imgur (Cloudflare) servers. They both have several data-centers all around the world, their are most likely using nginx or even more optimized HTTP servers and both requests reply with headers that suggest they are using HTTP caching servers like Varnish (imgur certainly is {here is a miss with +200ms}, Google, not 100% sure). If you put nginx in front of your node.js server and enable the gzip_static module you'll achieve those speeds (assuming the latency of your servers is not huge). Taking your prior question into account, I'm assuming you need node.js to perform some kind of tracking action before/after serving the file...? It would help to actually see the code and to understand your needs.
alixaxel over 5 years ago
Alex, here is some helpful. We made a flame chart. which highlights maybe something going on weird the way this is working is we use actionhero as the API for front-end and it calls another system to get the pixel. the other system is the erlang one and its a rock solid 50ms. so we know all of the latency we have is coming from actionhero, also under load we know it starts dying pretty quickly. here is a zip of the code as we are running today.
Qdev over 5 years ago

Crowdsource coding tasks.

0 Solutions