-
Notifications
You must be signed in to change notification settings - Fork 143
Add documentation for deploying to AWS Lambda #123
Comments
Have others got this running on Lambda? |
I've certainly never tried to get it running on Lambda. I looked over the branch and it seems pretty simple. Would be happy to take a look at a PR! |
@stevearc after playing with it a bit more I realized I was getting TERRIBLE performance. Installing some of my standard requirements files was taking 2 minutes instead of 10 seconds (and all packages were still cached, it was just doing index checks). Debugged it a bit and determined that it was pyramid_tm causing the slow down. Removed the dependency and confirmed that theory. I'm not really familiar with Pyramid or the transaction library. I understand the concept of what it's trying to do, but don't know about the internals of how it does it. Any thoughts on why pyramid_tm would be so much slower? |
What cache backend were you using? If you just remove pyramid_tm then the database operations would...I guess each one would be wrapped in a transaction? Really all that pyramid_tm is doing is opening a transaction at the beginning of a request and committing (or rolling back) at the completion of the request. If it's slow, then it's probably because of some contention on the DB, or that something in pypicloud is performing the operation improperly, or both. The next step would probably be to inspect the DB during operation to see if anything is amiss. |
@stevearc using dynamodb and s3. I'll try and dig into the dynamo interaction when I have some time. |
That's very strange then, because nothing should be hooking into the I'm going to be off the grid for a week or so. If you hit other roadblocks let me know and I'll look into it when I get back. |
has there been any progress with this? I'm currently looking to deploy this to an all aws configuration, and this is possibly the last step. |
I haven't looked into this since then, but I'd be curious to know if the Lambda deployment worked out. Another method possibly worth investigating is deploying as a container with Lightsail. |
We ended up moving away from this solution for various reasons. So I never spent enough time to figure out where the slowness discussed above came from. |
I just went through the steps to reproduce what I did back in September. Here's some notes if anyone would like to reproduce this and debug the timing issue more (or confirm/deny that they also get the timing issue): requirements.txt:
Note that this is using a branch that has modifications to pypicloud and is not the mainline pypicloud code. zappa_setttings.json
server.ini
zappa will create an api gateway and lambda, you should be able to hit the home page by going to the api gateway url when this step is done.> If you make changes to anything and want to update the existing deployment, run To remove the deployment, run If anyone wants to take my hacked together steps here and put them into something more formal, please by all means do so, you have my blessing. |
i have a working example that uses serverless framework and lambda -- the only thing I can't figure out is, I seem to have corrupted package uploads. I don't think it's related to the serverless deployment but am having trouble pinpointing the exact issue (see details here: #221 ). I can make a copy of my code publicly available if people are interested. |
update: I found the issue -- API gateway was refusing those binary data types ( |
@stevearc @brianrower Thank you for the valuable information. Seems like I'm running into similar issue, I am using same backend storage(s3) and cacheing (dynamoDB) as described by Brian. Can we expect the fix for the same anytime soon ? If you want me to create a seperate issue, I can do that as well. Please let me know. |
Still no idea why pyramid_tm would tank performance. I made a branch here with a change that should completely exclude pyramid_tm if it's not needed (i.e. no SQL backends). Could you try it and see if that solves your problem? |
Hey @stevearc thank you for making the necessary changes required in a new branch. I'm going to try it out now. Before that I think you'd still need to remove "pyramid_tm" from setup.py, correct ? |
Well, I'm not exactly sure what changes @brianrower made when he tested it, but even if That said, it's already a mystery to me why using pyramid_tm would slow anything down that much, so it's possible that there's something else I don't understand causing performance to tank even when it's just installed and not used. Even if that's the case, I think it's worth trying this patch to narrow down where the problem is occurring. |
@stevearc Thank you for creating the branch and making necessary changes. I further made following changes.
Uploaded the required package on both pypiclouds to compare between both
So, there is at-least 40 seconds difference on an average.
wondering If there is any way to handle it in way where those request happen only once while performing the package download/installation in which way we could save a lot of time and that would be a great performance enhancement overall. I'd like to know your thoughts and ideas towards it. |
Also, any idea why it throws warnings like this on regular intervals (minutes of every hour) when idea?
|
Couple of thoughts:
|
No description provided.
The text was updated successfully, but these errors were encountered: