RedisĀ® @ Edge with Cloudflare Workers
Blog post from Upstash
Cloudflare Workers, a leading edge computing product, enables developers to build globally distributed and performant applications by running applications closer to users without cold starts. It allows functions to be written in multiple languages while leveraging Cloudflare's global network to minimize latency. However, a challenge arises when connecting databases to serverless environments due to the need for persistent connections. Upstash addresses this with a REST API over Redis, allowing Edge functions to access Upstash efficiently. Compared to Cloudflare Workers KV, Upstash offers more advanced Redis data structures and faster write latencies. This integration is exemplified through a simple web analytics application that tracks user traffic at the Edge, recording requests in Upstash Redis and providing analytics data such as page views, unique visitors, and top countries. The Upstash Edge roadmap includes plans for Edge Caching and global replicated databases to further improve latency and data access consistency across multiple regions.