Confluence experiences slow performance at regular intervals. Thread dumps, taken across time, show this thread:
The index optimisation job is running and causing a backlog.
Add debug level logging for the following class:
Watch at 03:00:00 and 15:00:00 for these threads. If you're noticing long delays until the next DEBUG level instance of this class, it may be a culprit.
Alternatively, watch for the thread above in your thread dumps.