I spun up the SvelteKit Template blog and started looking through the code. I see it uses Houdini (houdinigraphql.com) to handle the api requests. After a couple of hours I checked the usage stats and just after 1 day of just me it was hitting 16k of the 50 k allowance. (Albeit dev plan)
Is this normal behavior for a SSR/CSR app?
At this rate it would be best to prerender the site. I love the idea of a SSR app, but the API hits are huge.
Would it be possible to have SSG site from prod, but for previews have a SSR site? I was thinking different env vars to switch the behavior.
Nice to meet you. I worked on the SvelteKit Template blog: I’m happy to help.
Could you tell me something about your dev environment? Did you reach 16k calls by working locally on your machine in dev mode?
I had a similar issue where I was seeing tens of thousands of API calls and discovered that it was the result of AWS’ health checks pinging index.html repeatedly all day long. I fixed the issue by telling AWS to ping the favicon instead. Hope this helps!
It was infact using a cloud IDE called replit, but I will do futher testing on my Mac
Perhaps it was autosaving in the background. I will get back and confirm.
Can you perhaps give more insight into how Houdini caches the requests, I read the docs, but still unclear. Would this be wise to use on a high traffic site?
Hello @cityofsydney ,
ok, I’m glad you found something to investigate about.
Regarding the Houdini cache: it’s still a bit blurry to me how Houdini and SvelteKit cache API requests. A couple of days ago, I pushed a commit that fixes a weird corner case: SvelteKit considers the API endpoint with and without ending slash as different URLs, so before the change, it wasn’t able to hydrate the page without making an API call. This is due to how SvelteKit works, not something depending on Houdini.
Given the current architecture of the demo project and the main goal to demonstrate how to use DatoCMS GraphQL API with SvelteKit, the demo would need a round of improvements to be ready for high traffic. On this side, I opened a branch to try the server-only load approach suggested in Houdini doc (it currently breaks the preview feature of the demo ).
Server-only load approach, together with the usage of static adapter should be enough to make a website ready for prime-time traffic.