FrankChen021 / bithon

An observability platform mainly for Java
Apache License 2.0
14 stars 4 forks source link

improve the storage size #789

Open FrankChen021 opened 1 month ago

FrankChen021 commented 1 month ago

the span id has a very low compression ratio.


┌─column────────┬─compressedSize─┬─uncompressedSize─┬─compressRatio(%)─┬────rowsCount─┬─avgUncompressedSize─┐
 1. │ spanId        │ 10.49 TiB      │ 10.79 TiB        │               97 │ 698500275565 │                  17 │
 2. │ attributes    │ 3.07 TiB       │ 38.86 TiB        │                8 │ 698500275565 │                  61 │
 3. │ parentSpanId  │ 2.17 TiB       │ 10.64 TiB        │               20 │ 698500275565 │                  17 │
 4. │ costTimeMs    │ 2.00 TiB       │ 5.08 TiB         │               39 │ 698500275565 │                   8 │
 5. │ startTimeUs   │ 1.26 TiB       │ 5.08 TiB         │               25 │ 698500275565 │                   8 │
 6. │ endTimeUs     │ 958.54 GiB     │ 5.08 TiB         │               18 │ 698500275565 │                   8 │
 7. │ timestamp     │ 560.40 GiB     │ 5.08 TiB         │               11 │ 698500275565 │                   8 │
 8. │ traceId       │ 402.19 GiB     │ 20.96 TiB        │                2 │ 698500275565 │                  33 │
 9. │ instanceName  │ 288.77 GiB     │ 40.96 TiB        │                1 │ 698500275565 │                  64 │
10. │ method        │ 144.28 GiB     │ 9.27 TiB         │                2 │ 698500275565 │                  15 │
11. │ appName       │ 102.80 GiB     │ 15.02 TiB        │                1 │ 698500275565 │                  24 │
12. │ clazz         │ 100.05 GiB     │ 4.27 TiB         │                2 │ 698500275565 │                   7 │
13. │ kind          │ 72.14 GiB      │ 5.67 TiB         │                1 │ 698500275565 │                   9 │
14. │ name          │ 52.56 GiB      │ 906.71 GiB       │                6 │ 698500275565 │                   1 │
15. │ status        │ 46.55 GiB      │ 2.46 TiB         │                2 │ 698500275565 │                   4 │
16. │ normalizedUrl │ 27.52 GiB      │ 179.91 GiB       │               15 │ 698500275565 │                   0 │
17. │ tags          │ 14.62 MiB      │ 1.35 GiB         │                1 │ 698500275565 │                   0 │
    └───────────────┴────────────────┴──────────────────┴──────────────────┴──────────────┴─────────────────────┘
  1. the traceId can be improved by using uuid v7
  2. how about other fields?
FrankChen021 commented 1 month ago

different formats with 65,409 entries.

┌─format───┬───────bytes───┐
│ uuidv4   │       2363078 │
│ uuidv7   │        826828 │
│ uuidv7_1 │        365896 │
│ uuidv7_n │        816234 │
└──────────┴───────────────┘
FrankChen021 commented 1 month ago
    ┌─column────────┬─compressedSize─┬─uncompressedSize─┬─compressRatio(%)─┬───rowsCount─┬─avgUncompressedSize─┐
 1. │ traceId       │ 368.76 GiB     │ 407.22 GiB       │               91 │ 13264022063 │                  33 │
 2. │ attributes    │ 232.44 GiB     │ 4.07 TiB         │                6 │ 13264022063 │                 337 │
 3. │ spanId        │ 152.86 GiB     │ 209.76 GiB       │               73 │ 13264022063 │                  17 │
 4. │ parentSpanId  │ 86.75 GiB      │ 95.87 GiB        │               90 │ 13264022063 │                   8 │
 5. │ endTimeUs     │ 66.39 GiB      │ 98.72 GiB        │               67 │ 13264022063 │                   8 │
 6. │ startTimeUs   │ 65.90 GiB      │ 98.72 GiB        │               67 │ 13264022063 │                   8 │
 7. │ timestamp     │ 49.45 GiB      │ 98.72 GiB        │               50 │ 13264022063 │                   8 │
 8. │ costTimeMs    │ 45.65 GiB      │ 98.72 GiB        │               46 │ 13264022063 │                   8 │
 9. │ normalizedUrl │ 4.05 GiB       │ 136.08 GiB       │                3 │ 13264022063 │                  11 │
10. │ clazz         │ 2.67 GiB       │ 456.43 GiB       │                1 │ 13264022063 │                  37 │
11. │ instanceName  │ 1.78 GiB       │ 379.35 GiB       │                0 │ 13264022063 │                  31 │
12. │ name          │ 1.51 GiB       │ 127.09 GiB       │                1 │ 13264022063 │                  10 │
13. │ method        │ 1.49 GiB       │ 82.35 GiB        │                2 │ 13264022063 │                   7 │
14. │ appName       │ 1.21 GiB       │ 277.60 GiB       │                0 │ 13264022063 │                  22 │
15. │ kind          │ 387.87 MiB     │ 86.39 GiB        │                0 │ 13264022063 │                   7 │
16. │ status        │ 288.08 MiB     │ 49.36 GiB        │                1 │ 13264022063 │                   4 │
17. │ tags          │ 6.47 MiB       │ 18.28 MiB        │               35 │ 13264022063 │                   0 │
    └───────────────┴────────────────┴──────────────────┴──────────────────┴─────────────┴─────────────────────┘

Apply TSID to span id and add span id to order by to reduce the size