How long does it take for a 64-bit counter to wrap?

Document ID : KB000023649
Last Modified Date : 14/02/2018
Show Technical Document Details

Question: 

How long does it take for a 64-bit counter to wrap?

Environment:  

N/A

Answer: 

Due to the size of a 64 bit number, the chances of a counter wrapping on a 100Mb/sec link are virtually impossible, and the chances of the counter wrapping on a 1Gb/sec link are highly unlikely. The max value of a 64 bit number is 2 raised to the 64th power. This equates to 18,446,744,073,709,551,615 in decimal format.

 

However we need to note that a 64 bit counter within a MIB is actually counting BYTES not bits  Therefore the total number of bits that are represented by a 64 bit counter is 147,573,952,589,676,412,920 Bits or 147 Quintillion Bits.  All counters reset to 0 when the device is power cycled or reset. Counters should never decrement, they should only increment, or stay the same until the device is reset.  It is unlikely that a 100 Mbps (Megabits Per Second) link could sustain a constant throughput of 100 MB Per Second. 

 

 

100 Mb/sec interface:
     
       18,446,744,073,709,551,615 (Bytes)                    (Max size of a 64 bit counter)

      X                                       8 (Bits per Byte)

     ----------------------------------

    147,573,952,589,676,412,920 (Bits) 

 

    147,573,952,589,676,412,920 (Bits)

      -------------------------------     Divided by        =     1,475,739,525,896 Seconds

                 100,000,000                 (Bits/Sec)

     

       1,475,739,525,896    Seconds

     -----------------------   Divided by      =     17,080,318 Days

                  86,400         (Seconds in a day)

 

      17,080,318 (Days)

       -------------------   Divided by      =     46,795.3

                365            (Days per year) 

                                         

      46,795.3    Years to wrap a 64 bit counter on a 100% utilized 100MB link 

 Some extended math for scale and comparison.

Max Link Speed                               Seconds to wrap               Days to wrap          Years to wrap

100,000,000(100MB)                      1,475,739,525,896            17,080,318                46,795

1,000,000,000(1GB)                        147,573,952,589               1,708,031                 4,679

10,000,000,000(10GB)                     14,757,395,258                 170,803                    467

100,000,000,000(100GB)                  1,475,739,525                   17,080                      46

1,000,000,000,000(1TB)                    147,573,952                      1,708                      4.6 

 

 

Given these values, it is clear that wrapping a 64 bit counter should not be a concern.  If you are experiencing what you perceive to be counter wraps, the more likely case is a bug in the MIB where it is incrementing wildly out of control.  Consult your router or MIB vendor for possible upgrade or patches.