Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Deployed to EBS with Docker. First load is REALLY SLOW

default discord avatar
gaboluque2 years ago
9

I've managed to deploy my Payload app to AWS EBS using docker. I'm using the example

Dockerfile

with the exception of the run command; instead of using node, I'm using pm2 (

CMD ["pm2-runtime","dist/server.js"]

)



Once it's deployed, the first load of the admin is SO SO Slow! API responses are ok, I imagine is something to do with webpack? But I'm not sure how to debug this. Any idea?

  • discord user avatar
    denolfe
    2 years ago

    How slow are we talking? 3 seconds? 10 seconds? More?



    Do you see the same slowness when building the dockerfile then running it locally?

  • default discord avatar
    gaboluque2 years ago

    About a minute to first load

  • discord user avatar
    jmikrut
    2 years ago

    whaaaaat



    do you have

    NODE_ENV=production

    ?



    you should be running in production mode, which should completely bypass Webpack and serve static, prebuilt admin files



    make sure you have that set and then you should be golden

  • default discord avatar
    trexxx99last year

    Any update on this topic? I deployed to EC2 with DocumentDB using docker. I have NODE_ENV=production on my Dockerfile. It takes about 1-3 minutes on first load.

  • discord user avatar
    denolfe
    last year

    What EC2 and database specs? Is provisioning of the resource included in your timings?

  • default discord avatar
    trexxx99last year

    I'm using t2.small and running it along with a next.js application. Apparently, after debugging in the developer console on the browser i noticed that the main.js file is way too large about

    30 mb

    . Which keeps the page loading depending on the internet speed.

  • discord user avatar
    denolfe
    last year

    Sounds like an issue with how you're building your image. Can you provide more info?

  • default discord avatar
    trexxx99last year

    I'm simply running it with docker compose. Found the Docker build file in the docs.



    See that the selected resource is way too large.

  • default discord avatar
    rentprompts12 months ago

    I have the same issue, payload cms with next app with prod build running on good sized cloud server with mongo db atlas, it takes about a min after login and all other pages also slow about 20 seconds .

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.