> For the complete documentation index, see [llms.txt](https://icij.gitbook.io/datashare/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://icij.gitbook.io/datashare/server-mode/performance-considerations.md).

# Performance considerations

Extracting text from arbitrary file formats and running OCR over images is expensive work. Datashare uses [Apache Tika](https://tika.apache.org/) and [Tesseract OCR](https://tesseract-ocr.github.io/) to do it as efficiently as it can, but on a large corpus the settings you choose matter more than the machine you rent.

The detailed guidance now lives in [Tuning and performance](/datashare/server-mode/indexing/tuning.md). In short:

* **Match threads to cores.** Set `--parallelism` to the number of cores and make sure `OMP_THREAD_LIMIT=1` reaches Tesseract. Getting this wrong is routinely a 30x slowdown. [Read more](/datashare/server-mode/indexing/tuning.md#the-single-most-important-setting).
* **Decide about OCR.** It is on by default and it dominates the cost. Turn it off for born-digital corpora, and install the right Tesseract language packs when you keep it on. [Read more](/datashare/server-mode/indexing/tuning.md#ocr).
* **Split the stages and distribute INDEX.** With a shared Redis queue and a shared Elasticsearch, adding machines adds throughput almost linearly. [Read more](/datashare/server-mode/indexing/scenarios.md#scenario-5-distribute-indexing-across-several-machines).
* **Give Elasticsearch its own machine.** It becomes the bottleneck before your indexing workers do. [Read more](/datashare/server-mode/indexing/tuning.md#elasticsearch).
* **Size the heap deliberately** with `DS_JAVA_OPTS` and `ES_JAVA_OPTS`. [Read more](/datashare/server-mode/indexing/tuning.md#memory).
* **Treat mail archives as a special case.** One mailbox file is one queue entry, so a corpus of a few very large mailboxes leaves a big machine underused. [Read more](/datashare/server-mode/indexing/tuning.md#mail-heavy-corpora).
* **Tell Datashare the language** when your corpus is monolingual, with `--language` and `--ocrLanguage`. [Read more](/datashare/server-mode/indexing/tuning.md#language).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://icij.gitbook.io/datashare/server-mode/performance-considerations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
