Use Environment.TickCount instead of DateTime{Offset}.UtcNow in SocketsHttpHandler by stephentoub · Pull Request #35401 · dotnet/corefx (original) (raw)
We don't need the accuracy of UtcNow nor the absolute time when getting a time stamp in order to determine whether a connection should be retired; rather, we only need an approximate difference in time. This means the resolution of TickCount is fine, and the worst that happens if a connection happens to be alive for more than its ~49 day period is we may allow the connection to then live even longer than we otherwise would. In exchange, we get a much cheaper mechanism (~20x on Windows) mechanism for computing the connection age.
cc: @geoffkizer
…tsHttpHandler
We don't need the accuracy of UtcNow nor the absolute time when getting a time stamp in order to determine whether a connection should be retired; rather, we only need an approximate difference in time. This means the resolution of TickCount is fine, and the worst that happens if a connection happens to be alive for more than its 49 day period is we may allow the connection to then live even longer than we otherwise would. In exchange, we get a much cheaper mechanism (20x on Windows) mechanism for computing the connection age.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request
…tsHttpHandler (dotnet/corefx#35401)
We don't need the accuracy of UtcNow nor the absolute time when getting a time stamp in order to determine whether a connection should be retired; rather, we only need an approximate difference in time. This means the resolution of TickCount is fine, and the worst that happens if a connection happens to be alive for more than its 49 day period is we may allow the connection to then live even longer than we otherwise would. In exchange, we get a much cheaper mechanism (20x on Windows) mechanism for computing the connection age.
Commit migrated from dotnet/corefx@dca3972