!1 申请合入astream源码仓

From: @barbo 
Reviewed-by: @disnight, @xiexiuqi 
Signed-off-by: @xiexiuqi
This commit is contained in:
openeuler-ci-bot 2022-08-29 16:05:37 +00:00 committed by Gitee
commit 85f15ed55c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 102 additions and 59 deletions

View File

@ -1,36 +0,0 @@
# astream
#### Description
This package contains a tool to allocate multi-stream on NVMe SSD.
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,37 +1,79 @@
# astream
## 介绍
astream是一款支持用户自定义配置目标文件的流信息以使能NVMe SSD磁盘的多流multi-stream特性从而延长磁盘寿命的便捷工具。
### 编译安装
- 下载astream源码
```
git clone https://gitee.com/openeuler/astream.git
```
- 编译
```
cd src && make && make install
```
### 安装验证
`astream`默认安装在`/usr/bin`下,安装后可直接使用`astream`命令,即表示软件安装成功。
## 使用说明
### 流分配规则文件介绍与示例
#### 介绍
This package contains a tool to allocate multi-stream on NVMe SSD.
#### 软件架构
软件架构说明
流分配规则文件中,每一行表示定义的一条规则,每条规则示例如下: `^/path/xx/undo 1`
它表示为路径/path/xx/下的所有以`undo`为前缀的文件都分配流信息1。
#### 安装教程
#### 示例
1. xxxx
2. xxxx
3. xxxx
如下示例一个具体的MySQL的流分配规则文件。
#### 使用说明
```
^/data/mysql/data/ib_logfile 2
^/data/mysql/data/ibdata1$ 3
^/data/mysql/data/undo 4
^/data/mysql/data/mysql-bin 5
```
1. xxxx
2. xxxx
3. xxxx
该规则文件定义了如下四条规则:
#### 参与贡献
- 以`/data/mysql/data/ib_logfile`为前缀的文件绝对路径对应的文件配置流信息2
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
- 以`/data/mysql/data/ibdata1`为文件绝对路径对应的文件配置流信息3
- 以`/data/mysql/data/undo`为前缀的文件绝对路径对应的文件配置流信息4
#### 特技
- 以`/data/mysql/data/mysql-bin`为前缀的文件绝对路径对应的文件配置流信息5
### 命令行参数说明
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
`astream [options]`
| 参数 | 参数含义 | 示例说明 |
| ---- | ------------------------------------------------------------ | ------------------------------------------------ |
| -h | 显示astream使用说明 | `astream -h` |
| -l | 设置astream监控过程的显示日志级别, debug(1), info(2), warn(3), error(4) | `astream -i /path/xx/ -r /path/to/rule.txt -l 2` |
| -i | 指定当前需要监控的目录,多个目录可以以空格间隔输入 | 该参数配合-r使用, 示例见下 |
| -r | 指定监控目录对应的流分配规则文件,传入的个数取决于-i且互相对应 | `astream -i /path/xx -r rule_file.txt` |
| stop | 正常停止astream守护进程 | astream stop |
### 启动astream守护进程
- 监控单目录
`astream -i /path/xx/ -r /path/to/stream_rule1.txt`
- 监控多目录
本工具支持同时监控多个目录,意味着每个监控目录都需要传入适配的流分配规则文件,支持同时监控两个目录的工具使用示例如下:
`astream -i /path/xx/ /path/yy/ -r /path/to/stream_rule1.txt /path/to/stream_rule2.txt `
命令中监控两个目录目录1`/path/xx`,对应的流分配规则文件为`/path/to/stream_rule1.txt`目录2`/path/yy`,对应的流分配规则文件为`/path/to/stream_rule1`
### NVMe SSD磁盘的写放大WA计算
- 安装`nvme-cli`软件包
`yum install nvme-cli`
- 执行`calculate_wa.sh`脚本计算WA
由于磁盘WA的收益需要长稳测试才能相对明显因此我们利用定时器crontab每隔1小时执行计算当前磁盘的WA具体操作如下
假设脚本位于`/root`下,则执行`crontab -e`,加入定时任务
`0 */1 * * * bash /root/calculate.sh nvme0`
其中,若所测的`NVMe`磁盘盘符名为`/dev/nvme0n1`,则定时任务中脚本的参数传入`nvme0`即可,其它依此类推。

BIN
astream-v1.0.tar.gz Normal file

Binary file not shown.

37
astream.spec Normal file
View File

@ -0,0 +1,37 @@
Name: astream
Version: v1.0
Release: 1
Summary: an automatic multi-stream implementation tool for openEuler
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/astream
Source0: %{name}-%{version}.tar.gz
%description
astream is an automatic multi-stream implementation tool for openEuler
# skip debuginfo packages
%global debug_package %{nil}
%prep
%autosetup -n %{name}-%{version}
%build
cd src
make
%install
mkdir -p %{buildroot}/%{_bindir}
cp src/astream %{buildroot}/%{_bindir}
%files
%attr(0500, -, -) %{_bindir}/astream
%license LICENSE
%doc README.md
%changelog
* Mon Aug 29 2022 hongrongxuan <389817374@qq.com> - v1.0-1
- Type:Init
- ID:NA
- SUG:NA
- DESC:Automatic multi-stream implementation tool