FID StructureNFX Class Library

[This is preliminary documentation and is subject to change.]

Represents an ultra-efficient 64 bit in-process-wide unique identifier "Fast Id". The ID is going to wrap-around after at least 2 weeks (19 days). The ID consists of 3 segments: [timestamp: 24bit][threadseed: 24bit][counter: 16 bit]. This is needed because: a). FID stays unique after process restarts b). This design does not use interlock on global seed, but uses thread-static vars which is 10-20 times faster The timestamp is the number of 100ms intervals elapsed since Jan 1 2015 expressed as a 24 bit unsigned int, which gives 2^24 = 16,777,216 combinations which covers 19 days (around 2 weeks) at 100 msec resolution, consequently the ID will generate duplicates after this period. This struct is useful for creating unique IDs for protocol/traffic messages that live for a limited time (no more than 2 weeks). Caution: This ID does not identify the machine or process, only items within the process, however when a hosting process restarts(i.e. crash or reboot) the new IDs will not collide with IDs generated right before the crash for at least 14 days (14 day sliding window). In a parallel test on 6 Core i7 3.2 GHz this class generates 405 million IDs/sec, which is 57 times faster than Guid that only generates 7 million IDs/sec

Namespace: NFX
Assembly: NFX (in NFX.dll) Version: 3.0.0.1 (3.0.0.1)
Syntax

[SerializableAttribute]
public struct FID : IEquatable<FID>, IDistributedStableHashProvider
See Also