Using https://github.com/dgraph-io/ristretto we can have a TTL cache for payloads, up to a certain configured size. Or we can make a custom one ourselves with a btree and a cost counter.
We will need to check this before checking the taskDB if enabled.
The purpose is that up to a configured working set of memory, we can keep the payload in memory since the task should be relatively short lived.
We can make a few rules that determine whether a payload should go in the cache:
It was not delayed (enqueue, nack)
The payload is smaller than some max cached payload size
We need to add configuration for:
Size of the cache in MB (0 disables payload cache)
TTL of the cache
We should still require that an enqueue is committed to the TaskDB before returning the request though
Using https://github.com/dgraph-io/ristretto we can have a TTL cache for payloads, up to a certain configured size. Or we can make a custom one ourselves with a btree and a cost counter.
We will need to check this before checking the taskDB if enabled.
The purpose is that up to a configured working set of memory, we can keep the payload in memory since the task should be relatively short lived.
We can make a few rules that determine whether a payload should go in the cache:
We need to add configuration for:
We should still require that an enqueue is committed to the TaskDB before returning the request though