clockwork icon indicating copy to clipboard operation
clockwork copied to clipboard

Feature: Imporve Cache Collector

Open akalongman opened this issue 4 years ago • 7 comments

We ran a high-loaded project and it is very important to monitor how the application utilizes cache.

I'd suggest to collecting the size of the cache values, something like Str::length(serialize($query['value'])). It can be configurable feature. Also, I'd suggest adding the option for hiding cache values itself but show key names (disabling the collect_queries option disables listing of cache keys as well).

In our server infrastructure bandwidth between the app and Redis servers is the bottleneck, so monitoring cache value sizes during development is very important.

If maintainers are ok with this, I can send PR.

akalongman avatar Jan 16 '21 02:01 akalongman

Hey, thanks for the suggestions!

  • collecting queries without values - makes complete sense, we should add this.
  • collecting size of the values - I need to think a bit more about how useful this is and how it would be presented.

If you'd still like to work on a PR, I'd accept one for the first part for now. Otherwise I'll look into adding this for the next minor release.

itsgoingd avatar Feb 28 '21 16:02 itsgoingd

This is now merged and will be released as part of Clockwork 5.1, I ended up flipping the config option logic (exclude_results -> collect_values) and making it to not collect values by default.

itsgoingd avatar May 15 '21 21:05 itsgoingd

@itsgoingd what do you think about collecting the cache value sizes? It's very important for high-loaded projects.

akalongman avatar May 17 '21 11:05 akalongman

Oops, forgot about that part. I think it definitively makes sense, adding it as a separate feature-request to the 5.1 todo-list.

itsgoingd avatar May 17 '21 19:05 itsgoingd

Interface part will be difficult for me. As I know, UI is already built and I don't know how to change UI components. I can easy return size data from backend, but how to display in UI?

akalongman avatar May 17 '21 21:05 akalongman

The UI is a separate Vue SPA, which can be found here - https://github.com/underground-works/clockwork-app

If you'd like to work on this feel free to join our Discord, I can offer some real-time guidance there. But if you'd rather not get into that, I can also do this myself, just let me know. :)

Btw. do you have any ideas on how you would handle non-string cache values?

itsgoingd avatar May 22 '21 14:05 itsgoingd

@itsgoingd I'll do the backend stuff, VueJS part I leave for you :) Non string values should be serialized first and counted as a bytes.

akalongman avatar May 22 '21 15:05 akalongman