![]() But since the cache is only a subset, it means that sometimes data won't be found in cache ( cache miss). What would be the optimal performance of a cache design? Every time that data needs to be accessed, it can be found in the cache ( cache hit). Data stored in cache can be the result of computation like the database example talked about above. With all this in mind, let's define cache, for the purposes of this post, as:Ī secondary storage with limited capacity that contains a copy of a subset of the data that is stored in main storage.īy copy here, I don't mean exactly copy. Most of the data is not accessed, so keeping in cache a subset of data that is frequently accessed is what allows faster look-ups. That's because the whole purpose of caching is to optimize for data access. More importantly, by design, a cache is supposed to have small sizes. Maintaining a copy of the entire primary storage may be too costly, so we have to content ourselves with a cache of limited capacity. ![]() One of the main drivers of why the cache contains only a subset of the primary storage is cost. Cache as a copy of a subset of the primary storage It can be for geographical reasons, as in the case of Content Delivery Networks. ![]() For example, the primary storage can be a relational database, and you add a cache to avoid the overhead of connecting to the database, parsing the SQL query, accessing the disk, and transforming the results to the format that suits the client application. For example, the data in the cache is in memory and the primary storage uses a disk. The performance gain of accessing this different storage may arise for multiples reasons. Instead of accessing the data through the primary storage, the system accesses through the cache and the access through the cache is supposed to be more performative. In order to achieve the performance gain, part of the data is replicated to a secondary storage. ![]() And, in the context of caching, perform better means accessing the data that is needed faster. ![]() It is just that by applying this technique the system performs better. Independently of the context of where caching is being applied, the pure reason for its existence is to a system have better performance than it would without the cache. In this post, we take an abstract look of what cache is, the replacement problem that arises from cache's own nature and some algorithms for implementing cache replacement policies. ), and also inside the applications we build. It is found in hardware ( CPU and GPU), operating system's virtual memory, buffer pool managers inside databases, in the Web ( Content Delivery Networks, browsers, DNS servers. In computing, caching is all over the place. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |