Background
Our clients are using some proxy endpoints which call a Target endpoint using the Service Callout policy. I am using Lookup Cache and populate Cache policies before and after a Service Callout policy. Cache expires in 1 hour. The Service Callout policy makes the target endpoint request ( takes ~ 500msec ) when there is a cache miss otherwise the Lookup Cache policy returns from cache ( a cache hit within the hour ). Scope of the is global. Key space is not huge. May be around 200 unique cache keys.
Problem
I am trying to reduce response times for our clients. One way to possibly achieve this - is by eliminating the call to the target endpoint ( via Service Callout policy ) when our clients call these proxy endpoints. Basically always resulting in a cache hit.
Possible Solution?
Since its scope is global, I could then write a script ( batch hourly cron job ) which force refreshes this global cache for each . This will always trigger a cache hit for our clients. Do you think this solution will work? Comments? Better alternatives?
Prefetch the cache for all possible cache entries by writing a batch script to hit the APIs (As you have mentioned). This does work well.
A step improvement can be made by using API-DN setup. Where your APIs would be deployed across multiple geographies. Your client would be served from the closest server to their location. As Apigee uses distributed cache there is no need to populate cache for each Message Processor node.