Take Control of the Cache Manager

Automatically translated from English

4D v16 introduced a new fully optimized cache manager for the 64-bit product line. 4D v16 R2 is giving power to our advanced 4D developers to take control by themselves!

The cache manager internal algorithm is based on a priority concept associated to each object type to store in the cache memory. By default, the cache manager algorithm assigns a higher priority value for an index than for records. And recently used objects (records or indexes) have a higher priority to remain in the cache than objects that have not been used in the last two days, etc…

From 4D v16 R2, 4D developer can take the control. At startup, you can fine tune the priorities in cache for your tables, indexes and “big objects” depending on your application needs. On top of that, you can even define exceptions for a single process. When there are some specific operations to run, as for instance a large import, the 4D developer is the best to decide what table or index should have the higher priority in cache for a particular time frame.

New commands to control priority

A set of new commands allow very fine adjustments: for each index, each table, even with differences for the main record and the ‘big parts’ (blobs / text  / pictures / objects).

Define at startup the priority for all processes

SET TABLE CACHE PRIORITY
SET INDEX CACHE PRIORITY
SET BLOBS CACHE PRIORITY

Increase or decrease the priority defined on startup for the current process

ADJUST TABLE CACHE PRIORITY
ADJUST INDEX CACHE PRIORITY
ADJUST BLOBS CACHE PRIORITY

Read internal priority value (for debugging purpose only)

Get adjusted table cache priority
Get adjusted index cache priority
Get adjusted blobs cache priority

beware These commands must be used with care since it can affect database performance.

Examples

In the On Startup database method, you want to set a high priority for the [Customer]LastName field indexes:
SET INDEX CACHE PRIORITY([Customer]LastName;Cache priority very high)

You want to temporarily change the cache priority for the [Docs] table text fields stored in the data file when executing a sequential search:
ADJUST BLOBS CACHE PRIORITY([Docs];Cache priority very high)
QUERY([Docs];[Docs]Author#"A@") // sequential search on a non indexed field
// run several other queries or orders on the same table
// when finished, set back to normal cache priority
ADJUST BLOBS CACHE PRIORITY([Docs];Cache priority normal)

For more details, we invite you to take a look at the following article in the 4D v16 R2 documentation.

Caroline Briaud

• 4D Product Team Leader •

Caroline joined 4D SAS in July, 2013 as an Engineering Manager responsible for new features definition. Caroline helped the Engineering team to put in place the R-release concept, with the new development process definition and its application within 4D’s engineering teams.Caroline is now leading the 4D Product team, mainly made up of Product Owners which are representing the customers within Engineering.

Caroline started her career as a software developer in the mobile phone industry. She specialized in program management with an American company in an international context spread across US, India and China.