-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slim_handler reduce /tmp use and enable significantly larger deployments #1022
Conversation
Great, README updated The existing blog post on Large Applications already says that Zappa supports projects up to 500 MB.
What are you looking for in a blog post? I could write a walkthrough with code snippets to create and deploy a 500 MB project and explain the memory considerations throughout? "Lets Deploy a 500 MB Project on Lambda" or something similar. |
Love the idea, i just don't think it makes a tremendous difference. It still ends up spilling onto disk and you have the zip size and zip folder to worry about. The only change here then is that we have /tmp space plus ram space to put the zip file and the unzipped contents. Setting the RAM size to 650M to account for all of it is over a huge cost increase for the whole application to get it all to fit. I still think a streaming approach is the right long term solution, but this might help the projects that just needed an extra 100M or something to fit it all. For those project zips over 300M though they still might not be big enough to account for the fully unzipped contents in addition to the zip file. |
totally on the same page. I say give it a go packaging with the gzipped tarball and streaming unzip that way |
@mcrowson streaming .tar.gz from s3 works great. # Resources
remote_bucket, remote_file = parse_s3_url(project_zip_path)
s3 = boto_session.resource('s3')
# S3 File Object
remote_project = s3.Object(remote_bucket, remote_file)
# remote_project byte stream
raw_stream = remote_project.get()['Body']._raw_stream
# Create tarfile from byte stream. Note mode = 'r|gz' not 'r:gz'
# For mode explanation see https://docs.python.org/2/library/tarfile.html
remote_archive = tarfile.open(None, 'r|gz', fileobj=raw_stream)
# Extract as usual
remote_archive.extractall(path=project_folder) It looks like both the cli and core need updating to implement this feature. That's a little more than I intended to bite off. Do you know of any contributors who might consider updating the client-side tools? If not, how about merging the |
I've already found this code to be super useful! I'd like to deploy my app with this, but I dont want to manually copy over handler.py every time i reinstall Zappa... What's the status of this PR? |
@dswah I believe @mcrowson is waiting on an update wrt @mbeacom's streaming gzip implementation over on #881 before making a recommendation to merge this (not as good) solution. @mbeacom, if you had any trouble wrestling that s3 file object into a stream (I did) there's a code snippet ^ that might be helpful. |
Closing due to better solution at #1037 |
Description
Updated slim_handler behavior to:
Previously:
Now:
GitHub Issues
#1020
#961
#881