Skip to content
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

Slow TTFB (Time to First Byte) for a very simple production deployment. #4646

Closed
driglou opened this issue Jun 21, 2018 · 18 comments
Closed

Comments

@driglou
Copy link

driglou commented Jun 21, 2018

I've created a basic "Hello world example, however when deploying in production mode I am getting slow loading speed, which is mostly accumulated by slow TTFB.
I'm deploying to zeit.co Premium plan.

network-test

Repository for reproduction - https://github.com/driglou/satv

@timneutkens
Copy link
Member

As you can see here: the TTFB is considerably lower:
https://dfhjdsjfhjdshjfhjhjksdf-ilsvtjqpfn.zeit.sh/

The only changes I made:

  • rm yarn.lock
  • rm yarn-error.log (doesn't make a difference, just clean up)
  • rm -rf .next
  • added a .gitignore with .next as contents

Then I ran

now

I made no changes to the code.

@driglou
Copy link
Author

driglou commented Jun 22, 2018

I've cleaned up, however I am still seeing the same results, while your deployment has indeed a smaller TTFB

Example - https://satv-tgrbmyzrec.now.sh/
Code - https://github.com/driglou/satv

@driglou
Copy link
Author

driglou commented Jun 25, 2018

Additionally I have tried Nextgram example app - https://github.com/now-examples/nextgram
I just downloaded the project and deployed with:
now --regions bru

I think it's quite important if there is a possiblity to cut 400ms from TTFB

ggg

@timneutkens
Copy link
Member

Could you check the latency on http://sfo.now.sh/ and http://bru.now.sh/? Also what location are you testing from?

@driglou
Copy link
Author

driglou commented Jun 25, 2018

SFO avg. 200-250ms
BRU avg, 50-80ms

I am testing from Romania with 290mb/s internet speed.

@timneutkens
Copy link
Member

So I've scaled https://satv-tgrbmyzrec.now.sh/ to bru and the TTFB is ~200ms. It seems like the majority is latency 🤔

@driglou
Copy link
Author

driglou commented Jun 25, 2018

I do not necessary disagree with what you say, however interestingly your example - https://dfhjdsjfhjdshjfhjhjksdf-ilsvtjqpfn.zeit.sh/
gives me around 230ms TTFB with the rest of the loading time being similarly just TTFB being smaller. Makes me wonder....

@driglou
Copy link
Author

driglou commented Jun 25, 2018

https://ietv-tszrtadfvd.now.sh/ on this one I have region BRU with scale rules min:3 max:3

It's interesting that your examples come out with 200ms and mine with 700ms TTFB time. I am not sure I could get on your examples 200ms if I am getting 700ms on mine due to latency.

Do you have any ideas or suggestions?

@danbeck
Copy link

danbeck commented Jun 26, 2018

I observed the same behavior. For the the static frontpage of my app (Link: https://wwwtest.urteile-gesetze.de/, Premium plan), I got 270ms TTFB.

I have the impression that there is simply too much load on the zeit.co servers. This makes page-rendering on the server very slow. I will benchmark the rendering-speed this weekend.

@jhalvorson
Copy link

I'm seeing similar behaviour on SF01, however, my TTFB is consistently 1.5-1.6 seconds

@robertoaikode
Copy link

Hello! I'm from Chile, I have a spa test in the firebase housing and this load is very fast.

Now, develop another test spa with Next.js that you implement in Zeit hosting (sfo.now.sh) and the first load is always slow :( very slow

@timneutkens
Copy link
Member

@danbeck your app has a 110ms ttfb for me.

@jhalvorson based on your profile you're from Edinburgh, try scaling to BRU1, it'll avoid a roundtrip halfway around the world.

@robertoaikode what's your deployment url?

@driglou based on x-now-trace the deployment you're mentioning (https://ietv-tszrtadfvd.now.sh/) is in SFO1: x-now-trace: bru1,sfo1

You can check this using curl -I https://ietv-tszrtadfvd.now.sh/

@jhalvorson
Copy link

Hey, sorry meant to say BRU1, not SFO1. The TTFB is ~350 this morning which is way better than last night (scaled to 2 auto). I'll keep an eye on it and reach out if it gets back to the slower speeds. I presume a Next.js GitHub issue isn't the best place to reach out for Now issues, should that be the Slack channel?

@timneutkens
Copy link
Member

I presume a Next.js GitHub issue isn't the best place to reach out for Now issues, should that be the Slack channel?

Yeah, definitely 👍 https://zeit.chat (for anyone coming to this issue)

@robertoaikode
Copy link

@timneutkens the url is https://propiedadesmussa-ujaidvjqfe.now.sh/

When entering, the first charge always takes up to 1 minute.
When updating, the load is fast.

I re-enter after being inactive for a few hours and the aforementioned is repeated.

@timneutkens
Copy link
Member

@robertoaikode that's because by default instances freeze. You can read about scaling your app here: https://zeit.co/docs/other/faq#why-does-my-deployment-occasionally-have-long-response-times

@lluisnieto
Copy link

lluisnieto commented Nov 28, 2018

I'm also experimenting very high latency in Firebase Storage files:
(Barcelona, 300mb/s)
https://i.ibb.co/HrY4CXL/Captura-de-pantalla-2018-11-28-a-les-1-11-55.png

@timneutkens
Copy link
Member

timneutkens commented Nov 28, 2018

I'm also experimenting very high latency in Firebase Storage files:

That's unrelated to Next.js.


I'm going to close this issue since we introduced https://zeit.co/blog/now-2

@lock lock bot locked as resolved and limited conversation to collaborators Feb 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants