aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache
Commit message (Collapse)AuthorAgeFilesLines
...
* disk layer gc and error/warnings cleanup (#515)Dan Engelbrecht2023-11-082-36/+85
| | | | | | | - Improvement: Use GC reserve when writing index/manifest for a disk cache bucket when disk is low when available - Improvement: Demote errors to warning for issues that are not critical and we handle gracefully - Improvement: Treat more out of memory errors from windows as Out Of Memory errors Fixed wrong sizeof() statement for compactcas index (luckily the two structs are of same size)
* Don't put cache entries into the memory cache on Put, only on Get (#518)Dan Engelbrecht2023-11-072-21/+24
|
* spdlog implementation hiding (#498)Stefan Boberg2023-11-062-8/+5
| | | | | | | | | this change aims to hide logging internals from client code, in order to make it easier to extend and take more control over the logging process in the future. As a bonus side effect, the generated code is much tighter (net delta around 2.5% on the resulting executable which includes lots of thirdparty code) and should take less time to compile and link. Client usage via macros is pretty much unchanged. The main exposure client code had to spdlog internals before was the use of custom loggers per subsystem, where it would be common to have `spdlog::logger` references to keep a reference to a logger within a class. This is now replaced by `zen::LoggerRef` which currently simply encapsulates an actual `spdlog::logger` instance, but this is intended to be an implementation detail which will change in the future. The way the change works is that we now handle any formatting of log messages in the zencore logging subsystem instead of relying on `spdlog` to manage this. We use the `fmt` library to do the formatting which means the client usage is identical to using `spdlog`. The formatted message is then forwarded onto any sinks etc which are still implememted via `spdlog`.
* gc v2 tests (#512)Dan Engelbrecht2023-11-062-54/+10
| | | | | | | | | | * set MaxBlockCount at init * properly calculate total size * basic blockstore compact blocks test * correct detection of block swap * Use one implementation for CreateRandomBlob * reduce some data sets to increase speed of tests * reduce test time * rename BlockStoreCompactState::AddBlock -> BlockStoreCompactState::IncludeBlock
* statsd for cas (#511)Dan Engelbrecht2023-11-062-2/+2
| | | | * separate statsd interfaces so they can be accessible to zenstore * statsd for cas
* reduce cachebucket mem (#509)Dan Engelbrecht2023-11-062-293/+448
| | | | | | | * reduce memory footprint for disk cache separate dense arrays for rawhash+rawsize and memcache buffer * don't write RawHash/RawSize for buckets with no such metadata * helper functions * make index into metadata and cached payload type safe * helper functions for memcached
* multithread cache bucket (#508)Dan Engelbrecht2023-11-061-21/+66
| | | | * Multithread init and flush of cache bucket * tweaked threading cound for bucket discovery, disklayer flush and gc v2
* individual gc stats (#506)Dan Engelbrecht2023-10-303-160/+214
| | | | | - Feature: New parameter for endpoint `admin/gc` (GET) `details=true` which gives details stats on GC operation when using GC V2 - Feature: New options for zen command `gc-status` - `--details` that enables the detailed output from the last GC operation when using GC V2
* New GC implementation (#459)Dan Engelbrecht2023-10-304-104/+1244
| | | - Feature: New garbage collection implementation, still in evaluation mode. Enabled by `--gc-v2` command line option
* added missing includes (#504)Stefan Boberg2023-10-271-0/+1
| | | | | this change adds some includes to files which "inherit" includes from elsewhere this was exposed on another branch when removing some heavy dependencies from central headers
* fixed missing context for cache record PUT operations (#503)Stefan Boberg2023-10-271-2/+6
|
* fix CacheBucket::CollectGarbage removing standalone entries without an ↵Dan Engelbrecht2023-10-271-4/+7
| | | | exclusive lock (#502)
* statsd metrics reporting (#496)Stefan Boberg2023-10-252-11/+38
| | | | | added support for reporting metrics via statsd style UDP messaging, which is supported by many monitoring solution providers this change adds reporting only of three cache related metrics (hit/miss/put) but this should be extended to include more metrics after additional evaluation
* merge disk and memory layers (#493)Dan Engelbrecht2023-10-247-1121/+785
| | | | - Feature: Added `--cache-memlayer-sizethreshold` option to zenserver to control at which size cache entries get cached in memory - Changed: Merged cache memory layer with cache disk layer to reduce memory and cpu overhead
* Remove any unreferenced blocks in block store on open (#492)Dan Engelbrecht2023-10-232-9/+4
| | | * Remove any unreferenced blocks in block store on open
* Filter expired cache entries against ExpiredKeys - not CAS entries to retain ↵Dan Engelbrecht2023-10-231-40/+23
| | | | (#491)
* Don't prune block locations due to missing blocks a startup (#487)Dan Engelbrecht2023-10-202-57/+11
| | | | | | * Don't prune block locations due to missing blocks a startup This makes the behaviour consistent with FileCas - you can have an index that is not fully backed by data. Asking for a location that is not backed by data results in getting an empty result back Also, don't try to GC blocks that are unknown to the block store at the time of snapshot (to avoid removing data that comes in after GatherReferences in GC)
* Cache (rpc) activitity recording improvements (#482)Stefan Boberg2023-10-201-6/+19
| | | | | | | this adds a new RPC recording path aimed at more continuous recording and analysis of recorded sessions the new strategy is implemented alongside the original in order to retain the ability to read the older format the main difference between v2 and v1 is that the new strategy splits the recording into segments which are independent from each other. This is done to enable long running sessions with automatic disk cleanup (not implemented yet), appending to an existing recording (not implemented) and/or partial analysis and processing. The recorder will start a new segment when some criteria is fulfilled, including the number of files in the segment directory, disk footprint etc
* clean up GcContributor and GcStorage to be pure interfaces (#485)Dan Engelbrecht2023-10-202-2/+7
|
* Add --skip-delete option to gc command (#484)Dan Engelbrecht2023-10-201-1/+1
| | | | - Feature: Add `--skip-delete` option to gc command - Bugfix: Fix implementation when claiming GC reserve during GC
* add `flush` command and more gc status info (#483)Dan Engelbrecht2023-10-182-5/+8
| | | | | | - Feature: New endpoint `/admin/flush ` to flush all storage - CAS, Cache and ProjectStore - Feature: New command `zen flush` to flush all storage - CAS, Cache and ProjectStore - Improved: Command `zen gc-status` now gives details about storage, when last GC occured, how long until next GC etc - Changed: Cache access and write log are disabled by default
* removed unnecessary vector in ZenCacheMemoryLayer::DropStefan Boberg2023-10-171-3/+2
|
* fix mem layer total count (#480)Dan Engelbrecht2023-10-172-6/+17
| | | * fix calculation of ZenCacheMemoryLayer::m_TotalSize
* minor - fix references size arrayDan Engelbrecht2023-10-171-0/+2
|
* don't call compact references if caching is not enabled (#478)Dan Engelbrecht2023-10-171-6/+12
|
* cache reference tracking (#455)Dan Engelbrecht2023-10-105-182/+577
| | | | | - Feature: Add caching of referenced CId content for structured cache records, this avoid disk thrashing when gathering references for GC - disabled by default, enable with `--cache-reference-cache-enabled` - Improvement: Faster collection of referenced CId content in project store
* reject bad bucket reads (#456)Stefan Boberg2023-10-093-5/+16
| | | | * extended bad bucket rejection logic to include GET operations as well as PUTs
* fix memory usage in memlayer (#454)Dan Engelbrecht2023-10-062-15/+4
| | | * Bugfix: Remove double counting of memory usage in memcachelayer
* reject known bad bucket names in structured cache (#452)v0.2.27-pre0Stefan Boberg2023-10-065-8/+69
| | | | | | | * added string_view helpers for ParseHexBytes/ParseHexNumber * reject known bad buckets in structured cache put handler (32-character hex bucket names are rejected) * also added bucket rejection logic to bucket discovery * added rejected_writes stat to HttpStructuredCache
* ZenCacheMemoryLayer should always store values using memory buffers (#451)Stefan Boberg2023-10-051-3/+4
| | | | | | | | this change fixes a problem where the memory cache layer can inadvertently prevent underlying block store files from being deleted * ensure we get memory buffers on all paths * added more context to error in IoBufferBuilder::ReadFromFileMaybe * fixed problematic pread call success check in IoBufferBuilder::ReadFromFileMaybe which would always report failure on Linux/MacOS
* Fix curruption of disk cache bucket index on GC (#448)Dan Engelbrecht2023-10-052-45/+54
| | | | | | | | | * make sure we hold the index lock when reading payload data in reclaim space * don't use index snapshot when updating index in reclaim space * check that things have not moved under our feet * don't touch m_Payloads without a lock * start write block index on the highest block index * we don't need to bump writeblockindex when stopping write to a block, we will bump appropriately when we start a new block * changelog
* reduce lock in disklayer (#447)Dan Engelbrecht2023-10-051-10/+22
| | | * Don't block all write access to all buckets when doing GatherReferences/CollectGarbage
* fix HandleRpcRequest::WriteResponseAsync trace scope when we are not running ↵Dan Engelbrecht2023-10-041-1/+2
| | | | async
* refactor comapactcas index (#443)Dan Engelbrecht2023-10-041-3/+10
| | | | | - Bugfix: Fix scrub messing up payload and access time in disk cache bucket when compacting index - Improvement: Split up disk cache bucket index into hash lookup and payload array to improve performance - Improvement: Reserve space up front for compact binary output when saving cache bucket manifest to improve performance
* faster accesstime save restore (#439)Dan Engelbrecht2023-10-033-132/+252
| | | | | | | | | | - Improvement: Reduce time a cache bucket is locked for write when flushing/garbage collecting - Change format for faster read/write and reduced size on disk - Don't lock index while writing manifest to disk - Skip garbage collect if we are currently in a Flush operation - BlockStore::Flush no longer terminates currently writing block - Garbage collect references to currently writing block but keep the block as new data may be added - Fix BlockStore::Prune used disk space calculation - Don't materialize data in filecas when we just need the size
* Handle OOM and OOD more gracefully to not spam Sentry with error reports (#434)Dan Engelbrecht2023-10-021-10/+25
| | | | | | - Improvement: Catch Out Of Memory and Out Of Disk exceptions and report back to reqeuster without reporting an error to Sentry - Improvement: If creating bucket fails when storing and item in the structured cache, log a warning and propagate error to requester without reporting an error to Sentry - Improvement: Make an explicit flush of the active block written to in blockstore flush - Improvement: Make sure cache and cas MakeIndexSnapshot does not throw exception on failure which would cause and abnormal termniation at exit
* Limit size of memory cache layer (#423)Dan Engelbrecht2023-10-024-46/+285
| | | | | | | | - Feature: Limit the size ZenCacheMemoryLayer may use - `--cache-memlayer-targetfootprint` option to set which size (in bytes) it should be limited to, zero to have it unbounded - `--cache-memlayer-maxage` option to set how long (in seconds) cache items should be kept in the memory cache Do more "standard" GC rather than clearing everything. Tries to purge memory on Get/Put on the fly if exceeding limit - not sure if we should have a polling thread instead of adding overhead to Get/Put (however light it may be).
* lightweight gc (#431)Dan Engelbrecht2023-10-021-0/+5
| | | | | | - Feature: Add lightweight GC that only removes items from cache/project store without cleaning up data referenced in Cid store - Add `skipcid` parameter to http endpoint `admin/gc`, defaults to "false" - Add `--skipcid` option to `zen gc` command, defaults to false - Add `--gc-lightweight-interval-seconds` option to zenserver
* Correctly calculate the total number of RPC ops in the stats page for ↵Dan Engelbrecht2023-09-291-2/+2
| | | | | structured cache (#433) Change "chunks" title to "count" for RPC chunk requests in stats page for structured cache
* move badrequest count back to old scope for compatability with Zen DashboardDan Engelbrecht2023-09-281-2/+1
|
* adding more stats (#429)Dan Engelbrecht2023-09-288-44/+351
| | | | | - Feature: Add detailed stats on requests and data sizes on a per-bucket level, use parameter `cachestorestats=true` on the `/stats/z$` endpoint to enable - Feature: Add detailed stats on requests and data sizes on cidstore, use parameter `cidstorestats=true` on the `/stats/z$` endpoint to enable - Feature: Dashboard now accepts parameters in the URL which is passed on to the `/stats/z$` endpoint
* prefer to handle cache RPC requests synchronously (#428)Stefan Boberg2023-09-271-4/+17
| | | | | * only handle RPC requests in a worker thread if we have an upstream. we may as well handle the request inline on the http_io thread if we're only dealing with local data since the response times should be pretty consistent in that case * http.sys: don't create async worker thread pool until it's needed (typically only if we have an upstream)
* Add runtime status/control of logging (#419)Dan Engelbrecht2023-09-223-16/+44
| | | | | | | | | | | - Feature: New endpoint `/admin/logs` to query status of logging and log file locations and cache logging - `enablewritelog`=`true`/`false` parameter to control cache write logging - `enableaccesslog`=`true`/`false` parameter to control cache access logging - `loglevel` = `trace`/`debug`/`info`/`warning`/`error` - Feature: New zen command `logs` to query/control zen logging - No arguments gives status of logging and paths to log files - `--cache-write-log` `enable`/`disable` to control cache write logging - `--cache-access-log` `enable`/`disable` to control cache access logging - `--loglevel` `trace`/`debug`/`info`/`warning`/`error` to set debug level
* VFS implementation for local storage service (#396)Stefan Boberg2023-09-204-3/+57
| | | currently, only Windows (using Projected File System) is supported
* add DiskWriteBlocker to structured cache store log writer (#408)Dan Engelbrecht2023-09-152-31/+43
| | | | | * add DiskWriteBlocker to structured cache store log writer * changelog
* add more trace scopes (#362)Dan Engelbrecht2023-09-154-130/+212
| | | | | * more trace scopes * Make sure ReplayLogEntries uses the correct size for oplog buffer * changelog
* More statistics for Cache, Project Store and Cid Store (#405)Dan Engelbrecht2023-09-142-5/+56
| | | | | Cache: requestcount, badrequestcount, writes Project Store: requestcount Cid Store: cidhits, cidmisses, cidwrites
* issue warning instead of assert on bad data in cid store (#400)Dan Engelbrecht2023-09-131-10/+14
| | | * issue warning instead of assert on bad data in cid store
* ZenCacheStore is now reference counted (#398)Stefan Boberg2023-09-132-2/+13
| | | this change also adds a GetNamespaces function which may be used to enumerate all currently known cache namespaces
* gracefully handle errors when writing cache log (#391)Dan Engelbrecht2023-09-111-29/+50
| | | | | | | * gracefully handle errors when writing cache log * changelog * fix log message