query to check the Cassandra db if cache policy used is working or not

Not applicable

Hi, I need to check if the caching policy used is working or not in production environment. i will not be able to check by enabling trace, I have access to cassandra DB, could you please help me with the query to check if cache is working or not? or is there any alternate way i can find if cache is working without enabling the trace?

1 5 424
5 REPLIES 5

Hi @dll, I do not know how to check directly in Cassandra but maybe we can use LookUpCache policy to retrieve cache data, Retrieved data will be assigned to a flow variable which you Set Payload in Assign Message or Javascript Policy.

Give it a try.

-edit-

We can also use the below flow variable(as a Condition for someother policy) to check cache hit to detect if the data was found in cache or not.

lookupcache.{policy-name}.cachehit
BooleanRead-OnlyTrue if the policy found a value for the specified cache key.

Hi Siddharth,

Thanks for your reply.

I only have read access to production environment and tracing is disabled. I cannot alter/modify anything in the code, with just access to Cassandra. are there any ways to find if cache is working or not?

Thanks,

Murugan

+ @AMAR DEVEGOWDA any inputs?

@dll,

The cache policies (LookUpCache or ResponseCache) can fetch the information from L1 cache (Message Processor) or L2 cache (Cassandra node). There's no query that gives the information on whether the data was fetched from Cassandra or not.

On top of what @Siddharth Barahalikar has already said, I could think of another way through which you can try to check if the cache policy was used or not.

If you are on Private Cloud, you can analyse the Nginx Router Access logs and check the field "request_time" to understand what's the round trip time of the API request on the routers. If the cache policy is used in the API Proxy, then the "request_time" should be smaller for such API requests compared to those requests where the cache policy was not used. This is because if the cache policy is not used, then the data has to be regenerated within the API Proxy or fetched from a backend server which will increase the time taken the process the request.

This may not be accurate, but this is another possible way to figure out if cache policy was used or not.

Hi @AMAR DEVEGOWDA, I have an question related to Cassandra.

Is it possible for OPDK users to fetch any other info/data/tables from Cassandra DB using Cassandra CQL commands?