Django is the problem. Even if I don't trigger the database to connect, the startup costs are noticeable to validate models and load things that won't ever be used.
so maybe lambda its not suitable for things that are less than a few seconds.
I could write python with no django and try to structure things so they don't need database. but then I would have to take input from and put output data back to a queue of some sort.
>> A quick back-of-the-envelope test
and actually python on mine was even faster than node when both are doing nothing. so my assumption was wrong (but its based on mostly using django and all my node stuff is small servers and tools)
» time node noop.js
node noop.js 0.04s user 0.01s system 98% cpu 0.045 total
» time python noop.py
python noop.py 0.01s user 0.01s system 90% cpu 0.026 total
but importing significant numbers of libraries would be the real test.
the main benefits to lambda would still be:
- scaling for high demand
- no cost for idle time
and let's not worry about the micro pennies in startup times
A quick back-of-the-envelope test on my machine for both node and python suggest similar (around 100 ms) start up times for the bare environments.
Do you just mean that you'd prefer to use node for smaller jobs anyway?