Affinity-based cache operation for a persistent storage device
Aspects described herein relate to a method comprising: receiving a request to write data to a persistent storage device, the request comprising data; determining an affinity of the data; writing the request to a cache line of a cache; associating the cache line with the affinity of the data; and reporting the data as having been written to the persistent storage device.
1. A method comprising:
receiving a request to write first data to a persistent storage device, the request comprising the first data and a process identifier;
determining an affinity of the first data, wherein the affinity of the first data is at least a function of the process identifier;
writing the request to a cache line of a cache;
associating the cache line with the affinity of the first data; and
reporting the first data as having been written to the persistent storage device.
2. The method of claim 1 , further comprising:
determining that second data is to be evicted from the cache;
generating a stream based on one or more buckets; and
writing the stream to the persistent storage device.
3. The method of claim 2 , wherein generating the stream based on the one or more buckets comprises determining the one or more buckets based on a least recently used (LRU) policy.
4. The method of claim 2 , wherein generating the stream based on the one or more buckets comprises selecting the one or more buckets randomly from a predetermined proportion of the one or more buckets.
5. The method of claim 2 , wherein determining that the second data is to be evicted from the cache comprises determining that the cache is below a threshold clean capacity.
6. The method of claim 2 , wherein determining that the second data is to be evicted from the cache comprises determining that a predetermined proportion of the one or more buckets are full above a threshold.
7. The method of claim 1 , further comprising after writing the first data to the cache line of the cache, marking the cache line as dirty.
8. A method comprising:
receiving a request to write first data to a persistent storage device, the request comprising the first data and a central processing unit (CPU) identifier;
determining an affinity of the first data, wherein the affinity of the first data is at least a function of the CPU identifier;
writing the request to a cache line of a cache;
associating the cache line with the affinity of the first data; and
reporting the first data as having been written to the persistent storage device.
9. The method of claim 8 , further comprising:
determining that second data is to be evicted from the cache;
generating a stream based on one or more buckets; and
writing the stream to the persistent storage device.
10. The method of claim 9 , wherein generating the stream based on the one or more buckets comprises determining the one or more buckets based on a least recently used (LRU) policy.
11. The method of claim 9 , wherein generating the stream based on the one or more buckets comprises selecting the one or more buckets randomly from a predetermined proportion of the one or more buckets.
12. The method of claim 9 , wherein determining that the second data is to be evicted from the cache comprises determining that the cache is below a threshold clean capacity.
13. The method of claim 9 , wherein determining that the second data is to be evicted from the cache comprises determining that a predetermined proportion of the one or more buckets are full above a threshold.
14. The method of claim 8 , further comprising after writing the first data to the cache line of the cache, marking the cache line as dirty.
15. A method comprising:
receiving a request to write first data to a persistent storage device, the request comprising the first data and a central processing unit (CPU) core identifier;
determining an affinity of the first data, wherein the affinity of the first data is at least a function of the CPU core identifier;
writing the request to a cache line of a cache;
associating the cache line with the affinity of the first data; and
reporting the first data as having been written to the persistent storage device.
16. The method of claim 15 , further comprising:
determining that second data is to be evicted from the cache;
generating a stream based on one or more buckets; and
writing the stream to the persistent storage device.
17. The method of claim 16 , wherein generating the stream based on the one or more buckets comprises determining the one or more buckets based on a least recently used (LRU) policy.
18. The method of claim 16 , wherein generating the stream based on the one or more buckets comprises selecting the one or more buckets randomly from a predetermined proportion of the one or more buckets.
19. The method of claim 16 , wherein determining that the second data is to be evicted from the cache comprises determining that the cache is below a threshold clean capacity.
20. The method of claim 15 , wherein determining that the second data is to be evicted from the cache comprises determining that a predetermined proportion of the one or more buckets are full above a threshold.