Skip to content

Instantly share code, notes, and snippets.

@FZambia
Last active August 29, 2015 14:27
Show Gist options
  • Save FZambia/a633db063417eed0c3fb to your computer and use it in GitHub Desktop.
Save FZambia/a633db063417eed0c3fb to your computer and use it in GitHub Desktop.
go1.4 vs go1.5 for Centrifugo

GO 1.4

GOMAXPROCS=2

MacAir:benchmarks fz$ go run benchmark.go ws://localhost:8000/connection/websocket development secret 4000 1000 50
1440097030
max clients: 4000
increment: 1000
repeat: 50
1000	13766803
2000	22123527
3000	35639873
4000	46682587

GOMAXPROCS=1

MacAir:benchmarks fz$ go run benchmark.go ws://localhost:8000/connection/websocket development secret 4000 1000 50
1440097116
max clients: 4000
increment: 1000
repeat: 50
1000	17963808
2000	33313815
3000	48047857
4000	63248484
BenchmarkSendReceive	  500000	      2814 ns/op
--- BENCH: BenchmarkSendReceive
	application_test.go:215: Chans:200, Clnts:50 Msgs:1 Rcvd:3
	application_test.go:215: Chans:200, Clnts:50 Msgs:100 Rcvd:300
	application_test.go:215: Chans:200, Clnts:50 Msgs:10000 Rcvd:25000
	application_test.go:217: 861770 messages/sec
	application_test.go:215: Chans:200, Clnts:50 Msgs:500000 Rcvd:311738
	application_test.go:217: 221552 messages/sec
	
BenchmarkSendReceive-2	 1000000	      1831 ns/op
--- BENCH: BenchmarkSendReceive-2
	application_test.go:215: Chans:200, Clnts:50 Msgs:1 Rcvd:3
	application_test.go:215: Chans:200, Clnts:50 Msgs:100 Rcvd:300
	application_test.go:215: Chans:200, Clnts:50 Msgs:10000 Rcvd:25024
	application_test.go:217: 1470781 messages/sec
	application_test.go:215: Chans:200, Clnts:50 Msgs:1000000 Rcvd:588062
	application_test.go:217: 321039 messages/sec

BenchmarkSubHubBroadCast	 1000000	      2590 ns/op
--- BENCH: BenchmarkSubHubBroadCast
	hubs_test.go:169: Chans:100, Msgs:1, Rcvd:5
	hubs_test.go:169: Chans:100, Msgs:100, Rcvd:500
	hubs_test.go:169: Chans:100, Msgs:10000, Rcvd:50000
	hubs_test.go:171: 2661019 messages/sec
	hubs_test.go:169: Chans:100, Msgs:1000000, Rcvd:5000000
	hubs_test.go:171: 1930110 messages/sec
	
BenchmarkSubHubBroadCast-2	 1000000	      1884 ns/op
--- BENCH: BenchmarkSubHubBroadCast-2
	hubs_test.go:169: Chans:100, Msgs:1, Rcvd:5
	hubs_test.go:169: Chans:100, Msgs:100, Rcvd:500
	hubs_test.go:169: Chans:100, Msgs:10000, Rcvd:50000
	hubs_test.go:171: 2522097 messages/sec
	hubs_test.go:169: Chans:100, Msgs:1000000, Rcvd:4992390
	hubs_test.go:171: 2648509 messages/sec

POST 10000 publish messages in one request:

[I]: 2015/08/21 09:41:12 handlers.go:321: POST /api/development from [::1]:52352 completed in 304.098556ms
[I]: 2015/08/21 09:41:14 handlers.go:321: POST /api/development from [::1]:52354 completed in 313.17164ms
[I]: 2015/08/21 09:41:15 handlers.go:321: POST /api/development from [::1]:52355 completed in 304.435964ms
[I]: 2015/08/21 09:41:16 handlers.go:321: POST /api/development from [::1]:52356 completed in 310.000163ms

GO 1.5

GOMAXPROCS=2

MacAir:benchmarks fz$ go run benchmark.go ws://localhost:8000/connection/websocket development secret 4000 1000 50
1440097430
max clients: 4000
increment: 1000
repeat: 50
1000	11501515
2000	22515083
3000	34552035
4000	47471538

GOMAXPROCS=1

MacAir:benchmarks fz$ go run benchmark.go ws://localhost:8000/connection/websocket development secret 4000 1000 50
1440097522
max clients: 4000
increment: 1000
repeat: 50
1000	20424042
2000	38836450
3000	56716626
4000	81171500
BenchmarkSendReceive      	  200000	     10725 ns/op
--- BENCH: BenchmarkSendReceive
	application_test.go:215: Chans:200, Clnts:50 Msgs:1 Rcvd:3
	application_test.go:215: Chans:200, Clnts:50 Msgs:100 Rcvd:300
	application_test.go:215: Chans:200, Clnts:50 Msgs:10000 Rcvd:25000
	application_test.go:217: 366176 messages/sec
	application_test.go:215: Chans:200, Clnts:50 Msgs:200000 Rcvd:500000
	application_test.go:217: 233089 messages/sec
	
BenchmarkSendReceive-2    	 1000000	      6759 ns/op
--- BENCH: BenchmarkSendReceive-2
	application_test.go:215: Chans:200, Clnts:50 Msgs:1 Rcvd:3
	application_test.go:215: Chans:200, Clnts:50 Msgs:100 Rcvd:300
	application_test.go:215: Chans:200, Clnts:50 Msgs:10000 Rcvd:25040
	application_test.go:217: 1387132 messages/sec
	application_test.go:215: Chans:200, Clnts:50 Msgs:1000000 Rcvd:2500060
	application_test.go:217: 369835 messages/sec

BenchmarkSubHubBroadCast  	 1000000	      2164 ns/op
--- BENCH: BenchmarkSubHubBroadCast
	hubs_test.go:169: Chans:100, Msgs:1, Rcvd:5
	hubs_test.go:169: Chans:100, Msgs:100, Rcvd:500
	hubs_test.go:169: Chans:100, Msgs:10000, Rcvd:50000
	hubs_test.go:171: 2830285 messages/sec
	hubs_test.go:169: Chans:100, Msgs:1000000, Rcvd:5000000
	hubs_test.go:171: 2310375 messages/sec
	
BenchmarkSubHubBroadCast-2	 1000000	      1280 ns/op
--- BENCH: BenchmarkSubHubBroadCast-2
	hubs_test.go:169: Chans:100, Msgs:1, Rcvd:5
	hubs_test.go:169: Chans:100, Msgs:100, Rcvd:483
	hubs_test.go:169: Chans:100, Msgs:10000, Rcvd:49774
	hubs_test.go:169: Chans:100, Msgs:1000000, Rcvd:4994635
	hubs_test.go:171: 3900698 messages/sec

POST 10000 publish messages in one request:

[I]: 2015/08/21 09:40:54 handlers.go:321: POST /api/development from [::1]:52335 completed in 288.470761ms
[I]: 2015/08/21 09:40:55 handlers.go:321: POST /api/development from [::1]:52336 completed in 277.087397ms
[I]: 2015/08/21 09:40:56 handlers.go:321: POST /api/development from [::1]:52337 completed in 270.007991ms
[I]: 2015/08/21 09:40:57 handlers.go:321: POST /api/development from [::1]:52338 completed in 263.476388ms
[I]: 2015/08/21 09:40:58 handlers.go:321: POST /api/development from [::1]:52339 completed in 286.592022ms
[I]: 2015/08/21 09:40:59 handlers.go:321: POST /api/development from [::1]:52340 completed in 269.098248ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment