by s_kilk · 6y ago · 0 comments
Zappa (python) has a deployment configuration that allows this. It's basically a Lambda that keeps itself alive all the time and for each request, fetches the SQLite DB from S3, does its transaction, and then puts the modified database back on S3.
The upside is it's basically free for low traffic read-only apps, the downside is the obvious problem of write conflicts if you have more than one write-capable user at any given time.
If you were to use the django test framework to generate a new SQLite DB on each request, you'd have what you're talking about.
One fewer network hop compared to DynamoDB, and for something that might get an update once a week or even once a month I get low latency without having to oversubscribe to another service.
Comparing a read of a database driven app (going to the URL and getting the admin login in Django via Lambda/SQLite/S3) to an async javascript submission (submitting a form on a cloudfront static site that POSTs to DynamoDB), the javascript/DynamoDB round trip is faster by about a full second.
I suspect it's because of the simple bulk of the Django deployment. Putting the whole bundle on a Lambda with all of its dependencies was about 45-46 megs of crap, whereas a simple Node DynamoDB insert is a couple dozen lines.
So ultimately, while spiffy to play with, I didn't bother to use it much due to performance. Although it has been awhile, I heard that Amazon made some Lambda changes recently to address initial wake-up request performance.