Web / Apache Solr Interview questions
What is the difference between soft commit and hard commit?
Both commits make recent index changes visible, but they differ in durability and cost.
| Hard commit | Soft commit |
| Flushes data to disk and truncates the transaction log | Opens a new searcher without an fsync to disk |
| Durable across a crash | Not durable by itself; relies on the tlog for recovery |
| More expensive, done less frequently | Cheaper, done frequently for near-real-time visibility |
A typical production setup runs autoCommit with openSearcher=false every minute or so for durability, and a separate autoSoftCommit every few seconds so new documents become searchable quickly without paying the full disk-sync cost on every update.
Splitting the two this way means a crash only risks losing the small window of writes since the last hard commit, since the transaction log can replay anything not yet flushed to a segment, while search freshness is governed almost entirely by the cheaper soft commit interval.
More Related questions...