From 9e41e852957179c03e8c576f53ffd2d48ef52841 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 1 Sep 2022 09:14:47 +0300 Subject: [PATCH] [#1745] writecache: Actualize docs Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/writecache/doc.go | 23 ++++++-------------- pkg/local_object_storage/writecache/flush.go | 4 +--- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/pkg/local_object_storage/writecache/doc.go b/pkg/local_object_storage/writecache/doc.go index 555c7f1a..f2e90403 100644 --- a/pkg/local_object_storage/writecache/doc.go +++ b/pkg/local_object_storage/writecache/doc.go @@ -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 diff --git a/pkg/local_object_storage/writecache/flush.go b/pkg/local_object_storage/writecache/flush.go index cb368946..0838a4ea 100644 --- a/pkg/local_object_storage/writecache/flush.go +++ b/pkg/local_object_storage/writecache/flush.go @@ -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()