- Run strip all .so libraries -- many aren't stripped fully
- In Python I manually deleted sub packages of numpy/scipy I didn't need
- If you're loading large models at initialize, numpy load routines are _much_ faster than cPickle. Have it load at module initialization, not during each invocation.
I should really write a blog post about my experience with it.
At a certain point I decided I was doing something that lambda really wasn't designed for -- I'm looking at migrating off, but the current implementation makes capacity planning super easy. Provisioning 1000 machines with 1GB of RAM for 15 minutes every day to read off a queue isn't a trivial problem.
(Also, if anyone from AWS is reading, being able to limit the max concurrency of a single function vs account level limits would be super useful).
Would love to see a blog post to compare experiences..
(Speaking of blogposts.. that was somewhere on the todo list..)
Have you considered extracting the assessment functionality into an SWF activity, invoked from your Lambda via StepFunctions?
We considered running it on EC2, but the economics just didn't work out for our needs (hundreds of parallel processed jobs with irregular spikes, <5s runtimes per invocation and some others)
I'm curious what sort of things you did to shrink your model?
Have you considered pulling the model data from S3 outside of the main lambda handler and seeing if that negatively impacts performance -- with a cloud watch event running every 5 minutes or so to keep the function warm?
Hadn't thought about a CloudWatch even to keep the function warm, I might suggest that to the team.
We haven't shrunk the model, we've deleted superfluous files from the TensorFlow python library and dependencies (we don't need tensorboard, for example).
It would be nice if you could package TensorFlow up into a minimal component just for assessment and not have any of the 'learning' stuff or other added-on libraries, but we couldn't find a simple way of doing that - we're not pro C++ engineers and even our python is not the greatest. We're managing for now, but if our model grows any bigger we will run into issues, but there have been some good suggestions in here.
We had considered the S3 store, but we ruled that out quite quickly for cost & performance at the number of invocations a months we're looking at - but that was before we knew more about the 'keeping warm', so that may be revisited, too.
For example in one Lambda function, we use Guice to get resources from S3.
Disclaimer: work @ algorithmia
https://aws.amazon.com/blogs/compute/seamlessly-scale-predic...
I feel like Amazon could do some work in this area to support users to use their own engines and not be bound to AWS AI Platforms and Services.
This could be as simple as publicly documenting the time lambda's stay 'warm' for and retain data in /tmp persisting through multiple invocations or some other examples on how an AI workflow could be implemented with popular custom engines such as TensorFlow.
Does anybody else have any experience in this regard?