How to stop the virtual server from caching my out-going http requests?

August 27, 2014 1.1k views

I have a 512MB droplet that works great, and am quite happy with DigitalOcean.

Recently, I noticed that the droplet will cache my out-going http requesets. For example, I used wget http://some.dynamic.website.com to fetch its index.html. I got exactly the same file every time (even the linux file meta data was the same), even though the content of the page had actually changed which was verified by visiting it directly from my local web browser. I tried curl instead, I got a new file, but still filled with old content.

Apparently, the droplet had cached the out-going http requests (as well as generated files by a particular program?). This will cut down physical network traffic significantly, thus benifit DigitalOcean, and in most cases, the user as well. However, if I know the target webpage updates frequently and mean to get the latest content, I should be able the do so.

As a reference, I created a new droplet, which turned out behaving differently: it gave me the latest content very time. While for my a month old working droplet, the content updated once or twice per day. It seems that DigitalOcean relies on some internal statistics to determine whether and how much its caching machinary is used.

So my questions are:

  1. Is this feature or limitation unavoidable? Is there any work-around?
  2. Is this related to my enabling VirtI/O?
  3. What's the internal criteria that controls this cache mechanism (if it is not a secret:)?
  • What webserver or web app are you running? DigitalOcean doesn't supply any kind of built in caching. Droplets are simply a Linux VPS, pretty bare bones. It's really up to what you've installed. If it weren't for the fact you mentioned curl, I'd suspect your browser's local cache.

  • I created my droplet with a LAMP image, but I think it is totally irrelevant, because I got this behavior when I executed wget or curl in the shell (not in a browser or web application), and what got cached was something located outside (not what I served in my droplet with Apache).

    The appearance of the phenomenon seemed to be coincident with my adding 1 GB swap to the system a few days ago. But I don't see any real relationship between these two.

  • The problem continues...
    I've created a new user in my droplet. If you're an administrator, could you contact me over my email? I'll send you the account information so that you can log in and check the problem yourself.

    Thank you for help!

1 Answer

Are you sure that you don't cache content via Apache, Varnish or something like that? As far as i know they don't cache any content, and that's what I (and probably everyone else) expect from DO and every other VPS provider.

Have another answer? Share your knowledge.