{"id":26153970,"url":"https://github.com/Orange-OpenSource/bmc-cache","last_synced_at":"2025-03-11T08:03:01.791Z","repository":{"id":38832253,"uuid":"351809060","full_name":"Orange-OpenSource/bmc-cache","owner":"Orange-OpenSource","description":"In-kernel cache based on eBPF.","archived":false,"fork":false,"pushed_at":"2021-09-24T17:18:55.000Z","size":446,"stargazers_count":448,"open_issues_count":10,"forks_count":48,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-03-06T05:11:59.561Z","etag":null,"topics":["bpf","ebpf","kernel","memcached","xdp"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Orange-OpenSource.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":"2021-03-26T14:28:12.000Z","updated_at":"2025-03-04T03:15:26.000Z","dependencies_parsed_at":"2022-09-11T18:13:41.639Z","dependency_job_id":null,"html_url":"https://github.com/Orange-OpenSource/bmc-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fbmc-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fbmc-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fbmc-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Orange-OpenSource%2Fbmc-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Orange-OpenSource","download_url":"https://codeload.github.com/Orange-OpenSource/bmc-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242995900,"owners_count":20218828,"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":["bpf","ebpf","kernel","memcached","xdp"],"created_at":"2025-03-11T08:02:11.782Z","updated_at":"2025-03-11T08:03:01.780Z","avatar_url":"https://github.com/Orange-OpenSource.png","language":"C","funding_links":[],"categories":["BPF and eBPF Projects"],"sub_categories":["Notes"],"readme":"BMC\n===\n\n### __Code for the [NSDI'21 paper](https://www.usenix.org/system/files/nsdi21-ghigoff.pdf) *\"BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing\"*.__\n\nBibTex entry available [here](#cite-this-work).\n\nBMC (BPF Memory Cache) is an in-kernel cache for memcached. It enables runtime, crash-safe extension of the Linux kernel to process specific memcached requests before the execution of the standard network stack. BMC does not require modification of neither the Linux kernel nor the memcached application. Running memcached with BMC improves throughput by up to 18x compared to the vanilla memcached application.\n\nRequirements\n---\n\nLinux kernel __v5.3__ or higher is required to run BMC.\n\nOther software dependencies are required to build BMC and Memcached-SR (see [Building BMC](#building-bmc) and [Building Memcached-SR](#building-memcached-sr)). \n\nBuild instructions\n---\n\n### Building BMC\n\nBMC must be compiled with libbpf and other header files obtained from kernel sources. The project does not include the kernel sources, but the [kernel-src-download.sh](kernel-src-download.sh) and [kernel-src-prepare.sh](kernel-src-prepare.sh) scripts automate the download of the kernel sources and prepare them for the compilation of BMC.\n\nThese scripts require the following software to be installed:\n\n```sh\ngpg curl tar xz make gcc flex bison libssl-dev libelf-dev\n```\n\nThe project uses llvm and clang version 9 to build BMC, but more recent versions might work as well:\n\n```sh\nllvm-9 clang-9\n```\n\nNote that ```libelf-dev``` is also required to build libbpf and BMC.\n\nWith the previous software installed, BMC can be built with the following:\n```bash\n$ ./kernel-src-download.sh\n$ ./kernel-src-prepare.sh\n$ cd bmc \u0026\u0026 make\n```\n\nAfter BMC has been successfully built, kernel sources can be removed by running the [kernel-src-remove.sh](kernel-src-remove.sh) script from the project root.\n\n### Building Memcached-SR\n\nMemcached-SR is based on memcached v1.5.19. Building it requires the following software:\n\n```sh\nclang-9 (or gcc-9) automake libevent-dev\n```\n\nEither ```clang-9``` or ```gcc-9``` is required in order to compile memcached without linking issues. Depending on your distribution, you might also need to use the ```-Wno-deprecated-declarations``` compilation flag.\n\nMemcached-SR can be built with the following:\n```bash\n$ cd memcached-sr \n$ ./autogen.sh\n$ CC=clang-9 CFLAGS='-DREUSEPORT_OPT=1 -Wno-deprecated-declarations' ./configure \u0026\u0026 make\n```\n\nThe ```memcached``` binary will be located in the memcached-sr directory.\n\nFurther instructions\n---\n\n### TC egress hook\n\nBMC doesn't attach the tx_filter eBPF program to the egress hook of TC, it needs to be attached manually.\n\nTo do so, you first need to make sure that the BPF filesystem is mounted, if it isn't you can mount it with the following command:\n```bash\n# mount -t bpf none /sys/fs/bpf/\n```\n\nOnce BMC is running and the tx\\_filter program has been pinned to /sys/fs/bpf/bmc\\_tx\\_filter, you can attach it using the tc command line:\n```bash\n# tc qdisc add dev \u003cinterface_name\u003e clsact\n# tc filter add dev \u003cinterface_name\u003e egress bpf object-pinned /sys/fs/bpf/bmc_tx_filter\n```\n\nAfter you are done using BMC, you can detach the program with these commands:\n```bash\n# tc filter del dev \u003cinterface_name\u003e egress\n# tc qdisc del dev \u003cinterface_name\u003e clsact\n```\nAnd unpin the program with ```# rm /sys/fs/bpf/bmc_tx_filter```\n\nLicense\n---\n\nFiles under the [bmc](bmc) directory are licensed under the [GNU Lesser General Public License version 2.1](LICENSE).\n\nFiles under the [memcached-sr](memcached-sr) directory are licensed under the [BSD-3-Clause BSD](LICENSE\u0026#32;(Memcached\u0026#32;customizations)) license.\n\nCite this work\n---\nBibTex:\n```\n@inproceedings{265047,\n\ttitle        = {{BMC}: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing},\n\tauthor       = {Yoann Ghigoff and Julien Sopena and Kahina Lazri and Antoine Blin and Gilles Muller},\n\tyear         = 2021,\n\tmonth        = apr,\n\tbooktitle    = {18th {USENIX} Symposium on Networked Systems Design and Implementation ({NSDI} 21)},\n\tpublisher    = {{USENIX} Association},\n\tpages        = {487--501},\n\tisbn         = {978-1-939133-21-2},\n\turl          = {https://www.usenix.org/conference/nsdi21/presentation/ghigoff}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrange-OpenSource%2Fbmc-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOrange-OpenSource%2Fbmc-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrange-OpenSource%2Fbmc-cache/lists"}