[SERVER-13343] Don't compress journal writes that are less than 8k (or 4k) Created: 25/Mar/14  Updated: 06/Dec/22  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: MMAPv1, Storage
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Mark Callaghan Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 1
Labels: journal
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-9802 Single-threaded journal compression b... Closed
Assigned Teams:
Storage Execution
Participants:

 Description   

Journal writes are always compressed and then padded to 8kb. When the write is small enough (less than ~8kb today) then it doesn't need to be compressed. Compression adds latency and CPU overhead that makes some workloads slower.

By disabling compression I get ~10% more inserts/second for a workload that does journal writes which are less than 8k prior to compression – http://smalldatum.blogspot.com/2014/03/redo-logs-in-mongodb-and-innodb.html

This is likely to help workloads that use journalCommitInterval:2 and j:1 on writes.

A related JIRA is SERVER-9802.

        void Journal::journal(const JSectHeader& h, const AlignedBuilder& uncompressed) {
            RACECHECK
            static AlignedBuilder b(32*1024*1024);
            /* buffer to journal will be
               JSectHeader
               compressed operations
               JSectFooter
            */
            const unsigned headTailSize = sizeof(JSectHeader) + sizeof(JSectFooter);
            const unsigned max = maxCompressedLength(uncompressed.len()) + headTailSize;
            b.reset(max);
 
            {
                dassert( h.sectionLen() == (unsigned) 0xffffffff ); // we will backfill later
                b.appendStruct(h);
            }
 
            size_t compressedLength = 0;
            rawCompress(uncompressed.buf(), uncompressed.len(), b.cur(), &compressedLength);
            verify( compressedLength < 0xffffffff );
            verify( compressedLength < max );
            b.skip(compressedLength);


Generated at Thu Feb 08 03:31:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.