未验证 提交 1d9563df 编写于 作者: S Sandy Xu 提交者: GitHub

add docs for `juicefs profile` (#350)

上级 01441c68
......@@ -174,7 +174,7 @@ $ cat /jfs/.accesslog
2021.01.15 08:26:11.003616 [uid:0,gid:0,pid:4403] write (17666,390,951582): OK <0.000006>
```
The last number on each line is the time (in seconds) current operation takes. You can use this to debug and analyze performance issues. We will provide more tools to analyze it.
The last number on each line is the time (in seconds) current operation takes. You can use this directly to debug and analyze performance issues, or try `./juicefs profile /jfs` to monitor real time statistics. Please run `./juicefs profile -h` or refer to [here](docs/en/operations_profiling.md) to learn more about this subcommand.
## Supported Object Storage
......
......@@ -173,7 +173,7 @@ $ cat /jfs/.accesslog
2021.01.15 08:26:11.003616 [uid:0,gid:0,pid:4403] write (17666,390,951582): OK <0.000006>
```
每一行的最后一个数字是该操作所消耗的时间,单位是秒。你可以利用它来分析各种性能问题,未来我们也会提供更多工具来分析它
每一行的最后一个数字是该操作所消耗的时间,单位是秒。你可以直接利用它来分析各种性能问题,或者尝试`./juicefs profile /jfs`命令实时监控统计信息。欲进一步了解此子命令请运行`./juicefs profile -h`或参阅[这里](docs/en/operations_profiling.md)
## 支持的对象存储
......
......@@ -14,7 +14,7 @@ USAGE:
juicefs [global options] command [command options] [arguments...]
VERSION:
0.12.1-11 (2021-04-21 d749382)
0.12.1-23 (2021-04-26 56efd35)
COMMANDS:
format format a volume
......@@ -27,6 +27,7 @@ COMMANDS:
benchmark run benchmark, including read/write/stat big/small files
gc collect any leaked objects
fsck Check consistency of file system
profile analyze access log (Experimental)
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
......@@ -395,3 +396,29 @@ Check consistency of file system.
```
juicefs fsck [command options] REDIS-URL
```
## juicefs profile
### Description
Analyze access log (Experimental).
### Synopsis
```
juicefs profile [command options] MOUNTPOINT/LOGFILE
```
### Options
`--uid value, -u value`\
track only specified UIDs(separated by comma ,)
`--gid value, -g value`\
track only specified GIDs(separated by comma ,)
`--pid value, -p value`\
track only specified PIDs(separated by comma ,)
`--interval value`\
flush interval in seconds (default: 2)
......@@ -35,4 +35,4 @@ $ cat /jfs/.accesslog
2021.01.15 08:26:11.003616 [uid:0,gid:0,pid:4403] write (17666,390,951582): OK <0.000006>
```
The last number on each line is the time (in seconds) current operation takes. You can use this to debug and analyze performance issues.
The last number on each line is the time (in seconds) current operation takes. You can use this to know information of every operation, or try `juicefs profile /jfs` to monitor aggregated statistics.
# Operations Profiling
## Introduction
JuiceFS has a special virtual file named `.accesslog` to track every operation occurred within its client. This file may generate thousands of log entries per second when under pressure, making it hard to find out what is actually going on at a certain time. Thus, we made a simple tool called `juicefs profile` to show an overview of recently completed operations. The basic idea is to aggregate all logs in the past interval and display statistics periodically, like:
![juicefs-profiling](../images/juicefs-profiling.gif)
## Profiling Modes
For now there are 2 modes of profiling: real time and replay.
### Real Time Mode
By executing the following command you can watch real time operations under the mount point:
```bash
$ juicefs profile MOUNTPOINT
```
The result is sorted in a descending order by number.
### Replay Mode
Running the profile command on an existing log file enables the **replay mode**:
```
$ juicefs profile LOGFILE
```
When debugging or analyzing perfomance issues, it is usually more practical to record access log first and then replay it(multiple times). For example:
```bash
$ cat /jfs/.accesslog > /tmp/jfs-oplog
# later
$ juicefs profile /tmp/jfs-oplog
```
The replay could be paused anytime by <kbd>enter/return</kbd>, and continues by pressing it again.
## Filter
Sometimes we are only interested in a certain user or process, then we can filter others out by specifying its IDs; e.g:
```bash
$ juicefs profile /tmp/jfs-oplog --uid 12345
```
For more information, please run `juicefs profile -h`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册