File tree Expand file tree Collapse file tree 5 files changed +125
-0
lines changed Expand file tree Collapse file tree 5 files changed +125
-0
lines changed Original file line number Diff line number Diff line change 1+ # Performance
2+
3+ ## Test Script
4+
5+ Test maximum single-threaded throughput for two minutes.
6+
7+ ``` go
8+ package main
9+
10+ import (
11+ " fmt"
12+ " github.com/Netflix/spectator-go/v2/spectator"
13+ " time"
14+ )
15+
16+ func elapsed (start time .Time ) float64 {
17+ return time.Now ().Sub (start).Seconds ()
18+ }
19+
20+ func main () {
21+ location := " udp"
22+ // location := "unix"
23+ config , _ := spectator.NewConfig (location, nil , nil )
24+ registry , _ := spectator.NewRegistry (config)
25+ defer registry.Close ()
26+ // add tags with some length, to simulate more real-world conditions
27+ tags := map [string ]string {" location" : location, " version" : " correct-horse-battery-staple" }
28+
29+ maxDuration := float64 (2 * 60 )
30+ start := time.Now ()
31+
32+ fmt.Printf (" start spectator-go %s benchmark\n " , location)
33+ iteration := 1
34+ for elapsed (start) < maxDuration {
35+ registry.Counter (" spectator-go.publish" , tags).Increment ()
36+ if iteration % 500000 == 0 {
37+ fmt.Printf (" iterations=%v elapsed=%v \n " , iteration, elapsed (start))
38+ }
39+ iteration++
40+ }
41+
42+ fmt.Printf (" iterations=%v rate/sec=%v \n " , iteration, float64 (iteration) / elapsed (start))
43+ }
44+ ```
45+
46+ ## Results
47+
48+ See [ Usage > Performance] ( usage.md#performance ) .
Original file line number Diff line number Diff line change 1+ # Performance
2+
3+ ## Test Script
4+
5+ Test maximum single-threaded throughput for two minutes.
6+
7+ ``` javascript
8+ // tbd
9+ ```
10+
11+ ## Results
12+
13+ See [ Usage > Performance] ( usage.md#performance ) .
Original file line number Diff line number Diff line change @@ -448,3 +448,17 @@ describe("Protocol Parser Tests", (): void => {
448448` ` `
449449
450450[SpectatorD]: ../ ../ agent/ usage .md
451+
452+ ## Performance
453+
454+ On an ` m5d.2xlarge` EC2 instance, with ` Node.js v22.16.0` and ` nflx-spectator: ^3.0.5` , we have
455+ observed the following single- threaded performance numbers across a two- minute test window :
456+
457+ * ??? requests/ second over ` udp`
458+
459+ The benchmark incremented a single counter with two tags in a tight loop, to simulate real- world tag
460+ usage, and the rate- per- second observed on the corresponding Atlas graph matched . The protocol line
461+ was ` 74` characters in length.
462+
463+ The Node .js process CPU usage was ~ 100 % and the ` spectatord` process CPU usage was ~ 55 % on this 8
464+ vCPU system.
Original file line number Diff line number Diff line change 1+ # Performance
2+
3+ ## Test Script
4+
5+ Test maximum single-threaded throughput for two minutes.
6+
7+ ``` python
8+ # !/usr/bin/env python3
9+
10+ import logging
11+ import time
12+
13+ from spectator import Config, Registry
14+
15+ logging.basicConfig(
16+ level = logging.INFO ,
17+ format = ' %(asctime)s - %(name)s - %(levelname)s - %(thread)d - %(message)s '
18+ )
19+
20+ location = " udp"
21+ # location = "unix"
22+ registry = Registry(Config(location))
23+ # add tags with some length, to simulate more real-world conditions
24+ tags = {" location" : location, " version" : " correct-horse-battery-staple" }
25+
26+ max_duration = 2 * 60
27+ start = time.perf_counter()
28+
29+ def elapsed ():
30+ return time.perf_counter() - start
31+
32+ print (f " start spectator-py { location} benchmark " )
33+ iteration = 1
34+ while True :
35+ registry.counter(" spectator-py.publish" , tags).increment()
36+ if iteration % 500000 == 0 :
37+ print (f " iterations= { iteration} elapsed= { elapsed():.2f } " )
38+ if elapsed() > max_duration:
39+ break
40+ iteration += 1
41+
42+ print (f " iterations= { iteration} rate/sec= { iteration/ elapsed():.2f } " )
43+ ```
44+
45+ ## Results
46+
47+ See [ Usage > Performance] ( usage.md#performance ) .
Original file line number Diff line number Diff line change 242242 - Percentile Timer : spectator/lang/go/meters/percentile-timer.md
243243 - Timer : spectator/lang/go/meters/timer.md
244244 - Migrations : spectator/lang/go/migrations.md
245+ - Performance : spectator/lang/go/perf-test.md
245246 - Java :
246247 - Usage : spectator/lang/java/usage.md
247248 - Registry :
283284 - Percentile Timer : spectator/lang/nodejs/meters/percentile-timer.md
284285 - Timer : spectator/lang/nodejs/meters/timer.md
285286 - Migrations : spectator/lang/nodejs/migrations.md
287+ - Performance : spectator/lang/nodejs/perf-test.md
286288 - Python :
287289 - Usage : spectator/lang/py/usage.md
288290 - Meters :
297299 - Percentile Timer : spectator/lang/py/meters/percentile-timer.md
298300 - Timer : spectator/lang/py/meters/timer.md
299301 - Migrations : spectator/lang/py/migrations.md
302+ - Performance : spectator/lang/py/perf-test.md
300303 - Ruby :
301304 - Deprecated : spectator/lang/rb/deprecated.md
302305 - Patterns :
You can’t perform that action at this time.
0 commit comments