{"id":15630721,"url":"https://github.com/owent/libatbus","last_synced_at":"2025-04-12T15:42:25.618Z","repository":{"id":5748856,"uuid":"53823264","full_name":"owent/libatbus","owner":"owent","description":"用于搭建高性能、全异步、树形结构的BUS消息系统的跨平台框架库","archived":false,"fork":false,"pushed_at":"2025-04-01T06:51:54.000Z","size":2112,"stargazers_count":222,"open_issues_count":0,"forks_count":64,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-03T16:13:05.132Z","etag":null,"topics":["bus","channel","cpp","cxx","data","ip","ipv4","ipv6","linux","macos","message","osx","performance","queue","shared-memory","shm","socket","tcp","transfer","windows"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"owent/libatbus","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owent.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2016-03-14T03:13:10.000Z","updated_at":"2025-04-01T06:51:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed09f3f1-8098-4c88-9721-b28c5351fa4e","html_url":"https://github.com/owent/libatbus","commit_stats":{"total_commits":584,"total_committers":9,"mean_commits":64.88888888888889,"dds":"0.49828767123287676","last_synced_commit":"b0b31edf23730ff1458bdf5da9d5b5a37c20bc9b"},"previous_names":["owent/libatbus","atframework/libatbus"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owent%2Flibatbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owent%2Flibatbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owent%2Flibatbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owent%2Flibatbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owent","download_url":"https://codeload.github.com/owent/libatbus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590917,"owners_count":21129912,"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":["bus","channel","cpp","cxx","data","ip","ipv4","ipv6","linux","macos","message","osx","performance","queue","shared-memory","shm","socket","tcp","transfer","windows"],"created_at":"2024-10-03T10:35:49.084Z","updated_at":"2025-04-12T15:42:25.585Z","avatar_url":"https://github.com/owent.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libatbus\r\n\r\n用于搭建高性能、全异步(a)、树形结构(t)的BUS消息系统的跨平台框架库\r\n\r\n[![ci-badge]][ci-link] [![codecov badge]][codecov status]\r\n\r\n[ci-badge]: https://github.com/atframework/libatbus/actions/workflows/main.yml/badge.svg \"Github action build status\"\r\n[ci-link]:  https://github.com/atframework/libatbus/actions/workflows/main.yml \"Github action build status\"\r\n[codecov badge]: https://codecov.io/gh/atframework/libatbus/branch/main/graph/badge.svg\r\n[codecov status]: https://codecov.io/gh/atframework/libatbus\r\n\r\n## CI Job Matrix\r\n\r\n| Target System | Toolchain          | Note                  |\r\n| ------------- | ------------------ | --------------------- |\r\n| Linux         | GCC                |\r\n| Linux         | Clang              | With libc++           |\r\n| Linux         | GCC 4.8            |\r\n| MinGW64       | GCC                | Dynamic linking       |\r\n| Windows       | Visual Studio 2022 | Static linking        |\r\n| Windows       | Visual Studio 2022 | Dynamic linking       |\r\n| Windows       | Visual Studio 2019 | Static linking        |\r\n| macOS         | AppleClang         | With libc++           |\r\n\r\n## 依赖\r\n\r\n+ 支持c++0x或c++11的编译器(为了代码尽量简洁,特别是少做无意义的平台兼容，依赖部分 C11和C++11的功能，所以不支持过低版本的编译器)\r\n  \u003e + GCC: 4.8 及以上\r\n  \u003e + Clang: 3.8 及以上\r\n  \u003e + VC: 12 及以上\r\n\r\n+ [cmake](https://cmake.org/download/) 3.16.0 以上\r\n\r\n## 设计初衷和要点\r\n\r\n1. **[扩展性]** 根据很多业务的需要，预留足够长的ID段（64位），用以给不同的ID段做不同类型的业务区分。\r\n  \u003e 现有很多框架都是32位（比如腾讯的tbus和云风的[skynet](https://github.com/cloudwu/skynet)），在服务类型比较多的时候必须小心设计服务ID,以免冲突。\r\n  \u003e\r\n  \u003e 当然也有考虑到以后可能会扩展为带Hash的字符串，所以在编译选项上做了预留。但是目前还是uint64_t\r\n\r\n2. **[高性能]** 同物理机之间可以直接使用共享内存通信，大幅提高消息分发的性能。跨物理机之间会使用tcp通信。并且这个通信方式的选择是完全自动并透明的（尽可能选择更快的方式发送消息），业务层完全不需要关心。\r\n3. **[跨平台]** 拥有不同习惯的Developer可以使用自己熟悉的工具，提高开发速度\r\n4. **[动态路由]** 父子节点间会至少保持一条连接，自动断线重连。同父的兄弟节点之间完全按需建立连接。并且这个过程都是自动完成的，不需要提前初始化。\r\n  \u003e 同样，新增节点和移除节点也不需要做什么特别的初始化操作。不会影响到已经在线上的服务。\r\n\r\n5. **[低消耗]** 采用无锁队列，提高CPU性能。（共享）内存通道支持多端写入，一端读取，减少内存浪费。\r\n  \u003e 如果N个节点两两互联，每个节点可以只拥有一个（共享）内存通道。即总共只有N个通道，内存消耗为N*每个通道内存占用\r\n  \u003e\r\n  \u003e 一些其他的系统（比如tbus和我们目前的服务器框架）如果N个节点两两互联，每两个节点之间都要创建（共享）内存通道。即总共只有N*N个通道，内存消耗为N*N*每个通道内存占用。非常浪费\r\n\r\n6. **[简化设计]** 根据一些实际的项目情况，把父子节点间的关系限定为Bus ID的后N位有包含关系，类似路由器的路由表的策略。\r\n  \u003e 比如 0x12345678 可以控制的子节点有16位（0x12345678/16），那么0x12340000-0x1234FFFF都可以注册为它的子节点。\r\n  \u003e\r\n  \u003e 如同IP协议中 192.168.1.1/24 路由表能管理 192.168.1.0-192.168.1.255 一样。当然这里的24指前24位，而前面提到的16指后16位。\r\n  \u003e\r\n  \u003e 这么简化以后很多节点关系维护和通信都能简单很多并且能提高性能。\r\n\r\n## 环境准备和构建流程\r\n\r\n使用cmake标准构建方式，默认的编译目标为Debug版本，详见 [使用（编译）流程](docs/Build.md)\r\n\r\n**注意： 默认的编译选项是Debug模式，压测和正式环境请使用 cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo 源码目录 [其他选项] 编译（相当于gcc -O2 -g -ggdb -DNDEBUG -Wall -Werror或MSVC /O2）**\r\n\r\n**注意： Windows下私有共享内存不允许跨进程共享，公有共享内存必须有管理员权限。如果Windows下出现初始化共享内存错误请使用管理员权限运行。**\r\n\r\n## 使用示例\r\n\r\n简要的使用示例见 [使用示例](docs/Usage.md)\r\n\r\n更加详细的请参考单元测试和[tools](tools)目录内的代码\r\n\r\n## Benchmark\r\n\r\n压力测试和对比见[docs/Benchmark.md](docs/Benchmark.md)\r\n\r\n## 支持工具\r\n\r\nLinux下 GCC编译安装脚本(支持离线编译安装):\r\n\r\n1. [GCC](https://github.com/owent-utils/bash-shell/tree/master/GCC%20Installer)\r\n2. [LLVM \u0026 Clang](https://github.com/owent-utils/bash-shell/tree/master/LLVM%26Clang%20Installer)\r\n\r\n## LICENSE\r\n\r\n+ libatbus 采用[MIT License](LICENSE)\r\n+ Flatbuffers 采用[Apache License, Version 2.0](LICENSE-Apache.txt)\r\n+ libuv 采用[Node's license协议](NODE_S_LICENSE)（类似MIT License）\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowent%2Flibatbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowent%2Flibatbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowent%2Flibatbus/lists"}