cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

[CAL-119] Initial rendering of calendar takes 3-5 seconds!

Open timfee opened this issue 3 years ago • 17 comments

See image -- on a fast connection, with a single calendar configuration -- painfully slow.

Screenshot_2022-09-16_09-09-20_1o326Lzi

timfee avatar Sep 16 '22 16:09 timfee

can you post the link here?

PeerRich avatar Sep 19 '22 01:09 PeerRich

https://cal.com/tim/15

timfee avatar Sep 19 '22 13:09 timfee

Update from @emrysal

I think that's a bad ticket - it's been improving slowly ever since that was assigned to me but I'm not sure what is possible and it's continual improvement

ciaranha avatar Nov 19 '22 10:11 ciaranha

We also experience this issue. A lot. @Jaibles

Tom-Potanski avatar Jan 04 '23 19:01 Tom-Potanski

we have an ongoing task to improve performance of this. the main issue is that the cold boot of serverless functions is slow. this gets better if your app is used more frequenlty -- i know not a perfect solution. we're trying to find a way to do this without cold boot

PeerRich avatar Jan 04 '23 19:01 PeerRich

note to self: https://cal.com/peer/30min is faster, surprisingly

PeerRich avatar Jan 04 '23 20:01 PeerRich

What API is it using? What file? Random guess: https://github.com/calcom/cal.com/blob/main/apps/web/pages/api/book/event.ts

You might consider using Edge API Routes, which will help you get faster cold startups: https://nextjs.org/docs/api-routes/edge-api-routes

export const config = {
  runtime: 'edge',
}

export default async function handler(req: Request) {
  return new Response()
}

But I think would need to verify this is possible with next-auth.

leerob avatar Jan 04 '23 23:01 leerob

note to self: https://cal.com/peer/30min is faster, surprisingly

the getSchedule request for your calendar takes almost 3s for me to complete as well

image
~ ❯ time curl 'https://cal.com/api/trpc/viewer.public.slots.getSchedule?batch=1&input=%7B%220%22%3A%7B%22json%22%3A%7B%22eventTypeId%22%3A127%2C%22eventTypeSlug%22%3A%2230min%22%2C%22usernameList%22%3A%5B%22peer%22%5D%2C%22startTime%22%3A%222023-01-02T23%3A00%3A00.000Z%22%2C%22endTime%22%3A%222023-01-31T22%3A59%3A59.999Z%22%2C%22timeZone%22%3A%22Europe%2FBerlin%22%2C%22duration%22%3Anull%7D%2C%22meta%22%3A%7B%22values%22%3A%7B%22duration%22%3A%5B%22undefined%22%5D%7D%7D%7D%7D' > /dev/null --compressed
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1394    0  1394    0     0    684      0 --:--:--  0:00:02 --:--:--   686
curl  --compressed > /dev/null  0.02s user 0.01s system 1% cpu 3.048 total

lukasklein avatar Jan 05 '23 07:01 lukasklein

Woah.

In this release, we have decreased the size of our engine files by an average of 50%. The size of the Query Engine used on Debian, with OpenSSL 3.0.x, for example, went from 39MB to 14MB. We will also remove some smaller engines to decrease the total size in future versions.

https://github.com/prisma/prisma/releases/tag/4.8.0

You might want to update! (Assuming this API route uses Prisma)

leerob avatar Jan 05 '23 14:01 leerob

@lukasklein

the getSchedule request for your calendar takes almost 3s for me to complete as well

well 3 seconds is still better than 5 to 10 seconds (which we have seen too)

PeerRich avatar Jan 05 '23 18:01 PeerRich

anyone interested in this, we're making a bit of progress. stay tuned.🙏

PeerRich avatar Jan 07 '23 10:01 PeerRich

we have identified that one of the slowness reasons is a slow caldav server for the affected users.

we can still improve prisma and cold boots tho

PeerRich avatar Jan 09 '23 11:01 PeerRich

/bounty $1000 per second

PeerRich avatar Jan 13 '23 16:01 PeerRich

💎 $1,000.00 bounty created by PeerRich 👉 To claim this bounty, submit a pull request that includes the text /claim #4535 somewhere in its body 📝 To receive payouts, join Algora and complete the relevant onboarding steps 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🌳 If you want, you can donate 100% of the rewards to climate change projects! 🙏 Thank you for contributing to calcom/cal.com!

algora-pbc[bot] avatar Jan 13 '23 16:01 algora-pbc[bot]

@PeerRich I have an idea that could solve this, i will submit a pull request soon.

roae avatar Jan 28 '23 01:01 roae

💡 roae submitted a pull request that claims the bounty 👉 To accept and/or reward this claim, visit your org dashboard on Algora

algora-pbc[bot] avatar Jan 29 '23 05:01 algora-pbc[bot]

@roae cal wants to reward your solution. Please sign up on Algora, link your Github account and connect with Stripe on your dashboard.

algora-pbc[bot] avatar Mar 07 '23 15:03 algora-pbc[bot]

roae has completed their onboarding. You can now complete the payment on your org dashboard

algora-pbc[bot] avatar Mar 07 '23 21:03 algora-pbc[bot]

🎉🎈 @roae has been awarded $1,000! 🎈🎊

algora-pbc[bot] avatar Mar 15 '23 17:03 algora-pbc[bot]

we ended up hiring @roae 🙏

PeerRich avatar Mar 15 '23 18:03 PeerRich

https://cal.com/tim/15

@timfee we just released Data Proxy. Can you verify if it's still slow?

zomars avatar Mar 16 '23 03:03 zomars

See attachment. Still seems like it's a bit slow, but better than before!

https://user-images.githubusercontent.com/3246342/225504906-9a1148e1-7913-4d4a-a92e-381b31428fd0.MOV

timfee avatar Mar 16 '23 03:03 timfee