Skip to content

Commit 5f1db06

Browse files
Add benchmarks and update README with performance data
- Add benchmark script using autocannon (npm run benchmark) - Document performance: 5,000+ req/sec for CRUD operations - Update README with notifications documentation - Add @fastify/websocket to dependencies docs
1 parent 8dac79b commit 5f1db06

4 files changed

Lines changed: 1372 additions & 257 deletions

File tree

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,30 @@ const server = createServer();
3535
const serverWithConneg = createServer({ conneg: true });
3636
```
3737

38+
## Performance
39+
40+
This server is designed for speed. Benchmark results on a typical development machine:
41+
42+
| Operation | Requests/sec | Avg Latency | p99 Latency |
43+
|-----------|-------------|-------------|-------------|
44+
| GET resource | 5,400+ | 1.2ms | 3ms |
45+
| GET container | 4,700+ | 1.6ms | 3ms |
46+
| PUT (write) | 5,700+ | 1.1ms | 2ms |
47+
| POST (create) | 5,200+ | 1.3ms | 3ms |
48+
| OPTIONS | 10,000+ | 0.4ms | 1ms |
49+
50+
Run benchmarks yourself:
51+
```bash
52+
npm run benchmark
53+
```
54+
3855
## Features
3956

40-
### Implemented (v0.0.8)
57+
### Implemented (v0.0.9)
4158

4259
- **LDP CRUD Operations** - GET, PUT, POST, DELETE, HEAD
4360
- **N3 Patch** - Solid's native patch format for RDF updates
61+
- **WebSocket Notifications** - Real-time updates via solid-0.1 protocol (SolidOS compatible)
4462
- **Container Management** - Create, list, and manage containers
4563
- **Multi-user Pods** - Create pods at `/<username>/`
4664
- **WebID Profiles** - JSON-LD structured data in HTML at pod root
@@ -171,18 +189,42 @@ curl -H "Authorization: DPoP ACCESS_TOKEN" \
171189

172190
```javascript
173191
createServer({
174-
logger: true, // Enable Fastify logging (default: true)
175-
conneg: false // Enable content negotiation (default: false)
192+
logger: true, // Enable Fastify logging (default: true)
193+
conneg: false, // Enable content negotiation (default: false)
194+
notifications: false // Enable WebSocket notifications (default: false)
176195
});
177196
```
178197

198+
### WebSocket Notifications
199+
200+
Enable real-time notifications for resource changes:
201+
202+
```javascript
203+
const server = createServer({ notifications: true });
204+
```
205+
206+
Clients discover the WebSocket URL via the `Updates-Via` header:
207+
208+
```bash
209+
curl -I http://localhost:3000/alice/public/
210+
# Updates-Via: ws://localhost:3000/.notifications
211+
```
212+
213+
Protocol (solid-0.1, compatible with SolidOS):
214+
```
215+
Server: protocol solid-0.1
216+
Client: sub http://localhost:3000/alice/public/data.json
217+
Server: ack http://localhost:3000/alice/public/data.json
218+
Server: pub http://localhost:3000/alice/public/data.json (on change)
219+
```
220+
179221
## Running Tests
180222

181223
```bash
182224
npm test
183225
```
184226

185-
Currently passing: **105 tests**
227+
Currently passing: **116 tests**
186228

187229
## Project Structure
188230

@@ -209,6 +251,10 @@ src/
209251
│ └── profile.js # WebID generation
210252
├── patch/
211253
│ └── n3-patch.js # N3 Patch support
254+
├── notifications/
255+
│ ├── index.js # WebSocket plugin
256+
│ ├── events.js # Event emitter
257+
│ └── websocket.js # solid-0.1 protocol
212258
├── rdf/
213259
│ ├── turtle.js # Turtle <-> JSON-LD
214260
│ └── conneg.js # Content negotiation
@@ -221,6 +267,7 @@ src/
221267
Minimal dependencies for a fast, secure server:
222268

223269
- **fastify** - High-performance HTTP server
270+
- **@fastify/websocket** - WebSocket support for notifications
224271
- **fs-extra** - Enhanced file operations
225272
- **jose** - JWT/JWK handling for Solid-OIDC
226273
- **n3** - Turtle parsing (only used when conneg enabled)

0 commit comments

Comments
 (0)