December 31, 2011
Inside c-treeACE: Core Engine Technology
Note: c-treeACE became FairCom DB in October 2020.
No doubt about it, c‑treeACE is extremely flexible and sophisticated technology. But sometimes we hear from developers that they focus on a narrow subset of the available features to satisfy the immediate needs of their application rather than looking more broadly at the total feature set to uncover new features that might be beneficial. Like a puzzle scattered across a table, you grab the pieces of the small section you are working on (“I get the edge pieces!”) rather than working on the entire picture at once.
Over the next several eNewsletters, we’re going to look at that total picture. To make this possible, we’ll highlight several major subsystems and how each one brings advanced features and performance to your applications.
The Big Picture
At its heart, c‑treeACE is a sophisticated, multithreaded advanced indexing engine composed of multiple subsystems:
- The Core Engine, which comprises three main services: the Thread Manager, the Disk I/O Manager and the Memory Manager, besides the data itself;
- The Transactional and Operational Management layers, which includes all low-level functions to control and maintain transaction integrity, and includes the framework for the data access interfaces, such as SQL access;
- The Low Level API, which provides the interface for applications and programs to access the data structures, through a basic set of functions, such as insert, delete, etc.
- The Communication Layer, which provides the high level integration interfaces for access to c‑treeACE data through industry standard APIs, such as JDBC, ODBC, ADO.NET, etc.
c‑treeACE Core Engine
The c‑treeACE core engine comprises four main services: the Thread Manager, the Disk I/O Manager, the Memory Manager, and an SQL parser/optimizer. In this issue we’ll introduce the Core Engine and how it delivers the power and versatility to drive the multitude of c‑treeACE features available.
File and I/O Management
File and disk I/O are the core essentials of a database engine. c‑treeACE takes advantage of specific OS and platform level functionalities whenever possible. Some examples are as follows:
- Direct I/O – On certain platforms supporting UDF filesystems, c‑treeACE implements synchronous system disk writes using direct I/O. The direct I/O synchronous writes can also be used to write transaction logs improving performance.
- Dupchannel – Where FairCom uses native operating system threads, it may be possible for c‑treeACE to use more than one file handle or I/O channel for a given file or index. If the operating environment supports this, it can significantly improve the file access performance of c‑treeACE. For instance, if two users read from and write to the same file at the same time, c‑treeACE can improve the performance of the system by using multiple handles into the same file.
This functionality is useful for files that have heavy simultaneous use by multiple users. The benefits may decrease if a large number of files are open with this mode. In addition, with a large number of files and a restricted number of file handles available from the operating environment, you may not see an improvement.
Cache & Memory Management
Database file management is an intensely I/O bound process. As any disk I/O operation is expensive in terms of performance, any advantage that can be obtained from data in memory will provide quicker response times to applications. c‑treeACE attempts to make the most efficient use of memory whenever possibly. Memory is managed both internally, through an efficient memory suballocator subsystem, and directly to applications through extensive cache management options.
- Memory usage – An efficient memory sub-allocator reduces memory fragmentation and requires fewer calls to the system memory manager. By reducing system memory allocation calls, performance is gained by moving much memory management into user space avoiding costly OS state transitions.
- LRU lists – Advanced LRU caching algorithms provide highly scalable performance. To avoid resource contention, the number of LRU lists is configurable for maximum performance with increasing thread access.
- Dedicated cache – Dedicated cache settings allocate a specified amount of memory to particular data files. This allows an administrator to specify files critical to maintain in memory at the expense of the “least-recently-used” (LRU) approach. Settings can be configured for multiple files, each with their own cache space.
- Primed caches – c‑treeACE can optionally load data and/or index files with a number of bytes primed at file open. When the file is opened, the server reads the specified number of bytes for a given file directly into cache. Index files can also be primed by key.
- Background flushing – c‑treeACE flushes data and index caches during idle time via idle thread processes. Transaction controlled files are flushed by one thread, while non-transaction controlled files another. These threads periodically wake and, if c‑treeACE is idle, begin flushing. Subsequent activity terminates the flush for performance considerations. For complete control, the wake up timing is configurable and the threads can also be disabled.
Thread Management
A sophisticated threading subsystem enhances performance and brings exceptional scalability on SMP systems. The advanced c‑treeACE thread techniques encompass all system specific threading issues (e.g., mutexes, semaphores, local thread storage, etc.). A proprietary threading system is even available for operating systems not supporting native (e.g, POSIX pthreads) threads.
c‑treeACE incorporates multiple internal threads for advanced server management, further reducing external administration.
- Checkpointing – Periodically records the current transaction state of c‑treeACE in a set of transaction log files. The checkpoint thread writes a checkpoint entry to the transaction logs each time a specified amount of data has been written to the transaction log files. The most recent checkpoint entry in the transaction logs provides a starting point for the c‑treeACE automatic recovery procedure if the c‑treeACE process terminates abnormally. If you are not using transaction control, the checkpoint thread is idle. The frequency at which the checkpoint thread writes checkpoints can be tuned for optimal performance.
- Deleted Space Reclamation – Makes deleted space in recovered variable-length c‑tree data files and deleted c‑tree superfile members available for reuse. This thread also coalesces adjacent blocks of deleted space in variable-length files into larger regions. The thread reads and processes entries stored in a permanent queue file named D0000001.FCS. Improves performance and disk space usage.
- Communication Listener – Listens for connection requests from c‑treeACE client processes. There is one communication listener thread for each communication protocol your c‑tree Server is configured to support. For example, c‑treeACE SQL for Windows has four communication listener threads if both the TCP/IP and shared memory communication protocols are enabled for both ISAM and SQL connections.
- SYSLOG – Logs messages to a System Log Data file. The logging of these messages are triggered by SYSLOG configuration options and some uses of the SNAPSHOT API, such as the collecting of c‑tree function timings.
- Dynamic Dump – The c‑tree Server Dynamic Dump backup thread. A dynamic dump thread is created for each backup that is scheduled, so more than one dynamic dump thread can exist, but only one dynamic dump thread at a time performs a backup.
- Idle Flush – Flushes updated cache pages to disk when the database engine is idle. One thread flushes updated pages for transaction-controlled files and one thread flushes updated pages for non-transaction controlled-files.
Advanced Features
All of these components combine cohesively and make possible the multitude of advanced c‑treeACE features your applications depend on.
- HUGE Files – 64-bit file addressing providing more than 16,000,000 terabytes (16 exabytes!) of data in a single c‑tree file.
- Encrypted Files – Protect your data with industry standard algorithms including AES (Rijndael), Twofish, Blowfish, and Triple DES. Also included are proprietary lightweight algorithms for performance.
- Partitioned Files – Rule based physical data segmentation by key value is completely transparent to the application. This permits efficient archiving and purging of data.
- Segmented Files – Break through physical system limitations with logical file segmentation. Combine with HUGE file support for extreme file sizes — files up to16 exabytes!
- Advanced Space Reclamation – Efficient space management of variable length data.
- Mirrored Files – Maintain copies of important files on different drive volumes, partitions or physical drives for fault tolerant redundancy.
ANSI SQL
An ANSI SQL-92 compliant SQL engine, with many SQL-99 additions, c‑treeACE SQL provides industry standard SQL interfaces to existing applications.
The SQL engine component provides innovative optimizations geared towards the needs of your database. In environments where an index is not available, the SQL engine dynamically builds indexes to dramatically improve join performance. In environments with built-in navigation elements, the SQL engine optimizer uses hash joins to take advantage of the proprietary navigation structures.
A high performance query optimizer supports sophisticated query rewrite techniques to improve nested query performance. Join-order optimization improves performance of queries joining many tables. The SQL engine extensively caches and buffers information for maximum transaction and query throughput.
For true cross-platform portability, stored procedures, triggers, and user defined functions utilize the Java programming platform. By using a full-featured programming environment, Java based stored procedures can take advantage of the many language features to enforce robust business logic directly in c‑treeACE SQL.
See Also
- Inside c‑treeACE: Core Engine Technology
- Inside c‑treeACE: Transactional Technology
- Inside c‑treeACE: Operational Technology
- Inside c‑treeACE: Interface Technology