This section offers a comprehensive overview of hardware components and their influence on the 本节全面概述了硬件组件及其对mongot process. It provides sizing guidelines, essential monitoring recommendations, and practical scaling advice.mongot进程的影响。它提供了尺寸指南、基本的监控建议和实用的缩放建议。
CPU
Impact
Increasing the number and quality of CPUs generally has a positive impact on replication throughput and query throughput (QPS). CPU is especially leveraged for queries using concurrent segment search.增加CPU的数量和质量通常会对复制吞吐量和查询吞吐量(QPS)产生积极影响。CPU尤其适用于使用并发段搜索的查询。
Sizing Guideline尺寸指南
A useful estimate based on query throughput is 10 QPS per CPU core. This is a baseline, as actual QPS is influenced by query complexity and index mappings.基于查询吞吐量的一个有用估计是每个CPU核10 QPS。这是一个基线,因为实际的QPS受到查询复杂性和索引映射的影响。
Monitoring监控
Consistently seeing CPU usage above 80% suggests a need to scale up (add CPU cores), while consistently below 20% may indicate an opportunity to scale down (reduce CPU cores).CPU使用率持续高于80%表明需要扩大规模(增加CPU内核),而持续低于20%可能表明有机会缩小规模(减少CPU内核)。
Scaling
Horizontal scaling (adding more mongot nodes) increases total CPU to increase QPS.
Note
Horizontal scaling adds additional load to a replica set because each mongot needs to replicate index data from a source collection. Each search or vector search index creates a new change stream per mongot which can degrade performance if the replica set is not sized to handle the additional replication load.
Vertical scaling primarily impacts query latency by being able to serve more queries in parallel and reducing query request queuing.
Memory (RAM)
Impact
mongot uses system memory for JVM heap (for Lucene-related data structures and caches) and filesystem cache (for efficiently accessing indexed data).
Sizing Guideline
For co-located architectures, the default settings offer a good balance. However, for dedicated infrastructure, adjusting the default JVM heap size can be beneficial. The following sections provide guidance on optimizing this setting for your specific hardware and workload.
JVM Heap Sizing
mongot uses the JVM heap primarily for Lucene-related data structures and caches. In general, heap usage of mongot roughly scales with the number of fields indexed. Heap usage is not largely affected by the number of documents or number of vectors. Effective data modeling for full-text search and vector search generally minimizes the number of indexed fields.
As an estimate, allocate 50% of the total available system memory, without exceeding a maximum of approximately 30GB. This allows enough memory to be used for the OS filesystem cache, which plays a vital role in Lucene's performance by caching frequently accessed index segments from disk. By default, mongot allocates up to 25% of the total available system memory for the JVM heap, up to 32GB (with 128GB of system memory). These sizing guidelines are an increase from this default.
Additionally, keeping the heap sizes below about 30GB allows the JVM to use compressed object pointers, saving memory. If heap sizes are increased above this 30GB limit, it is recommended that the heap size is directly increased to 48GB or larger.
To override the default heap size settings, specify the required size as arguments to the mongot start script. It is recommended to set minimum heap size (Xms) and maximum heap size (Xmx) to the same value. For example:
/etc/mongot/mongot --config /etc/mongot/mongot.conf --jvm-flags "-Xms4g -Xmx4g"Filesystem Cache
Index segments are accessed through memory-mapped files, so query latency and throughput heavily depend on the OS's filesystem cache. You must reserve sufficient memory for the filesystem cache workload. Using isolated hardware for mongot can reduce cache contention.
Note
Increasing the JVM Heap size beyond 50% of available memory may result in insufficient memory for filesystem cache usage.
Vector Search Guidance
For vector search, "Search Process Memory" is used for efficient storage of data structures like the HNSW graph. If the Vector Index Size exceeds 3GB, use vector quantization. When you quantize your vectors, only 4% of the index needs to be stored in memory, rather than the full index.
Monitoring for Insufficient Memory
An increase in Search Page Faults and Disk IOPS indicates the operating system is frequently retrieving necessary pages from disk, suggesting low memory. Consistently seeing Page Faults over 1000/s is an indication to consider scaling up.
Scaling扩展
If the mongot process terminates with an OutOfMemoryError, it means the JVM Heap is too small for your indexing and query workload. This is often caused by storing too many source fields, or a "mapping explosion" from dynamic mappings on unstructured data. The primary recommendations for resolving this issue are:
Increase the Java Heap Size (Vertical Scaling)增加Java堆大小(垂直缩放)The most direct solution is to allocate more RAM to the mongot process. If your host has available memory, you can increase the maximum Java heap size. This provides more headroom for your existing index and query patterns without changing your index definition.最直接的解决方案是为mongot进程分配更多的RAM。如果主机有可用内存,则可以增加最大Java堆大小。这为现有的索引和查询模式提供了更多的空间,而无需更改索引定义。Reduce the Index Memory Footprint减少索引内存占用If scaling hardware isn't an option, or if you want to optimize for efficiency, you can reduce the amount of memory your index requires.如果扩展硬件不是一种选择,或者如果你想优化效率,你可以减少索引所需的内存量。Review your index definition and reduce storedSource fields and remove all non-essential fields from the index to reduce heap pressure.检查索引定义,减少storedSource字段,并从索引中删除所有非必需字段,以减少堆压力。Use static mapping. A dynamic mapping will create an index field for every unique field in a collection's documents. Being more selective and only indexing essential fields will reduce heap consumption.使用静态映射。动态映射将为集合文档中的每个唯一字段创建一个索引字段。更具选择性并且只索引基本字段将减少堆消耗。
Disk Throughput and Storage磁盘吞吐量和存储
Impact
Both read and write IOPS are crucial for 读写IOPS对mongot performance, affecting replication, initial sync, and query throughput. For most use cases, we recommend general-purpose SSDs.mongot性能至关重要,会影响复制、初始同步和查询吞吐量。对于大多数用例,我们建议使用通用SSD。
Generally, both read and write IOPS are important for mongot performance. Replicating data involves not only writes to disk, but also reads, as old index segments are merged into larger segments. Thus, disk throughput has various effects on all aspects of mongot performance, from query throughput to initial sync indexing throughput.通常,读写IOPS对mongot性能都很重要。复制数据不仅涉及写入磁盘,还涉及读取,因为旧的索引段被合并到更大的段中。因此,磁盘吞吐量对mongot性能的各个方面都有不同的影响,从查询吞吐量到初始同步索引吞吐量。
Sizing Guideline尺寸指南
See Disk Sizing Guideline.请参阅磁盘大小指南。
Index Rebuilds索引重建
Creating or rebuilding an Atlas Search index is resource-intensive and can impact cluster performance. For no-downtime indexing, allocate free disk space equal to 125% of the disk space used by your old index. This headroom is important because the old index is kept on disk during a rebuild. As a general recommendation, you should double the disk allowance for 创建或重建Atlas搜索索引是资源密集型的,可能会影响集群性能。对于无停机索引,请分配相当于旧索引所用磁盘空间125%的可用磁盘空间。这个余量很重要,因为在重建过程中,旧索引会保留在磁盘上。作为一般建议,您应该将mongot的磁盘容量增加一倍,以适应索引重建。mongot to accommodate index rebuilds.
Monitoring监控
To track current index consumption, monitor Search Disk Space Used. Sustained IOPS usage over 1K warrants investigation.要跟踪当前索引消耗,请监视“搜索已用磁盘空间”。IOPS使用率持续超过1K值得调查。
Note
When the 当mongot host's storage utilization reaches 90%, mongot enters a read-only state. While in this state, mongot continues to serve queries using the indexes in their present state. Search results may be stale if changes are made to the source collection without mitigation.mongot主机的存储利用率达到90%时,mongot将进入只读状态。在此状态下,mongot继续使用当前状态的索引为查询提供服务。如果对源集合进行更改而不采取缓解措施,搜索结果可能会过时。
To resume index synchronization with source collections, reduce storage utilization to below 85% by either deleting index data or increasing storage capacity.要恢复与源集合的索引同步,请通过删除索引数据或增加存储容量将存储利用率降低到85%以下。
Scaling扩展
When increasing index sizes and with larger volumes of index data, especially with binary quantization, ensure that instances have sufficient memory to support larger working sets of index data. However, the exact amount of memory required varies depending on workload.当增加索引大小和索引数据量较大时,特别是在二进制量化时,请确保实例有足够的内存来支持更大的索引数据工作集。但是,所需的确切内存量因工作负载而异。
For example, large datasets that are rarely queried in their entirety may be able to service queries at a low latency with less memory than the same size dataset that is often queried in its entirety.例如,很少整体查询的大型数据集可能能够以较低的延迟为查询提供服务,内存比经常整体查询的相同大小的数据集少。
If you use 如果你使用具有高存储内存比的mongot with high storage-to-memory ratios, carefully monitor your memory usage. As an example, 64GB of memory might not be enough for 6400GB of storage.mongot,请仔细监控内存使用情况。例如,64GB的内存可能不足以容纳6400GB的存储空间。