The MDEX Engine normally runs in multithreaded mode with the default number of threads set to one. For many applications, Oracle recommends running the MDEX Engine with more than one thread. These applications have the following characteristics.
Large index files on disk. Only one set of index files is required for the multithreaded MDEX Engine. Thus, in addition to reduced hardware costs, the multithreaded approach reduces the hardware hosting disk space required.
Long-running queries. For applications that rely on commonly used MDEX Engine features, almost all queries complete in a fraction of a second. This enables the MDEX Engine to remain responsive at all times. However, many applications make use of more advanced features (such as computing complex aggregate Analytics queries) and can encounter longer running queries. Multithreaded mode enables the MDEX Engine to remain responsive while working on such long-running queries.
Simplified system management and network architecture. Configuring the MDEX Engine to run with multiple threads is much simpler than adding servers to run additional MDEX Engines, which requires reconfiguring the file system, adding load balancers, and making other infrastructure changes.
Applications with high throughput requirements with limited hardware resources. The most efficient way to achieve simultaneous high throughput is to add MDEX Engines and run multiple MDEX Engines on distinct servers. But, when hardware resources are limited, running a multithreaded MDEX Engine on the same server requires fewer hardware resources than multiple distinct Engines, because all threads in the multithreaded MDEX Engine share resources.
The MDEX Engine relies on in-memory index structures to provide sub-second responses to complex queries. As the scale of application data increases, so does the memory required to host a single instance of the MDEX Engine.
Multithreaded execution mode enables more efficient utilization of RAM through SMP (Symmetric Multi-Processing) configurations. For example, if your current data scale requires 4GB of RAM, and query throughput requires four CPUs, multithreaded execution allows the site to be hosted on a single quad-processor machine with 5-6GB of RAM, rather than using more costly options, such as four single-processor machines, each with 4GB of RAM, or a 16GB machine with four Dgraphs on it.
Applications that heavily use the MDEX Engine dynamic cache. Such applications cause a multithreaded MDEX Engine (with threads greater than 1) to perform better than multiple singlethreaded MDEX Engines because all threads in a multithreaded Engine share the same dynamic cache. This is especially true when that cache is cleared frequently due to restarts or partial updates, or when the cache is typically under heavy eviction pressure.