{"id":16515553,"url":"https://github.com/linnykoleh/cachesinvestigation","last_synced_at":"2025-09-17T15:56:42.647Z","repository":{"id":96348632,"uuid":"92742542","full_name":"linnykoleh/CachesInvestigation","owner":"linnykoleh","description":"Caches investigation","archived":false,"fork":false,"pushed_at":"2018-03-02T10:34:27.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T17:11:19.598Z","etag":null,"topics":["cache","cqengine","ehcache","guava-cache"],"latest_commit_sha":null,"homepage":"","language":"Java","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/linnykoleh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-29T13:27:27.000Z","updated_at":"2018-09-05T11:35:27.000Z","dependencies_parsed_at":"2023-03-21T21:17:21.924Z","dependency_job_id":null,"html_url":"https://github.com/linnykoleh/CachesInvestigation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linnykoleh/CachesInvestigation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linnykoleh%2FCachesInvestigation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linnykoleh%2FCachesInvestigation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linnykoleh%2FCachesInvestigation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linnykoleh%2FCachesInvestigation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linnykoleh","download_url":"https://codeload.github.com/linnykoleh/CachesInvestigation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linnykoleh%2FCachesInvestigation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265178744,"owners_count":23723321,"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","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":["cache","cqengine","ehcache","guava-cache"],"created_at":"2024-10-11T16:17:32.024Z","updated_at":"2025-09-17T15:56:37.615Z","avatar_url":"https://github.com/linnykoleh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n### Guava cache vs EhCache\n\n---\n\n*_Linux_*\n\n*_Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz(8 CPUs)_*\n\n*_32 Gb RAM_*\n\n\n#### 1. Time execution\n\n| Operation     |    EhCache    |   Guava cache  |                                            \n| ------------- |:-------------:| --------------:| \n| put 100       |   194.16 μs   |   352.42 μs    |\n| put 10_000    |   4.505 ms    |   2.469 ms     |\n| put 1_000_000 |   579.31 ms   |   352.65 ms    |\n|\t\t\t\t|\t\t\t\t|\t\t\t\t |\n| get 100\t\t|\t99.85 μs\t|\t264.43 μs    |\n| get 10_000    |   4.07 ms     |   2.89 ms      |\n| get 1_000_000 |   408.88 ms   |   296.34 ms    |\n\n\n`Guava cache loses only when small number of elements\nbut when number of elements more then\ntime execution of Guava cache implementation is better almost half.`\n\n\u003e **How I tested**\n\u003e I run every test 20 times and get last 10 values. First 10 values I skipped because I think\n\u003e this is not correct values because computer is dispersing\n\n**Test example**\n```java\n\t\n        @Test\n        public void testGuavaCachePut1_000_000(){\n            measure(MEASURE_TIMES, () -\u003e {\n                final int size = 1_000_000;\n                final GuavaCache guavaCache = new GuavaCache(size);\n\n                final Stream\u003cDomainObject\u003e domainObjects = generatePayload(size);\n                calculateTimeExecuting(domainObjects, guavaCache::push);\n\n                Assert.assertTrue(\"Error GuavaCache size different:\", guavaCache.size() == size);\n                guavaCache.cleanUp();\n            });\n       }\n\t\n```\n\n```java\n\n         public void measure(int times, Runnable testSuite){\n             for(int i = 0; i \u003c times; i++){\n                 testSuite.run();\n             }\n         }\n\t\n```\n\n#### 2. Thread safe\n\nBoth are `thread-safe` caches\n\n#### 3. Docs\n\n`Guava cache` - https://github.com/google/guava/wiki/CachesExplained\n\n`EhCache` -     http://www.ehcache.org/documentation/\n\n`Documentation for EhCache obviously better than in Guava cache.\nGoogle provide us only wiki on github with examples\nbut EhCache provides us full documentation with explanation and a lot of examples`\n\n#### 4. Community\n\nhttps://github.com/google/guava\n\n![alt text](images/guava_github.png)\n\nhttps://github.com/ehcache/ehcache3\n\n![alt text](images/ehcache_github.png)\n\n`Both guava cache and ehcache are now being developed\nit can be seen by stars and numbers who watched projects\nof course guava has better statistic because there are a lot of direction except the cache`\n\n#### 5. Features\n\n| Feature                |    EhCache    |   Guava cache  | \n| -----------------------|:-------------:| --------------:|\n| Generics               |      no       |      yes       |\n| Transformation asMap   |      no       |      yes       |\n| Cache Manager          |      yes      |      no        |\n| CacheLoader            |      yes      |      yes       |\n| Extensions             |      yes      |      yes       |\n| Eviction by Size       |      yes      |      yes       |\n| Eviction by Time       |      yes      |      yes       | \n| Statistics             |      yes      |      yes       |\n\n\n\n[***All tests are here***](src/test/java/com/investigation/caches/)\n\n---\n\n#### Benchmark result\n\n##### Result \"com.investigation.guava.benchmark.GuavaCacheBenchmark.push\":`\n - 290.596 ±(99.9%) 128.686 ns/op [Average]\n - (min, avg, max) = (157.674, 290.596, 388.434), stdev = 85.118\n - CI (99.9%): [161.911, 419.282] (assumes normal distribution)\n\n##### Result \"com.investigation.guava.benchmark.GuavaCacheBenchmark.getPut\":\n - 388.225 ±(99.9%) 334.280 ns/op [Average]\n - (min, avg, max) = (188.616, 388.225, 790.026), stdev = 221.106\n - CI (99.9%): [53.945, 722.505] (assumes normal distribution)\n\n##### Result \"com.investigation.guava.benchmark.GuavaCacheBenchmark.get\":\n - 101.170 ±(99.9%) 312.169 ns/op [Average]\n - (min, avg, max) = (17.823, 101.170, 684.813), stdev = 206.480\n - CI (99.9%): [≈ 0, 413.339] (assumes normal distribution)\n\n\n##### Result \"com.investigation.ehcache.benchmark.EhCacheBenchmark.push\":\n - 672.224 ±(99.9%) 735.043 ns/op [Average]\n - (min, avg, max) = (357.479, 672.224, 1959.890), stdev = 486.185\n - CI (99.9%): [≈ 0, 1407.267] (assumes normal distribution)\n\n##### Result \"com.investigation.ehcache.benchmark.EhCacheBenchmark.getPut\":\n - 878.802 ±(99.9%) 887.920 ns/op [Average]\n - (min, avg, max) = (526.381, 878.802, 2347.393), stdev = 587.304\n - CI (99.9%): [≈ 0, 1766.722] (assumes normal distribution)\n\n##### Result \"com.investigation.ehcache.benchmark.EhCacheBenchmark.get\":\n - 134.799 ±(99.9%) 90.149 ns/op [Average]\n - (min, avg, max) = (59.389, 134.799, 260.582), stdev = 59.628\n - CI (99.9%): [44.650, 224.949] (assumes normal distribution)\n\n\n| Benchmark                    |  Mode | Cnt |  Score  |  Error      | Units |\n|------------------------------|:------|:----|:--------|:------------|:------|\n| EhCacheBenchmark.get         |  avgt | 10  | 176.414 | ±  129.249  | ns/op |\n| EhCacheBenchmark.getAdd      |  avgt | 10  | 456.254 | ±  456.254  | ns/op |\n| EhCacheBenchmark.add         |  avgt | 10  | 360.040 | ±  360.040  | ns/op |\n|                              |       |     |         |             |       |\n| GuavaCacheBenchmark.get      |  avgt | 10  | 417.519 | ± 1852.250  | ns/op |\n| GuavaCacheBenchmark.getAdd   |  avgt | 10  | 301.317 | ±  156.990  | ns/op |\n| GuavaCacheBenchmark.add      |  avgt | 10  | 121.100 | ±   52.495  | ns/op |\n|                              |       |     |         |             |       |\n| CoffeineCacheBenchmark.get   |  avgt | 10  |  68.528 | ±  73.959   | ns/op |\n| CoffeineCacheBenchmark.getAdd|  avgt | 10  | 101.232 | ±  66.103   | ns/op |\n| CoffeineCacheBenchmark.add   |  avgt | 10  | 139.562 | ±  84.309   | ns/op \n|                              |       |     |         |             |       |\n| CQEngineCacheBenchmark.get   |  avgt | 10  |2778.847 | ± 10868.407 | ns/op |\n| CQEngineCacheBenchmark.getAdd|  avgt | 10  |1925.592 | ±  2387.369 | ns/op |\n| CQEngineCacheBenchmark.add   |  avgt | 10  | 552.958 | ±   659.467 | ns/op |\n\n[Виктор Гамов — JCache и распределенные кэши: беспредел!](https://www.youtube.com/watch?v=mU893v4HtF4)\n\n---\n\u003e **In order to run benchmarking**\n\u003e - mvn clean install -DskipTests\n\u003e - java -jar target/benchmarks.jar\n\n\n[More examples: http://tutorials.jenkov.com/java-performance/jmh.html](http://tutorials.jenkov.com/java-performance/jmh.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinnykoleh%2Fcachesinvestigation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinnykoleh%2Fcachesinvestigation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinnykoleh%2Fcachesinvestigation/lists"}