Skip to main content

How to warm your CDN cache using warmer?

Download the binary:

wget https://github.com/codingsasi/warmer/releases/download/0.0.1-rc4/warmer

Usage:

# warmer http(s)://someurl.com/sitemap.xml interval
./warmer https://abh.ai/sitemap.xml 5 # interval of 5 seconds
./warmer https://abh.ai/sitemap.xml 1 # interval of 1 second

Set as a cronjob every day: 

crontab -e

Then add the following to it.

Tags

A CDN cache warmer in Rust

Cache Memory
While using CDN caches like Cloudflare or Akamai and even for http caches like Varnish, it is important to "warm the cache" after deployments when the caches are usually cleared. This means sometimes manually loading up all the important pages for the first time so that it is loaded into cache. What if this could be automated through the sitemap using a simple CDN cache warmer.

Tags

A simple asynchronous reverse proxy in Rust

Getting Started with Rust
In my previous article, I had written a very simple and basic reverse proxy. It is just like Nginx but without all the usefulness. In this new code, I have used tokio.rs. Tokio provides runtimes for asynchronous programming. A runtime bundles services together and makes a single type of (for want of a better word) process, service, runtime, etc. This makes it easier to shut down, started, etc. In the code below, I have used TcpStream and TcpListener from the tokio library and not std. I have also spawned for tokio threads and within that, tokio tasks, which are sort of like green threads, but not quite because Rust does not natively support it.

A simple reverse proxy server in Rust

Why Rust
I wanted the application I write to be able to run well on a raspberry pi zero. And Rust could do all this extremely well. Apart from that, Rust is the safest language ever. And it's not like when Java says that it's secure. Rust means it and has gone above and beyond to make sure you can only write safe and secure code. It does this because it has one of the most advanced and thorough compilers, that WILL NOT compile your code unless it is safe. I choose Rust. Q.E.D.
Subscribe to Rust
x

Work

Therefore logo
80 Atlantic Ave, Toronto, ON Canada
Email: hello@therefore.ca
Call us: +1 4166405376
Linkedin

Let us know how we can help!