{"id":28535521,"url":"https://github.com/gerritcodereview/modules_cached-refdb","last_synced_at":"2025-07-20T06:32:55.687Z","repository":{"id":38740378,"uuid":"506684844","full_name":"GerritCodeReview/modules_cached-refdb","owner":"GerritCodeReview","description":"Gerrit libModule to cache access to Git repositories' refdb  - (mirror of https://gerrit.googlesource.com/modules/cached-refdb)","archived":false,"fork":false,"pushed_at":"2025-02-27T17:08:03.000Z","size":396,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-09T17:16:46.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gerrit.googlesource.com/modules/cached-refdb","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GerritCodeReview.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-23T15:00:29.000Z","updated_at":"2022-06-23T15:11:43.000Z","dependencies_parsed_at":"2023-01-28T15:31:42.901Z","dependency_job_id":null,"html_url":"https://github.com/GerritCodeReview/modules_cached-refdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GerritCodeReview/modules_cached-refdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cached-refdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cached-refdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cached-refdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cached-refdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GerritCodeReview","download_url":"https://codeload.github.com/GerritCodeReview/modules_cached-refdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fmodules_cached-refdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266076350,"owners_count":23872741,"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":[],"created_at":"2025-06-09T17:15:41.244Z","updated_at":"2025-07-20T06:32:55.672Z","avatar_url":"https://github.com/GerritCodeReview.png","language":"Java","readme":"# Plugin to cache Git repository's access to refdb\n\nWhen [Serialize AccountCache series](https://gerrit-review.googlesource.com/c/gerrit/+/260992)\nwas introduced it simplified the cache eviction by always reaching out to JGit\nfor data. Unfortunately it comes with\n[price](https://bugs.chromium.org/p/gerrit/issues/detail?id=14945)\nwhich is especially high when *All-Users* repository is accessed through the\nNFS and `core.trustFolderStat = false` is configured in\n`${GERRIT_SITE}/etc/jgit.config` (quite common setup for HA/Multi-Site ens).\n\nThis plugin was developed to introduce the in-memory cache (managed by Gerrit\nso that evictions could be coordinated to multiple nodes) that reduces the\nprice for reaching to refs in JGit. It is a Gerrit native alternative (that can\nbe applied to Gerrit 3.2) to work that is currently under progress for\n[caching Refs in JGit](https://git.eclipse.org/r/c/jgit/jgit/+/186205).\n\nHere is the short comparison of _heavy-refs-related_ operations performance.\nThe test scenario was to get random change details (over the same REST API that\nis used in Gerrit's details page) in 8 parallel threads over 5mins period of\ntime. The `core.trustFolderStat = false` was set in\n`${GERRIT_SITE}/etc/jgit.config`.\nIt was called against:\n* vanilla Gerrit 3.1.16 version (marked as `stable-3.1` in the results)\n* vanilla Gerrit 3.2.12 version (marked as `stable-3.2` in the results)\n* Gerrit 3.2.14 with libCache module loaded (marked as `stable-3.2-libCache` in\n  the results).\n\nNote that `TRS` is `Reqs/Sec` for each Thread.\n\n```\n| version                           | TRS Avg | TRS Std Dev | TRS Max | Total Reqs/sec | Transfer/sec(MB)|\n| --------------------------------- | ------- | ----------- | ------- | -------------- | --------------- |\n| stable-3.1                        | 57,33   | 8,26        | 80      | 456,95         | 4,34            |\n| stable-3.2                        | 13,87   | 4,92        | 20      | 110,18         | 1,07            |\n| stable-3.2-libCache               | 105,27  | 14,55       | 150     | 834,88         | 8,41            |\n| stable-3.1 vs stable-3.2          | 313,34% | 67,89%      | 300,00% | 314,73%        | 305,61%         |\n| stable-3.2-libCache vs stable-3.2 | 658,98% | 195,73%     | 650,00% | 657,74%        | 685,98%         |\n| stable-3.2-libCache vs stable-3.1 | 83,62%  | 76,15%      | 87,50%  | 82,71%         | 93,78%          |\n```\n\nOne can clearly see that in this setup using this library module outperforms both\nGerrit 3.2 and 3.1 by factor of *6* and *2* correspondingly.\nThe test script, detailed description and more results are available\n[here](https://gist.github.com/geminicaprograms/b2cae199793f0f2b18759a803000447f).\n\n## How to build\n\nClone or link this plugin to the plugins directory of Gerrit's source tree,\nand then run bazel build on the plugin's directory.\n\nExample:\n\n```\ngit clone --recursive https://gerrit.googlesource.com/gerrit\ncd plugins\ngit clone \"https://gerrit.googlesource.com/modules/cached-refdb\"\ncd .. \u0026\u0026 bazel build plugins/cached-refdb\n```\n\nThe output plugin jar is created in:\n\n```\nbazel-bin/plugins/cached-refdb/cached-refdb.jar\n```\n\n## How to install\n\nCopy the cached-refdb.jar into the `${GERRIT_SITE}/lib/` so that it is\nbeing loaded when the Gerrit instance is started. Note that the following\nconfiguration options need to be added\n\n```\ngit config --file ${GERRIT_SITE}/etc/gerrit.config --add gerrit.installDbModule\\\n  com.googlesource.gerrit.plugins.cachedrefdb.LibDbModule\ngit config --file ${GERRIT_SITE}/etc/gerrit.config --add gerrit.installModule\\\n  com.googlesource.gerrit.plugins.cachedrefdb.LibSysModule\n```\n\n\u003e NOTE: There are situations where the binding of the module to the Gerrit's\n\u003e GitRepositoryManager is not desired; e.g., when using this module together\n\u003e with others that are trying to override it at the same time.\n\u003e\n\u003e It is possible to just load the module using the following two options:\n\u003e\n\u003e ```\n\u003e git config --file ${GERRIT_SITE}/etc/gerrit.config --add gerrit.installDbModule\\\n\u003e   com.googlesource.gerrit.plugins.cachedrefdb.LibModule\n\u003e git config --file ${GERRIT_SITE}/etc/gerrit.config --add gerrit.installModule\\\n\u003e   com.googlesource.gerrit.plugins.cachedrefdb.LibSysModule\n\u003e ```\n\nBy default cache can hold up to `1024` refs which will not be sufficient for\nany production site therefore one can configure it through the standard Gerrit\ncache configuration means e.g.\n\n```\ngit config --file ${GERRIT_SITE}/etc/gerrit.config cache.ref_by_name.memoryLimit 10240\n```\n\nNote that library module requires the Gerrit instance restart in order to pick\nup the configuration changes.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fmodules_cached-refdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerritcodereview%2Fmodules_cached-refdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerritcodereview%2Fmodules_cached-refdb/lists"}