Home / Companies / Upstash / Blog / May 2021

May 2021 Summaries

2 posts from Upstash

Filter
Month: Year:
Post Summaries Back to Blog
Next.js, a popular web framework, optimizes web performance by combining server-side rendering (SSR) and static site generation (SSG), which together enhance SEO and data handling, but can suffer in performance if not managed carefully. The blog post discusses improving Next.js API call efficiency using SWR, a data fetching library that employs a stale-while-revalidate strategy, and Redis, a server-side caching tool. SWR quickly delivers cached data while asynchronously updating the UI, and Redis helps manage server load and API usage by caching responses, particularly for high-traffic sites or when consuming APIs with quotas, as demonstrated in a Covid Tracker project. This project uses Javier Aviles’ Covid API to rank countries by Covid cases, leveraging Redis to achieve faster response times and reduce API request overload, with the API data being refreshed every 60 seconds in Redis. The blog also includes code implementation details for both the API and UI, showcasing the practical application of these caching strategies.
May 17, 2021 1,075 words in the original blog post.
Serverless applications, known for their scalability, can face challenges such as financial and technical costs, which necessitate implementing rate limiting mechanisms to manage traffic spikes and control resources effectively. Rate limiting is crucial for protecting resources, managing user quotas, and controlling costs, especially in scenarios involving public APIs where traffic spikes could degrade service quality or cause outages. Three main rate limiting solutions include setting a concurrency level for function executions, applying rate limiting on API Gateways, and using Redis for a comprehensive and customizable approach. Rate limiting at the concurrency level is easy to configure but only limits concurrency, not execution frequency. API Gateway-based rate limiting is also straightforward but limited to API Gateway users and lacks advanced features like quotas per user or IP. Redis offers a powerful and scalable solution with a rich ecosystem of open-source libraries, allowing for customized implementations, although it introduces some overhead. Rate limiting libraries simplify integrating these solutions into application code, demonstrating the practicality of implementing such systems in serverless environments.
May 03, 2021 687 words in the original blog post.