In The Works – Amazon Aurora Serverless
aws.amazon.com
aws.amazon.com
My aim was to host a Wordpress or Laravel site on aws lambda without paying any monthly hosting charges. I got everything running (sessions, fs, request, etc) except of course I still had to use RDS and I think this takes care of it too. So now I can expect to run a full site which is only billed by the amount of resources consumed.
Of course my project was just for my own amusement but I think this is the way how it's going to be done soon or where Aws is heading. Seems pretty nifty!
The funny thing is the response time is quite good despite running it through a NodeJS server that launches a PHP binary (340ms, faster than 98% of the sites as per pingdom[1]).
[1] https://tools.pingdom.com/#!/ex9izm/https://www.lambdaphp.ho...
340ms is not a good response time at all. You need to elevate your expectations.
It's not persistent in that it exists between requests, but for the use case here it's exactly what is needed. He would save significant response time by having php-fpm already running, code parsed, opcodes cached and just issuing a new FCGI request to php-fpm instead of relaunching the PHP CLI each and every time.
How much do you reckon we can get the response time with these optimizations? Right now the 340ms is nodejs + php-cli + my wrapper script (that inits s3, etc) + the actual content script (another php file) and request for the css framework from a CDN.
So as long as the function is hot, it won't reconnect.
edit: https://medium.com/@tjholowaychuk/aws-lambda-lifecycle-and-i...
Doing some searching, I did find this that seems much closer: http://blog.rowanudell.com/database-connections-in-lambda/
TLDR; you can define the connection to DB outside of the scope of a given function, so it’s scoped to the container and can be reused so long as the container is not recycled. Seems promising!
You also forgo certain optimizations within the DB designed to make fetching things for the given connection/scope faster, such as temp tables.
> The endpoint is a simple proxy that routes your queries to a rapidly scaled fleet of database resources.
That doesn’t seem to preclude a multiplexing proxy a la PgBouncer.
Either way, sweet tech. Seems like a fun thing to build
If it is for the master, that would be amazing and I would wonder if you can scale up past the 1 instance size max (currently r4.16xl)
EDIT: pretty impressive though, looking at James Hamilton's criteria for "Automatic Management and Provisioning" here: https://www.usenix.org/legacy/event/lisa07/tech/full_papers/... , I think this addresses everything database related, as long as you are under the maximum capacity of Aurora.