# `TSO Allocator`
+ Generate the consistent, unique and monotic timestamp for the transaction purpose
  + Never fallback
  + Never be duplicated
  + Guarantee consistency
+ Similar to the `ID Allocator`, but there are some additional optimizations
  + `Snowflake` algorithm: **`physical counter + logical counter`**
  + Pre-allocate a window in memory every 3 seconds to speed up the generation, which could save the reading and writing on `etcd` each time when we handle the `TSO` request
 
| `Unix` timestamp in millisecond (Physical counter) | `18-bit` (Logical counter)                    |
| :------------------------------------------------- | :-------------------------------------------- |
| Keep up with system time                           | Increase with the number of requests          |
| Advance only                                       | Reset each time the physical counter advances |
|                                                    | May overflow to advance the physical counter  |

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

