fastly-rails icon indicating copy to clipboard operation
fastly-rails copied to clipboard

Idea: Add an option to send purges in batches.

Open harlow opened this issue 10 years ago • 5 comments

Does Fastly support a batch purge? We've been putting purge requests into the background and leveraging sidekiq unique jobs to try to reduce outgoing HTTP traffic.

harlow avatar Dec 21 '14 19:12 harlow

We don't really have anything like a batch purge aside from surrogate key purge and purge_all. The unique job queue is definitely a cool idea. Depending on frequency of purge, I wonder if leveraging persistent HTTP connections would help as well?

ezkl avatar Dec 22 '14 08:12 ezkl

We could queue up surrogate keys to be purged in a defined time interval, or up to a certain number of keys, and send one request out. We could additionally squash them to be unique, in case the same key shows up multiple times.

Although we do allow n surrogate keys to be passed in with any given surrogate key purge request, the nature of apps will probably only purge one or two at a time.

Thoughts?

set5think avatar Dec 22 '14 16:12 set5think

We discussed some more internally - it seems the consensus is that this idea would be better served as an extension to fastly-rails. I guess the next prerequisite step to that, though, is to make fastly-rails extendable.

set5think avatar Dec 22 '14 16:12 set5think

Yeah seems like a place fastly-rails could be great. Maybe we could pass the queue strategy into the initializer (Sidekiq, Resque, other)?

harlow avatar Dec 22 '14 17:12 harlow

Maybe we could pass the queue strategy into the initializer (Sidekiq, Resque, other)?

:+1:

ezkl avatar Dec 22 '14 17:12 ezkl