Skip to content

Commit c86ff24

Browse files
committed
MB-25632: Opcode attributes: document dynamic changing via mcctl
Change-Id: I2ae4be555cc8addb5f558228e94ea47e66cd3ed1 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/172840 Reviewed-by: Paolo Cocchi <[email protected]> Tested-by: Dave Rigby <[email protected]>
1 parent 538904b commit c86ff24

File tree

1 file changed

+56
-8
lines changed
  • etc/couchbase/kv/opcode-attributes.d

1 file changed

+56
-8
lines changed

etc/couchbase/kv/opcode-attributes.d/README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,57 @@
11
# Opcode attributes
22

33
It is possible to set attributes for the various commands used by
4-
Couchbase. During startup `etc/couchbase/kv/opcode-attributes.json` is
5-
read and applied, before all files in `etc/couchbase/kv/opcode-attributes.d`
6-
is read and applied in alphabetical order. Finally the (optional) setting
7-
provided by ns_server through `memcached.json` is applied.
4+
Couchbase. These can be set via two methods:
5+
6+
1. During startup, by configuration files.
7+
2. At runtime: Via the `mcctl set sla` command.
8+
9+
### Static configuration
10+
11+
At startup, the file `etc/couchbase/kv/opcode-attributes.json` is read and
12+
applied, before all files in `etc/couchbase/kv/opcode-attributes.d` is read
13+
and applied in alphabetical order. Finally the (optional) setting
14+
provided by ns_server through `memcached.json` is applied.
15+
16+
### Dynamic configuration
17+
18+
The current opcode attributes can be read or modified at runtime via the
19+
`mcctl (get|set) sla` command.
20+
21+
The attributes are passed in the same JSON format as the static configuration
22+
files - see [Format](#Format).
23+
24+
This will override the _current_ opcode attributes, but is not persisted to
25+
disk - if the node is restarted the opcode attributes will revert to the static
26+
configuration described above.
27+
28+
#### Examples
29+
30+
* To read the current opcode attributes:
31+
```shell
32+
$ /opt/couchbase/bin/mcctl --host localhost -u Administrator -P password \
33+
get sla
34+
{"comment":"Current MCBP SLA configuration",
35+
"version":1,
36+
"default":{"slow":"500 ms"}},
37+
"COMPACT_DB":{"slow":"1800 s"},
38+
"DELETE_BUCKET":{"slow":"10 s"},
39+
"SEQNO_PERSISTENCE":{"slow":"30 s"}
40+
}
41+
```
42+
* To change the default SLA for all opcodes to 100ms:
43+
```shell
44+
$ /opt/couchbase/bin/mcctl --host localhost -u Administrator -P password \
45+
set sla '{"version":1, "default":{"slow":"100ms"}}'
46+
```
47+
* To change the SLA for the SET opcode to 50ms, leaving the default SLA at
48+
500ms:
49+
```shell
50+
$ /opt/couchbase/bin/mcctl --host localhost -u Administrator -P password \
51+
set sla '{"version":1, "set":{"slow":"50ms"}, "default":{"slow":"500ms"}}'
52+
```
53+
54+
### Format
855

956
Version 1 of the command attributes allows for specifying a threshold
1057
for when memcached will report an operation as slow in the memcached
@@ -23,17 +70,17 @@ The format of these files is JSON and looks like:
2370
},
2471
}
2572

26-
The version field is mandatory and dictates the format of the fields
73+
The `version` field is mandatory and dictates the format of the fields
2774
the parser should expect (to allow us to modify the content and still
2875
be able to read the files in an upgrade scenario).
2976

30-
The comment is optional and ignored by the parser.
77+
The `comment` is optional and ignored by the parser.
3178

32-
The field "default" is optional and contains the entry when there
79+
The field `default` is optional and contains the entry when there
3380
isn't specified a value.
3481

3582
The rest of the file should contain entries per command. Each of
36-
these entries contains a single filed "slow" which contains the
83+
these entries contains a single field `slow` which contains the
3784
threshold for that command (we might want to add other fields
3885
later on).
3986

@@ -53,3 +100,4 @@ also contain one of the following specifiers:
53100
"compact_db": {
54101
"slow": "30 m"
55102
}
103+

0 commit comments

Comments
 (0)