zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.24k stars 362 forks source link

Extremely slow app update through zappa update --all #1129

Open nyxdata opened 2 years ago

nyxdata commented 2 years ago

I've built a small serverless application about ~10mo.

When I use the command zappa update, it takes at least 10 minutes before the beginning of the update.

I use windows and the following settings:

{ "dev": { "app_function": "app.app", "aws_region": "eu-west-1", "profile_name": "user", "project_name": "nyx", "runtime": "python3.8", "s3_bucket": "zappa-nyw", "memory_size": 2048 } }

I've tried to add exclusion exceptions to get it faster but nothing has changed.

Thank you for your help.

NinitoAS commented 2 years ago

Windows deployment and updates are 5-15x slower on Windows than on Linux and macOS unfortunately. Zappa was developed on a mac and works best on UNIX-based.

I tried debugging it when I was on Windows, but it was a problem with a recursive function which goes through the folders of the project and it was not easy to pin-point the problem

Before I changed to mac, I was using WSL2 to "bypass" that issue, which I recommend you using too

Techget commented 1 year ago

I'm on ubuntu, zappa is also running extremely slow on my laptop , and it used to be very fast, it uses 100% CPU

$ zappa -v
0.57.0
$:~/talkToGiantSummary$ top

top - 22:12:05 up 29 min,  1 user,  load average: 1.48, 1.48, 0.88
Tasks: 330 total,   2 running, 328 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.2 us,  0.4 sy,  0.0 ni, 90.9 id,  0.4 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15641.4 total,    192.3 free,   3171.5 used,  12277.6 buff/cache
MiB Swap:   2048.0 total,   1972.0 free,     76.0 used.  10707.0 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                             
   3417 xuan      20   0  191676 101900  12360 R  95.3   0.6   7:53.11 zappa      
souravjamwal77 commented 1 year ago

Hi @Techget You need to provide your zappa_settings.json file and requirements.txt file in order for us to pinpoint the issue.

Techget commented 1 year ago

Thanks for the reminder, following is the corresponding info

zappa_seetings.json:

{
    "dev": {
        "app_function": "api.app",
        "aws_region": "ap-southeast-2",
        "profile_name": "default",
        "project_name": "project name",
        "runtime": "python3.8",
        "s3_bucket": "s3_bucket",
        "lambda_description": "lambda to generate ttg summary",
        "apigateway_description": "Serverless API endpoints using Zappa for lambda to generate ttg summary",
        "cors": true,
        "slim_handler": true,
        "timeout_seconds": 300,
        "environment_variables": {
        }
    }
}

requirements.txt

aiohttp==3.8.4
aiosignal==1.3.1
argcomplete==3.1.1
async-timeout==4.0.2
boto3==1.26.155
botocore==1.29.155
Flask==2.0.2
flask-core==2.9.0
Flask-Cors==3.0.10
Flask-SQLAlchemy==2.5.1
itsdangerous==2.0.1
Jinja2==3.0.3
sentence-transformers==2.2.2
networkx==3.1
scikit-learn==1.2.2
langchain==0.0.202
langchainplus-sdk==0.0.10
numexpr==2.8.4
numpy==1.25.0
openai==0.27.8
openapi-schema-pydantic==1.2.4
packaging==23.1
Pillow==9.5.0
placebo==0.9.0
psycopg2==2.9.2
psycopg2-binary==2.9.2
pycparser==2.21
PyMySQL==1.0.2
pyparsing==3.1.0
PyYAML==6.0
regex==2023.6.3
requests==2.31.0
s3transfer==0.6.1
scipy==1.11.0
six==1.16.0
SQLAlchemy==1.4.28
sympy==1.12
threadpoolctl==3.1.0
toml==0.10.2
tqdm==4.65.0
triton==2.0.0
troposphere==4.3.2
typing-inspect==0.9.0
typing_extensions==4.6.3
urllib3==1.26.16
Werkzeug==2.0.2
yarl==1.9.2
zappa==0.57.0
souravjamwal77 commented 1 year ago

So, you have only one region deployment or multiple region deployments? If it's only one then I would look into the internet connection and the place from where you're trying to deploy.

Techget commented 1 year ago

Deploying to single region and the network speed is okay with ~5 MB/s.

It often stucks at a stage for quite while e.g. Packaging project as gzipped tarball.

souravjamwal77 commented 1 year ago

Here is what I would do:-

  1. Check uplink/upload speed
  2. The place you live in and the region you're uploading to (there could be latency issue, if there is any package check is happening then I think it has to make 2 zips and 2 seperate uploads. Read this Article
  3. If you're using a mobile hotspot even on a 4g network then still the uploads will be slow and slim handler may also be slow to package the packages.

Let me know what worked for you. I will try to replicate your setup.

You can also join our Slack channel using this link

github-actions[bot] commented 5 months ago

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

nyxdata commented 5 months ago

still have the same issue.