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

ISR과 페이지 캐시 #28

Open
twinstae opened this issue Nov 3, 2024 · 4 comments
Open

ISR과 페이지 캐시 #28

twinstae opened this issue Nov 3, 2024 · 4 comments

Comments

@twinstae
Copy link
Owner

twinstae commented Nov 3, 2024

https://docs.astro.build/en/guides/integrations-guide/vercel/#isr

지금은 페이지를 매번 서버에서 렌더하지만. 저희 앱의 특성상 자주 데이터가 변하지 않으니, 렌더한 페이지을 캐싱하고, 데이터가 변경될 때에만 다시 렌더하도록 만들면 유리하고 이를 ISR이라 합니다.

어떻게 ISR 처리를 구현할지는 좀 고민해보겠습니다.

@twinstae
Copy link
Owner Author

twinstae commented Nov 7, 2024

세상 일은 모르는 것이니 네틀리파이 가이드도

https://developers.netlify.com/guides/how-to-do-advanced-caching-and-isr-with-astro/

@twinstae
Copy link
Owner Author

twinstae commented Nov 7, 2024

Cloudflare 도 cdn cache purge 하는 정도만으로도 충분하다고 하네요.

^^ 사실 SSR하고 cache 를 on demand 로 purge 할 수 있으면 그게 ISR 아닌가 싶긴 합니다.

@twinstae
Copy link
Owner Author

https://github.com/twinstae/coaching-sospeso/blob/main/src/pages/lifelifter/coaches.astro

prerender 옵션을 켠 페이지가 처음 생겼습니다. 이런 정적인 컨텐츠를 담은 페이지들이 많습니다. 사용된 소스페소도 사실 그렇고요.

데이터가 변경될 때 (소스페소 발행, 신청이나 사용 등) 마다 명시적 캐시 날리는 요청을 보내주기만 하면... 손쉽게 읽기 성능을 매우 끌어올릴 수 있지 않을까 싶습니다.

https://vercel.com/docs/build-output-api/v3/features#on-demand-incremental-static-regeneration-isr

물론 인증이 필요한 페이지 처리는 해야 하니. 이런 로직을 미들웨어로 밀어내야 합니다.
#79

한편으로 로그인한 사용자의 이름 같은 건 여전히 서버가 필요한데요. 이렇게 사용자마다 달라지는 부분만 서버 아일랜드나 persistent island를 쓰면 되지 않을까 싶네요. (SSR vs CSR)

@twinstae
Copy link
Owner Author

twinstae commented Dec 2, 2024

ISR 말고 그냥 클라우드 플레어 캐시를 쓰는 것도 방법이 아닐까 싶은데... 동적으로 캐시 날리는 법을 찾아봐야겠습니다.

https://developers.cloudflare.com/cache/concepts/cdn-cache-control/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant