On one of my production instances, I notice some copy operations are slow. Moving 60 messages takes around 2 seconds (~33ms per message).
More interestingly, a total of 1042 Cassandra queries is generated! (~17 per messages)
The moves is currently performed on a per message basis, sequencially.
However, by grouping updates together we can:
- Allocate a single MODSEQ thus saving on ModSeq generation
- Allocate several UIDs at once by asking for a UID range
- As we are no longer performing id generation for each message, we can parallelize the message insertion...
- And the tables indexes (applicable flags, mailbox counters) can be grouped instead of being performed for each messages. Other table indexes updates can be further parallelized yielding further enhancements.
In brief, according to the glowroot capture attached we can expect a 75% performance enhancement by:
- Cassandra query volume reduction
- Operation parallelization
We also expect a positive impact on overall Cassandra performances from the above enhancements.