Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between precaching and prefetching?

It seems they are two names for the same idea– is there any difference?

like image 580
Jason Prado Avatar asked Oct 25 '22 15:10

Jason Prado


1 Answers

Disclaimer: I do not know of any literature specifically making (or not making) distinctions between precaching and prefetching.

Caching is a harder problem than fetching. Caching involves invalidation (knowing when a cache entry is no longer valid), may involve other aspects such as distributed caches, and may or may not be transparent to the application.

Fetching is related to getting something you will need. Thus, IMHO prefetching (the word) should be used when

  1. you will likely need the data in the immediate future
  2. the data will probably be acessed once
  3. you can discard the data after using it

Think of an instruction prefetch for a branch prediction algorithm on a microprocessor, for example.

Caching is related to having a copy of the actual data on a faster medium, say an L2 cache or a memcached server. Thus, precaching is different than prefetching because of the usage: caching typically involves many reads, and some invalidation mecanism, thus a precaching mechanism would be used to populate some cache with frequently acessed items, for example.

like image 172
Miguel Ping Avatar answered Oct 27 '22 11:10

Miguel Ping