summaryrefslogtreecommitdiff
path: root/README.md
blob: 0e68dd5118b52431d898b8ddb7bbd0e1e04e945d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Torque 

A lightweight system stress-testing and performance monitoring tool written in Scala with ZIO.

Scala
ZIO Combinators / Fibers
ZIO HTTP
OSHI

## Features

- **CPU** - Monitor and test CPU performance under load
- **Memory** - RAM stress testing with configurable memory allocation
- **Metrics** - Live system performance monitoring via HTTP API

## Quick Start

### Prerequisites

- Java 25
- Scala 3.7.4
- sbt 1.11.7

### Installation

```bash
git clone https://github.com/nasrlol/torque
cd torque
sbt run
```
Or get it from my gitea

```bash
git clone https://git.nsrddyn.com/nasr/torque
cd torque
sbt run
```

### Usage

Start the Torque server:
```bash
sbt run
```

TODO: Explanation on how to run the tests

The server will start on `http://localhost:8080` with the following endpoints:

- `GET /` - API status
- `GET /cpu` - CPU performance metrics and stress testing
- `GET /ram` - RAM usage metrics and memory allocation tests

### Example API Calls

```bash
# Check server status
curl http://localhost:8080/

# Get CPU metrics
curl http://localhost:8080/cpu

# Get RAM metrics  
curl http://localhost:8080/ram
```

## Architecture

Torque is built using modern Scala functional programming patterns:

- **ZIO** - For effect management and concurrency
- **ZIO HTTP** - For high-performance HTTP server
- **OSHI** - For cross-platform system information

### Tree 

```

.
├── LICENSE
├── README.md
├── build.sbt
├── project
│   ├── build.properties
├── src
│   └── main
│       └── scala
│           └── main
│               ├── Main.scala
│               ├── domain
│               │   ├── CpuOperations.scala
│               │   └── MemoryOperations.scala
│               ├── infrastructure
│               │   ├── Http.scala
│               │   ├── Resources.scala
│               │   └── routes
│               │       └── Routes.scala
│               └── services
│                   ├── Benchmark.scala
│                   └── Stress.scala

```

## Development

### Building from Source

```bash
sbt compile
```

### Creating a Fat JAR

```bash
sbt assembly
```

## Configuration

Torque can be configured via environment variables:

- `TORQUE_PORT` - HTTP server port (default: 8080)
- `TORQUE_HOST` - Server host (default: localhost)

## API Documentation

### CPU Endpoint
`GET /cpu`
Returns CPU utilization metrics and allows initiating stress tests.

### RAM Endpoint  
`GET /ram`
Returns memory usage statistics and memory allocation test results.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Built with [ZIO](https://zio.dev/) for functional effects
- Uses [OSHI](https://github.com/oshi/oshi) for system information
- Inspired by stress testing tools like `Linkpack` and `PRIME95`