{"id":19914806,"url":"https://github.com/physer/distributedcacheplayground","last_synced_at":"2025-10-12T04:39:54.120Z","repository":{"id":55605497,"uuid":"320798563","full_name":"Physer/DistributedCachePlayground","owner":"Physer","description":"The Distributed Cache Playground is benchmarking tool to see the effect of different caching mechanism and different locking strategies with concurrent requests.","archived":false,"fork":false,"pushed_at":"2022-09-20T13:55:28.000Z","size":83,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-12T04:39:52.371Z","etag":null,"topics":["benchmark","cache","caching","csharp","locking","redis-cache","threading"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Physer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-12T09:57:13.000Z","updated_at":"2022-09-20T13:53:33.000Z","dependencies_parsed_at":"2023-01-18T16:15:31.311Z","dependency_job_id":null,"html_url":"https://github.com/Physer/DistributedCachePlayground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Physer/DistributedCachePlayground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Physer%2FDistributedCachePlayground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Physer%2FDistributedCachePlayground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Physer%2FDistributedCachePlayground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Physer%2FDistributedCachePlayground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Physer","download_url":"https://codeload.github.com/Physer/DistributedCachePlayground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Physer%2FDistributedCachePlayground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010272,"owners_count":26084720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","cache","caching","csharp","locking","redis-cache","threading"],"created_at":"2024-11-12T21:37:11.013Z","updated_at":"2025-10-12T04:39:54.102Z","avatar_url":"https://github.com/Physer.png","language":"C#","readme":"\n# Distributed Cache Playground\n\n## Introduction\nThe Distributed Cache Playground showcases different implementations and their performance for retrieving data concurrently through a caching implementation.\n\n## Application details\n\n### Project information\nThe project is a console application built using .NET 6.0 in C#.\nThere are two console applications present in the solution:\n\n - DCP.Application\n - DCP.Bootstrapper\n\nIn order to simulate the event of multiple instances hitting multiple threads at the same time, a bootstrapper application is able to kickstart multiple console applications.\n\n### Dependency information\nOne of the caches used in this application is Redis. In order to run the application, a working instance of Redis is required. The application defaults to localhost. If you are running Redis at a different endpoint, adjust the code where necessary.\n\n**Used libraries and frameworks:**\n - Microsoft's StackExchange extensions\n - Microsoft's Dependency Injection\n - Microsoft's Hosting extensions\n - Microsoft's HTTP extensions for leveraging the .NET HTTP Client\n - Newtonsoft's JSON framework\n\n**External services:**\n - The application leverages [JSONPlaceholder](https://jsonplaceholder.typicode.com/) as a JSON data source\n - Redis\n\n### References\n - [Microsoft's documentation about Semaphore locking](https://docs.microsoft.com/en-us/dotnet/standard/threading/semaphore-and-semaphoreslim)\n - [Redis.io](https://redis.io/)\n - [Redlock.net by Sam Cook](https://github.com/samcook/RedLock.net)\n - [JSONPlaceholder](https://jsonplaceholder.typicode.com/)\n\n## How to run the application\n\n 1. Clone or download the source code\n 2. Make sure Redis is running\n 3. Restore the dependencies and build the solution\n 4. Run the **DCP.Bootstrapper** application\n\n## Benchmarking\nA benchmark is done by retrieving 500 comments from a cache implementation. If there is no cached data, a request is done to a live JSON data source.\n\nWhen starting the DCP.Bootstrapper application, it presents you with options to configure your current run.\nThe following options are available:\n - In-memory caching using a Semaphore Slim lock\n - Redis without any locking\n - Redis using a Semaphore Slim lock\n - Redis using Redlock as distributed locking through Redis itself\n\nAfter choosing the desired option, you can select the number of instances to run. Enter the amount of desired instances here. Note that more instances consume more resources.\n\nEvery instance will open a new console window running the selected option.\nOne instance fires off 200 threads in parallel and every thread does the following:\n\n 1. Try to retrieve the cached comments from a cache\n 2. If the comments are not present in the cache, retrieve them from the origin.\n 3. Place the retrieved comments (500 items) in the specified cache\n\nDepending on your chosen option, locking might be applied over multiple threads.\n\n## Results\nEvery instance will show the amount of threads going to origin, going to cache and the total time elapsed in milliseconds in the console window.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphyser%2Fdistributedcacheplayground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphyser%2Fdistributedcacheplayground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphyser%2Fdistributedcacheplayground/lists"}