[BP to 7.1.x]- Optimise projector CPU during XATTR processing
Description
Components
Affects versions
Fix versions
Labels
Environment
Link to Log File, atop/blg, CBCollectInfo, Core dump
Release Notes Description
Attachments
- 12 Jan 2023, 05:31 AM
- 12 Jan 2023, 05:29 AM
- 12 Jan 2023, 05:29 AM
Activity
Dragos Taraban February 23, 2023 at 4:23 PMEdited
On the perf side, we have also seen large improvements in projector cpu and memory usage. For tests with 1,000 channels per document, projector rss is roughly half after the patch, while projector cpu usage is also halved. For larger tests, with 10,000 channels per documents, the improvements are even larger, with projector rss being 4 to 5 times smaller after the fixes and projector cpu being 3 times smaller, with less spikes. We have currently tested 7.1.3 and 7.1.4 and 7.2.0.
For 7.1.4:
1,000 channels per document:
10,000 channels per document:
For 7.1.3:
1,000 channels per document:
10,000 channels per document:
For 7.2.0:
1,000 channels per document:
10,000 channels per document:
CB robot January 13, 2023 at 5:01 AM
Build couchbase-server-7.1.4-3557 contains indexing commit 1bbbb20 with commit message:
https://couchbasecloud.atlassian.net/browse/MB-54560#icft=MB-54560 Do not allocate 'xattrLen' number of map entries
CB robot January 13, 2023 at 5:01 AM
Build couchbase-server-7.1.4-3557 contains indexing commit 96c6ce5 with commit message:
https://couchbasecloud.atlassian.net/browse/MB-54560#icft=MB-54560 Use NewParsedValueWithOptions insted of json unmarshall for xattr processing
CB robot January 13, 2023 at 3:19 AM
Build couchbase-server-7.2.0-5077 contains indexing commit 1bbbb20 with commit message:
https://couchbasecloud.atlassian.net/browse/MB-54560#icft=MB-54560 Do not allocate 'xattrLen' number of map entries
CB robot January 13, 2023 at 3:19 AM
Build couchbase-server-7.2.0-5077 contains indexing commit 96c6ce5 with commit message:
https://couchbasecloud.atlassian.net/browse/MB-54560#icft=MB-54560 Use NewParsedValueWithOptions insted of json unmarshall for xattr processing
Details
Assignee
Dragos TarabanDragos Taraban(Deactivated)Reporter
Varun VelamuriVarun VelamuriIs this a Regression?
UnknownTriage
UntriagedStory Points
1Priority
CriticalInstabug
Open Instabug
Details
Details
Assignee
Reporter
Is this a Regression?
Triage
Story Points
Priority
Instabug
PagerDuty
PagerDuty Incident
PagerDuty
PagerDuty Incident
PagerDuty

Sentry
Linked Issues
Sentry
Linked Issues
Sentry
Zendesk Support
Linked Tickets
Zendesk Support
Linked Tickets
Zendesk Support

In one of the customer issues, it has been observed that projector was spending lot of time during XATTR processing. This ticket is to track the improvements in CPU at projector for XATTR processing
1050: if (event.Opcode == transport.DCP_MUTATION || . . 1051: event.Opcode == transport.DCP_DELETION) && event.HasXATTR() { . . 1052: xattrLen := int(binary.BigEndian.Uint32(rq.Body)) . . 1053: xattrData := rq.Body[4 : 4+xattrLen] . 29.05s 1054: event.RawXATTR = make(map[string][]byte, xattrLen) . . 1055: for len(xattrData) > 0 { . . 1056: pairLen := binary.BigEndian.Uint32(xattrData[0:]) . . 1057: xattrData = xattrData[4:] . . 1058: binaryPair := xattrData[:pairLen-1] . . 1059: xattrData = xattrData[pairLen:] . 60ms 1060: kvPair := bytes.Split(binaryPair, []byte{0x00}) . . 1061: event.RawXATTR[string(kvPair[0])] = kvPair[1] . . 1062: }
492: for _, xattr := range ie.xattrs { . . 493: if _, ok := m.ParsedXATTR[xattr]; !ok { . . 494: var val interface{} . . 495: if len(m.RawXATTR[xattr]) != 0 { . 21.66s 496: if err := json.Unmarshal(m.RawXATTR[xattr], &val); err != nil { . . 497: arg1 := logging.TagStrUD(xattr) . . 498: arg2 := logging.TagStrUD(m.Key) . . 499: logging.Errorf("Error parsing XATTR %s for %s: %v", . . 500: arg1, arg2, err) . . 501: } else { . 10ms 502: m.ParsedXATTR[xattr] = val . . 503: } . . 504: } . . 505: } . . 506: }