Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Need to decrease allocations inside Helios reactors #75

Closed
Aaronontheweb opened this issue Apr 13, 2016 · 3 comments
Closed

Need to decrease allocations inside Helios reactors #75

Aaronontheweb opened this issue Apr 13, 2016 · 3 comments

Comments

@Aaronontheweb
Copy link
Member

Some specs fresh off the build server for the dev branch:

Helios.Tests.Performance.Socket.TcpThroughputSpec+OneWayThroughputBenchmark

Tests a full request/response sequence for 1000 messages
4/13/2016 1:06:35 AM

System Info

NBench=NBench, Version=0.2.1.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=4
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=4

NBench Settings

RunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01

Data


Totals

Metric Units Max Average Min StdDev
TotalBytesAllocated bytes 2,702,000.00 2,632,565.54 2,620,128.00 21,170.43
TotalCollections [Gen0] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen1] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen2] collections 0.00 0.00 0.00 0.00
[Counter] MessagesReceived operations 1,000.00 1,000.00 1,000.00 0.00

Per-second Totals

Metric Units / s Max / s Average / s Min / s StdDev / s
TotalBytesAllocated bytes 293,906,498.14 284,017,997.22 260,700,740.08 8,730,090.93
TotalCollections [Gen0] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen1] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen2] collections 0.00 0.00 0.00 0.00
[Counter] MessagesReceived operations 109,933.60 107,882.67 99,339.39 3,068.69

Raw Data

TotalBytesAllocated

Run # bytes bytes / s ns / bytes
1 2,624,928.00 288,396,580.90 3.47
2 2,632,736.00 288,686,689.26 3.46
3 2,632,368.00 288,178,663.31 3.47
4 2,628,328.00 287,161,087.32 3.48
5 2,625,344.00 283,508,347.55 3.53
6 2,624,344.00 260,700,740.08 3.84
7 2,626,480.00 277,303,489.42 3.61
8 2,626,336.00 284,287,801.87 3.52
9 2,624,952.00 288,329,525.48 3.47
10 2,702,000.00 293,906,498.14 3.40
11 2,624,152.00 288,482,476.58 3.47
12 2,631,256.00 289,053,718.55 3.46
13 2,620,128.00 274,238,345.44 3.65

TotalCollections [Gen0]

Run # collections collections / s ns / collections
1 0.00 0.00 9,101,800.00
2 0.00 0.00 9,119,700.00
3 0.00 0.00 9,134,500.00
4 0.00 0.00 9,152,800.00
5 0.00 0.00 9,260,200.00
6 0.00 0.00 10,066,500.00
7 0.00 0.00 9,471,500.00
8 0.00 0.00 9,238,300.00
9 0.00 0.00 9,104,000.00
10 0.00 0.00 9,193,400.00
11 0.00 0.00 9,096,400.00
12 0.00 0.00 9,103,000.00
13 0.00 0.00 9,554,200.00

TotalCollections [Gen1]

Run # collections collections / s ns / collections
1 0.00 0.00 9,101,800.00
2 0.00 0.00 9,119,700.00
3 0.00 0.00 9,134,500.00
4 0.00 0.00 9,152,800.00
5 0.00 0.00 9,260,200.00
6 0.00 0.00 10,066,500.00
7 0.00 0.00 9,471,500.00
8 0.00 0.00 9,238,300.00
9 0.00 0.00 9,104,000.00
10 0.00 0.00 9,193,400.00
11 0.00 0.00 9,096,400.00
12 0.00 0.00 9,103,000.00
13 0.00 0.00 9,554,200.00

TotalCollections [Gen2]

Run # collections collections / s ns / collections
1 0.00 0.00 9,101,800.00
2 0.00 0.00 9,119,700.00
3 0.00 0.00 9,134,500.00
4 0.00 0.00 9,152,800.00
5 0.00 0.00 9,260,200.00
6 0.00 0.00 10,066,500.00
7 0.00 0.00 9,471,500.00
8 0.00 0.00 9,238,300.00
9 0.00 0.00 9,104,000.00
10 0.00 0.00 9,193,400.00
11 0.00 0.00 9,096,400.00
12 0.00 0.00 9,103,000.00
13 0.00 0.00 9,554,200.00

[Counter] MessagesReceived

Run # operations operations / s ns / operations
1 1,000.00 109,868.38 9,101.80
2 1,000.00 109,652.73 9,119.70
3 1,000.00 109,475.07 9,134.50
4 1,000.00 109,256.18 9,152.80
5 1,000.00 107,989.03 9,260.20
6 1,000.00 99,339.39 10,066.50
7 1,000.00 105,579.90 9,471.50
8 1,000.00 108,245.02 9,238.30
9 1,000.00 109,841.83 9,104.00
10 1,000.00 108,773.69 9,193.40
11 1,000.00 109,933.60 9,096.40
12 1,000.00 109,853.89 9,103.00
13 1,000.00 104,666.01 9,554.20
@Aaronontheweb
Copy link
Member Author

Throughput is reasonable, but not great, at 100k messages per second.

