[#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. // Package writecache implements write-cache for objects.
// //
// It contains in-memory cache of fixed size and underlying database // Write-cache has 2 components:
// (usually on SSD) for storing small objects. // 1. Key-value (bbolt) database for storing small objects.
// There are 3 places where object can be: // 2. Filesystem tree for storing big objects.
// 1. In-memory cache.
// 2. On-disk cache DB.
// 3. Main storage (blobstor).
// //
// There are 2 types of background jobs: // Flushing from the writecache to the main storage is done in the background.
// 1. Persisting objects from in-memory cache to database. // To make it possible to serve Read requests after the object was flushed,
// 2. Flushing objects from database to blobstor. // we maintain an LRU cache containing addresses of all the objects that
// On flushing object address is put in in-memory LRU cache. // could be safely deleted. The actual deletion is done during eviction from this 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.
package writecache 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. // flushWorker writes objects to the main storage.
// If flushFirst is true, flushing objects from cache database takes priority over
// putting new objects.
func (c *cache) flushWorker(_ int) { func (c *cache) flushWorker(_ int) {
defer c.wg.Done() defer c.wg.Done()