[#1745] writecache: Actualize docs

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-01 09:14:47 +03:00 committed by fyrchik
parent e9c6ee2623
commit 9e41e85295
2 changed files with 8 additions and 19 deletions

View file

@ -1,20 +1,11 @@
// Package writecache implements write-cache for objects.
//
// It contains in-memory cache of fixed size and underlying database
// (usually on SSD) for storing small objects.
// There are 3 places where object can be:
// 1. In-memory cache.
// 2. On-disk cache DB.
// 3. Main storage (blobstor).
// Write-cache has 2 components:
// 1. Key-value (bbolt) database for storing small objects.
// 2. Filesystem tree for storing big objects.
//
// There are 2 types of background jobs:
// 1. Persisting objects from in-memory cache to database.
// 2. Flushing objects from database to blobstor.
// On flushing object address is put in in-memory LRU cache.
// The actual deletion from the DB is done when object
// is evicted from this cache.
//
// Putting objects to the main storage is done by multiple workers.
// Some of them prioritize flushing items, others prioritize putting new objects.
// The current ration is 50/50. This helps to make some progress even under load.
// Flushing from the writecache to the main storage is done in the background.
// To make it possible to serve Read requests after the object was flushed,
// we maintain an LRU cache containing addresses of all the objects that
// could be safely deleted. The actual deletion is done during eviction from this cache.
package writecache

View file

@ -185,9 +185,7 @@ func (c *cache) flushBigObjects() {
}
}
// flushWorker runs in a separate goroutine and write objects to the main storage.
// If flushFirst is true, flushing objects from cache database takes priority over
// putting new objects.
// flushWorker writes objects to the main storage.
func (c *cache) flushWorker(_ int) {
defer c.wg.Done()