$ the-wire · showcase
Open WebUI lazily builds log messages, cutting INFO overhead at WARNING
By RepoJournal · Filed · About Open WebUI
Open WebUI now defers formatting of INFO log messages until they actually reach a logger, so raising GLOBAL_LOG_LEVEL to WARNING stops paying the cost of string interpolation.
Open WebUI's logging configuration used to interpolate every INFO log message into an f-string before the logging framework could discard it. That wasted work on 241 call sites even when GLOBAL_LOG_LEVEL sat at WARNING. The heaviest offender, get_doc, logs every chunk id and metadata dict in a collection [1]. On the full-context retrieval path, that means the entire knowledge base gets serialized once per chat request.
A change now builds these log messages lazily, so the payload is only formatted when the message will actually be emitted [2]. At WARNING level, the get_doc line drops that per-request serialization cost to zero. Operators who raised the log level to reduce noise now also reduce CPU load.
Action items
- → Review your GLOBAL_LOG_LEVEL setting; if you run at WARNING, evaluate the savings from the lazy log message change. open-webui/open-webui [monitor]
References
- [1] perf: build info log messages lazily so raising the log level actually saves work ↗ open-webui/open-webui
- [2] perf: build info log messages lazily so raising the log level actually saves work (#27837) ↗ open-webui/open-webui