Hi,
Recently we are noticing exceptionally long waits in the range of 30-40 minutes to see the KVM value updates to go live. Creation of KVM is almost instantaneous however subsequently changing a single value from web UI takes forever to reflect in the execution flow.
Is this issue account specific or across the platform?
Thanks,
Solved! Go to Solution.
@naniwadb wrote:
subsequently changing a single value from web UI takes forever to reflect in the execution flow.
Normally you would attach a KeyValueMapOperations policy in the API Proxy to retrieve some value from the KVM. When you do that, you can configure the policy to specify an "Expiry time" .
<KeyValueMapOperations name='KVM-1' mapIdentifier='nameOfMap'>
<Scope>environment</Scope>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs> <!-- LOOK HERE -->
<Get assignTo='variable.to.set'>
<Key>
<Parameter ref='variable.containing.key'>fallback-value</Parameter>
</Key>
</Get>
</KeyValueMapOperations>
Have you specified that expiry time? What is it?
It is expressed in seconds. Have you set it to be 60*30 or 60*60? If it is 3600, then the observed behavior would be expected.
If it is not set, then.... I don't know what it defaults to. I suggest that you set it.
What version of Apigee are you using?
@naniwadb wrote:
subsequently changing a single value from web UI takes forever to reflect in the execution flow.
Normally you would attach a KeyValueMapOperations policy in the API Proxy to retrieve some value from the KVM. When you do that, you can configure the policy to specify an "Expiry time" .
<KeyValueMapOperations name='KVM-1' mapIdentifier='nameOfMap'>
<Scope>environment</Scope>
<ExpiryTimeInSecs>300</ExpiryTimeInSecs> <!-- LOOK HERE -->
<Get assignTo='variable.to.set'>
<Key>
<Parameter ref='variable.containing.key'>fallback-value</Parameter>
</Key>
</Get>
</KeyValueMapOperations>
Have you specified that expiry time? What is it?
It is expressed in seconds. Have you set it to be 60*30 or 60*60? If it is 3600, then the observed behavior would be expected.
If it is not set, then.... I don't know what it defaults to. I suggest that you set it.
What version of Apigee are you using?
Thanks for pointing that out. Using Apigee Edge public.
There is a way to force kvm cache refresh which works as explained.
https://www.googlecloudcommunity.com/gc/Apigee/How-to-refresh-the-KVM-cache-forcefully/td-p/52758
Probably this is going to be very common challenge across kvm operations & building a tool in-house helps managing kvm at will.
https://docs.apigee.com/api-platform/reference/policies/key-value-map-operations-policy
==
* There is no way to manually reset the KVM cache. However, you can create a temporary policy that executes a one-time PUT operation with a short <ExpiryTimeInSecs>. This will reset the cache, which contains the value you PUT, for the number of seconds you specify.
==
yes, thank you for pointing this out.
The reason this is important - the reason it is important to be able to "Reset the cache" - is because changing the policy configuration to use a smaller Time-to-live (TTL) does not reset the cache. This means even if you change your KVM policy to use a smaller expiry, you may still get stale data! The cache is already populated!
Consider this order of events
This is why you may wish to reset your cache. Rather than wait 24 hours, you can just PUT a value (even the same value) via the KVM policy. And use a smaller ExpiryTimeInSecs with the PUT.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |