Resolve latency issues
This page shows you how to resolve latency issues with Firestore with MongoDB compatibility.
Latency
The following table describes possible causes of increased latency:
Latency cause | Types of operations affected | Resolution |
---|---|---|
Sustained, increasing traffic.
|
read, write | For rapid traffic increases, Firestore with MongoDB compatibility attempts to automatically scale to meet the increased demand. When Firestore with MongoDB compatibility scales, latency begins to decrease. Hot-spots (high read, write, and delete rates to a narrow document range) limit the ability of Firestore with MongoDB compatibility to scale. Review Avoid hot-spots and identify hot-spots in your application. |
Contention, either from updating a single document too
frequently or from transactions.
|
read, write | Reduce the write rate to individual documents. Reduce the number of documents updated in a single write transaction. |
Large reads that return many documents.
|
read | Use pagination to split large reads. |
Too many recent deletes.
|
read This greatly affects operations that list collections in a database. |
If latency is caused by too many recent deletes, the issue should automatically resolve after some time. If the issue does not resolve, contact support . |
Index fanout, especially for array fields and embedded document fields.
|
write | Review your indexing of array fields and embedded document fields. |
Large writes.
|
write | Try reducing the number of writes in each operation. For bulk data entry where you don't require atomicity, use parallelized individual writes. |