bartervg / barter.vg

Track and hold discussion on Barter.vg bugs, enhancements, and other issues
https://barter.vg
MIT License
20 stars 4 forks source link

Change feeds from dynamic to static files #291

Open bartervg opened 1 year ago

bartervg commented 1 year ago

What problem does this feature address?

There are hundreds of thousands of monthly requests to various JSON and RSS feeds on barter.vg and bartervg.com. Some of these feeds are slow and resource intensive. Yet these feeds change around a dozen times per day, if that. Serving a static file that updates only upon changes should save server resources.

Describe a solution

Rather than use PHP scripts, point the URLs to static files. The static file should update when there is a change, e.g. a new giveaway posted.

Examples of similar features

I have been telling everyone to use bartervg.com in order to take advantage of the CDN. The request would go to a nearby CDN server, rather than the Barter server, and save time and resources. However, the header was set to cache-control: private which negated the benefit of the CDN.

The CDN will not cache files with this header, and will request it from the Barter server. Rather than worry about setting cache-control or etag and hoping the CDN and user properly handle those headers, a static file ensures that database and PHP processing occur only upon updates to the feed content.