mgtv-tech / jetcache-go

Universal cache framework for Go
BSD 2-Clause "Simplified" License
245 stars 22 forks source link

perf-statslogger: Optimize cache stats logging for improved efficiency and readability. #33

Closed daoshenzzg closed 3 weeks ago

daoshenzzg commented 3 weeks ago

Before

2024/09/25 18:51:02.181802 statslogger.go:178: [INFO] jetcache-go stats last 1ms.
cache                   |         qpm|   hit_ratio|         hit|        miss|       query|  query_fail
------------------------+------------+------------+------------+------------+------------+------------
test_lang_cache_1       |           2|      50.00%|           1|           1|           1|           1|
test_lang_cache_1_local |           2|      50.00%|           1|           1|           -|           -|
test_lang_cache_1_remote|           2|      50.00%|           1|           1|           -|           -|
------------------------+------------+------------+------------+------------+------------+------------
2024/09/25 18:51:02.181806 statslogger.go:178: [INFO] jetcache-go stats last 1ms.
cache                   |         qpm|   hit_ratio|         hit|        miss|       query|  query_fail
------------------------+------------+------------+------------+------------+------------+------------
test_lang_cache_0       |           2|      50.00%|           1|           1|           1|           1|
test_lang_cache_0_local |           2|      50.00%|           1|           1|           -|           -|
test_lang_cache_0_remote|           2|      50.00%|           1|           1|           -|           -|
------------------------+------------+------------+------------+------------+------------+------------
2024/09/25 18:51:02.182061 statslogger.go:178: [INFO] jetcache-go stats last 1ms.
cache     |         qpm|   hit_ratio|         hit|        miss|       query|  query_fail
----------+------------+------------+------------+------------+------------+------------
any       |           2|      50.00%|           1|           1|           1|           1|
any_local |           2|      50.00%|           1|           1|           -|           -|
any_remote|           2|      50.00%|           1|           1|           -|           -|
----------+------------+------------+------------+------------+------------+------------
2024/09/25 18:51:02.182075 statslogger.go:178: [INFO] jetcache-go stats last 1ms.
cache                   |         qpm|   hit_ratio|         hit|        miss|       query|  query_fail
------------------------+------------+------------+------------+------------+------------+------------
test_lang_cache_2       |           2|      50.00%|           1|           1|           1|           1|
test_lang_cache_2_local |           2|      50.00%|           1|           1|           -|           -|
test_lang_cache_2_remote|           2|      50.00%|           1|           1|           -|           -|
------------------------+------------+------------+------------+------------+------------+------------

After

2024/09/25 18:45:49 jetcache-go stats last 1ms.
cache                   |         qpm|   hit_ratio|         hit|        miss|       query|  query_fail
------------------------+------------+------------+------------+------------+------------+------------
any                     |           2|      50.00%|           1|           1|           1|           1
any_local               |           2|      50.00%|           1|           1|           -|           -
any_remote              |           2|      50.00%|           1|           1|           -|           -
test_lang_cache_0       |           2|      50.00%|           1|           1|           1|           1
test_lang_cache_0_local |           2|      50.00%|           1|           1|           -|           -
test_lang_cache_0_remote|           2|      50.00%|           1|           1|           -|           -
test_lang_cache_1       |           2|      50.00%|           1|           1|           1|           1
test_lang_cache_1_local |           2|      50.00%|           1|           1|           -|           -
test_lang_cache_1_remote|           2|      50.00%|           1|           1|           -|           -
test_lang_cache_2       |           2|      50.00%|           1|           1|           1|           1
test_lang_cache_2_local |           2|      50.00%|           1|           1|           -|           -
test_lang_cache_2_remote|           2|      50.00%|           1|           1|           -|           -
------------------------+------------+------------+------------+------------+------------+------------
daoshenzzg commented 3 weeks ago

done