4D Blog

Home Events LR presents the new Cache Manager at 4D Summit 2016

LR presents the new Cache Manager at 4D Summit 2016

March 3, 2017

Events

Cache management is actually a key element of the database management, Laurent Ribardière presents at 4D Summit Portland 2016 the new cache manager he implemented in the 4D v16 64-bit version.

Before watching the technical presentation with details about the implementation, we recommend to start with these two blog posts, describing the feature benefit itself:

New Cache Manager for better performance
Take control of the Cache Manager

 

Behavior of Cache Manager in previous versions

Up to 4D v16, the cache used to be split into 4 large blocks of same size. For instance, a cache of 4 GB used to be split into four blocks of 1 GB each. Basically objects are allocated in one of the block and whenever memory space is needed, in order to avoid fragmentation, data of one big block is wiped out all at once.

In some case, you could have memory remaining in this block (because a record is being used for instance) and this is where fragmentation could happen. The more tables, current selections and connected users you have on a server, the more this fragmentation risk is increasing. And in the end, whenever you need to load a big object in memory, you may be stuck. Even if you put more memory, the problem remains the same.

The other drawback of this mechanism is that you always release one big block at once. For example if you have a 128 GB cache, you will release 32 GB at once so you loose a lot of information loaded in cache memory whereas it was not necessary.

4D v16 fully optimized Cache Manager

There might be a lot of reason why some objects in memory cannot be freed right away and have to stay in cache memory. So the idea is the following: instead of trying to avoid fragmentation, let’s try to leave with fragmentation. The new cache manager only works in 64-bit, where the virtual memory space is up to 264, so almost infinite. Of course, physical memory is always limited but internally objects will be allocated inside this huge virtual space. We actually use the Memory Management Unit (MMU) of the processor to map the virtual memory to physical memory.

blank

The good thing for 4D internal implementation is that the system is handling the physical memory defragmentation itself, by rearranging objects in memory whenever it is needed, but without changing the addresses in virtual memory. So defragmentation is totally transparent for us in the 4D internal C++ code. This is how we can work with a very large cache without bothering about fragmentation as it is fully handled by the system and without having to often release objects from memory.

The cache manager internal algorithm is actually based on a object priority concept. Object with a high priority will stay in cache longer than objects with a low priority. And we will even provide commands to give the 4D developer the control over the priority of tables or indexes. You will actually be able to change the priority in cache of a table or index on startup or even dynamically whenever you need it.

The new cache manager will actually mostly benefit to very large databases. It starts to be useful when the data doesn’t fit into the cache as there are choice to do about which object to keep or release in memory.

Discuss

Tags 4D Summit, Database, Speed

Latest related posts

  • December 7, 2023

    Catch the 4D Summit 2023 Keynote Replay

  • May 17, 2023

    4D Summit 2023. The Ultimate In-Person Experience is Back.

  • August 2, 2021

    Ready for the 4D World Tour Live 2021?

Caroline Briaud
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.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • Release infos
  • 4D View Pro
  • 4D Write Pro
  • Email, Microsoft 365, Gmail
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • 4D Qodly Pro
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Google Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Google Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy