3 ms·
Can anybody explain about the buffer pools part?
by hobolord 9y ago
Can anybody explain about the buffer pools part?
- jldugger 9y agoCaching can happen in a number of places, with a variety of degrees of success. In psql, a lot of caching is deferred to the OS filesystem layer. In MySQL, apparently, they have a additional cache in the MySQL address space. There's two sides to this. Generally speaking, an general purpose OS will use cache management algorithms that suck compared to what an application could do, because the application has more structured knowledge. In the case of a DB, it knows about indexes, and row sizes, and is less likely to evict half an index or row. On the other hand, the OS is sort of the last authority. Varnish, in particular, argues that programmers should rely on the OS caching algorithms, because you have them whether or not you want them. A poor interaction between userspace and kernelspace caches can end up increasing I/O activity if kernel pages something to disk before the userspace does (varnish had a doc somewhere explaining this better, which I can no longer find). The penalty here though is context switching. A userspace cache is available in memory, whereas a filesystem / buffer cache will incur a context switch to retrieve the data from kernelspace to userspace. Finally, both have a number of caches, so this is more about how much and what type of userspace caching.