Action & WebServices cache  behavior on multiple front-end hubservers.

Action & WebServices cache  behavior on multiple front-end hubservers.

  
Hi guys,

In a multiple front-end server infrastructure how does the platform manages the Action and WebServices cache behavior?

For example, My front-end servers:
HUBSERVER001
HUBSERVER002
HUBSERVER003

Public Action GetUserDetails (with 20 minutes cache)

On my first call of GetUserDetails, with the input parameter Username="rp_outsystems", I'll assume that this request was processed by the HUBSERVER001. 
HUBSERVER001 will retrieve the necessary data and "cache it" on local ASP.NET Cache (Correct?!) 

Two minutes later, another call to the same action with the same input parameter, but now being processed by HUBSERVER002.

How does the platform reacts?
a) The platorm will retrieve all the necessary data again and now will "cache it" on HUBSERVER002
b) The platform will retrieve the cached result from HUBSERVER001 ASP.NET Cache?

Regards, 
Rafael Pereira
 
Hi Rafael

As documented on the Service Studio help topic About Caching Contents, there's an in-memory cache per each Front-end,w chih means that if the query was first executed on HUBSERVER001, when executed with the same input paramters on front-end HUBSERVER002 it will be executed again against the database engine, and then cached on HUBSERVER002.

As you say, the cache is local, and is not shared between servers, so answering to your question, the platform will retrieve the data again from the database and cache it on HUBSERVER002.

Going a little deeper ont he cache architecture, the cache isn't just saved locally at the front-end level, but at the worker process level within IIS. This means that if you have the same application being server by multiple worker processes (alas, not recommended by OutSystems), you'll have 2 caches, and when the query first executes on one worker process, the cache will not be available on the other worker process.

With this in mind, in order to take maximum advantage of Agile Platform cache and achieve maximum performance on the applications, make sure that each application runs only on one worker process (no web garden), and if using load balancer activate the sticky session per front-end, to minimize the number of query executions within the same user session.

Cheers

Miguel Simões João