Skip to content

Commit

Permalink
add perf package docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarabdul3ziz committed Nov 18, 2023
1 parent aca354f commit 43e92ce
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Performance Monitor Package

### Overview

The `perf` package is a performance monitor in `zos` nodes. it schedules tasks, cache their results and allows retrieval of these results through `RMB` calls.

### Flow

1. The `perf` monitor is started by the `noded` service in zos.
2. Tasks are registered with a schedule in the new monitor.
3. A bus handler is opened to allow result retrieval.

### Node Initialization check

To ensure that the node always has a test result available, a check is performed on node startup for all the registered tasks, if a task doesn't have any stored result, it will run immediately without waiting for the next scheduled time.

### Scheduling

Tasks are scheduled using a 6 fields cron format. this format provides flexibility to define time, allowing running tasks periodically or at specific time.

### RMB commands

- `zos.perf.get`:
Payload: string representing the task name.
Return: a single task result.
Possible Error: `ErrResultNotFound` if no result is stored for the given task.

- `zos.perf.get_all`:
Return: all stored results

### Caching

Results are stored in a Redis server running on the node.

The key in redis is the name of the task prefixed with the word `perf`.
The value is an instance of `TaskResult` struct contains:

- Name of the task
- Timestamp when the task was run
- The actual returned result from the task

Notes:

- Storing results by a key ensures each new result overrides the old one, so there is always a single result for each task.
- Storing results prefixed with `perf` eases retrieving all the results stored by this module.

### Registered tests
- [Public IP validation](./publicips.md)
- [CPU benchmark](./cpubench.md)
- [IPerf](./iperf.md)
- To add new task, [check](../../pkg/perf/README.md)
16 changes: 16 additions & 0 deletions docs/tasks/cpubench.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CPUBenchmark

### Overview

The `CPUBenchmark` task is designed to measure the performance of the CPU. it utilizes the [cpu-benchmark-simple](https://github.com/threefoldtech/cpu-benchmark-simple) tool and includes a zos stub to gather the number of workloads running on the node.

### Configuration

- Name: `CPUBenchmark`
- Schedule: 4 times a day

### Details

- The benchmark simply runs a `CRC64` computation task, calculates the time spent in the computation and reports it in `seconds`.
- The computation is performed in both single-threaded and multi-threaded scenarios.
- Lower time = better performance: for a single threaded benchmark, a lower execution time indicates better performance.
26 changes: 26 additions & 0 deletions docs/tasks/iperf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# IPerf

### Overview

The `iperf` package is designed to facilitate network performance testing using the `iperf3` tool. with both UDP and TCP over IPv4 and IPv6.

### Configuration

- Name: iperf
- Schedule: 4 times a day

### Details

- The package using the iperf binary to examine network performance under different conditions.
- It randomly fetch PublicConfig data for randomly public nodes on the chain + all public node from free farm. These nodes serves as the targets for the iperf tests.
- For each node, it run the test with 4 times. through (UDP/TCP) using both node IPs (v4/v6)
- result will be a slice of the 4 report each one will include:
```
UploadSpeed: Upload speed in bits per second.
DownloadSpeed: Download speed in bits per second.
NodeID: ID of the node where the test was conducted.
NodeIpv4: IPv4 address of the node.
TestType: Type of the test (TCP or UDP).
Error: Any error encountered during the test.
CpuReport: CPU utilization report.
```
3 changes: 3 additions & 0 deletions docs/tasks/publicips.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ The task is scheduled to run 4 times a day.
## Result

The task only returns a single map of String (IP) to IPReport. The report consists of the IP state (valid, invalid or skipped) and the reason for the state.

### Notes
- Previously tested ips and marked as `Valid` doesn't get revalidated again.

0 comments on commit 43e92ce

Please sign in to comment.