But the number that concerns me is memory allocation, sitting at 2,624,928.00 bytes per 1000 messages. That includes both sending and receiving of the message.... But the other part that's a bit scary is that there's no observable garbage collection at all, whcih leads me to believe there might be a memory leak.

It's possible that this is just the result of Helios expanding its receive buffer, but I doubt it.

Either way, about damn time we had NBench coverage for this project.

@Aaronontheweb
Copy link
Member Author

UDP results are similar

Helios.Tests.Performance.Socket.UdpThroughputSpec+OneWayThroughputBenchmark

Tests a full request/response sequence for 1000 messages
4/13/2016 1:06:36 AM

System Info

NBench=NBench, Version=0.2.1.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=4
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=4

NBench Settings

RunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01

Data


Totals

Metric Units Max Average Min StdDev
TotalBytesAllocated bytes 2,683,304.00 2,621,415.38 2,594,768.00 22,950.99
TotalCollections [Gen0] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen1] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen2] collections 0.00 0.00 0.00 0.00
[Counter] MessagesReceived operations 1,000.00 1,000.00 1,000.00 0.00

Per-second Totals

Metric Units / s Max / s Average / s Min / s StdDev / s
TotalBytesAllocated bytes 296,714,067.72 284,466,083.54 273,768,026.26 6,026,048.40
TotalCollections [Gen0] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen1] collections 0.00 0.00 0.00 0.00
TotalCollections [Gen2] collections 0.00 0.00 0.00 0.00
[Counter] MessagesReceived operations 111,282.98 108,515.75 104,880.07 2,063.00

Raw Data

TotalBytesAllocated

Run # bytes bytes / s ns / bytes
1 2,619,344.00 277,284,891.60 3.61
2 2,647,944.00 280,805,955.59 3.56
3 2,611,552.00 285,640,285.25 3.50
4 2,602,200.00 285,755,073.36 3.50
5 2,610,296.00 273,768,026.26 3.65
6 2,632,584.00 286,855,100.57 3.49
7 2,608,960.00 276,610,227.00 3.62
8 2,683,304.00 296,714,067.72 3.37
9 2,622,592.00 286,262,293.29 3.49
10 2,594,768.00 288,753,519.32 3.46
11 2,610,552.00 286,921,140.85 3.49
12 2,621,992.00 287,111,899.52 3.48
13 2,612,312.00 285,576,605.63 3.50

TotalCollections [Gen0]

Run # collections collections / s ns / collections
1 0.00 0.00 9,446,400.00
2 0.00 0.00 9,429,800.00
3 0.00 0.00 9,142,800.00
4 0.00 0.00 9,106,400.00
5 0.00 0.00 9,534,700.00
6 0.00 0.00 9,177,400.00
7 0.00 0.00 9,431,900.00
8 0.00 0.00 9,043,400.00
9 0.00 0.00 9,161,500.00
10 0.00 0.00 8,986,100.00
11 0.00 0.00 9,098,500.00
12 0.00 0.00 9,132,300.00
13 0.00 0.00 9,147,500.00

TotalCollections [Gen1]

Run # collections collections / s ns / collections
1 0.00 0.00 9,446,400.00
2 0.00 0.00 9,429,800.00
3 0.00 0.00 9,142,800.00
4 0.00 0.00 9,106,400.00
5 0.00 0.00 9,534,700.00
6 0.00 0.00 9,177,400.00
7 0.00 0.00 9,431,900.00
8 0.00 0.00 9,043,400.00
9 0.00 0.00 9,161,500.00
10 0.00 0.00 8,986,100.00
11 0.00 0.00 9,098,500.00
12 0.00 0.00 9,132,300.00
13 0.00 0.00 9,147,500.00

TotalCollections [Gen2]

Run # collections collections / s ns / collections
1 0.00 0.00 9,446,400.00
2 0.00 0.00 9,429,800.00
3 0.00 0.00 9,142,800.00
4 0.00 0.00 9,106,400.00
5 0.00 0.00 9,534,700.00
6 0.00 0.00 9,177,400.00
7 0.00 0.00 9,431,900.00
8 0.00 0.00 9,043,400.00
9 0.00 0.00 9,161,500.00
10 0.00 0.00 8,986,100.00
11 0.00 0.00 9,098,500.00
12 0.00 0.00 9,132,300.00
13 0.00 0.00 9,147,500.00

[Counter] MessagesReceived

Run # operations operations / s ns / operations
1 1,000.00 105,860.43 9,446.40
2 1,000.00 106,046.79 9,429.80
3 1,000.00 109,375.68 9,142.80
4 1,000.00 109,812.88 9,106.40
5 1,000.00 104,880.07 9,534.70
6 1,000.00 108,963.32 9,177.40
7 1,000.00 106,023.18 9,431.90
8 1,000.00 110,577.88 9,043.40
9 1,000.00 109,152.43 9,161.50
10 1,000.00 111,282.98 8,986.10
11 1,000.00 109,908.23 9,098.50
12 1,000.00 109,501.44 9,132.30
13 1,000.00 109,319.49 9,147.50

@Aaronontheweb
Copy link
Member Author

Done, fixed as part of 2.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant