Skip to content

Commit cb75983

Browse files
committed
Added updated size computation to twin size section
1 parent b59e07f commit cb75983

File tree

2 files changed

+12
-44
lines changed

2 files changed

+12
-44
lines changed

articles/iot-hub/iot-hub-devguide-device-twins.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -284,33 +284,17 @@ Tags, desired properties, and reported properties are JSON objects with the foll
284284

285285
IoT Hub enforces an 8 KB size limit on the value of `tags`, and a 32 KB size limit each on the value of `properties/desired` and `properties/reported`. These totals are exclusive of read-only elements like `$etag`, `$version`, and `$metadata/$lastUpdated`.
286286

287-
The size is computed by counting all characters, excluding UNICODE control characters (segments C0 and C1) and spaces that are outside of string constants.
287+
Twin size is computed as follows:
288288

289-
For example, consider the following JSON fragment for reported properties. Read-only elements like `$version` and `$metadata/$lastUpdated` are not shown as they are excluded from computation of the property size limit.
289+
* For each property in the JSON document, IoT Hub cumulatively computes and adds the length of the property's key and value.
290290

291-
```json
292-
"properties" : {
293-
...
294-
"reported" : {
295-
"intProperty" : 14000,
296-
"boolProperty" : true,
297-
"floatProperty" : 1.463E+200,
298-
"stringProperty" : "This is a string value",
299-
"objectProperty" : {
300-
"property1" : 1,
301-
"property2" : 2
302-
}
303-
}
304-
}
305-
```
291+
* Property keys are considered as UTF8-encoded strings.
306292

307-
The size of the reported properties for this fragment would be computed based on the UTF-8 encoded value of the following JSON, which represents the value of `properties/reported` with the white-space removed:
293+
* Simple property values are considered as UTF8-encoded strings, numeric values (8 Bytes), or Boolean values (4 Bytes).
308294

309-
```json
310-
{"intProperty":14000,"boolProperty":true,"floatProperty":1.463E+200,"stringProperty":"This is a string value","objectProperty":{"property1":1,"property2":2}}
311-
```
295+
* The size of UTF8-encoded strings is computed by counting all characters, excluding UNICODE control characters (segments C0 and C1).
312296

313-
This yields a length of 157 bytes.
297+
* Complex property values (nested objects) are computed based on the aggregate size of the property keys and property values that they contain.
314298

315299
IoT Hub rejects with an error all operations that would increase the size of the `tags`, `properties/desired`, or `properties/reported` documents above the limit.
316300

articles/iot-hub/iot-hub-devguide-module-twins.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,33 +265,17 @@ Tags, desired properties, and reported properties are JSON objects with the foll
265265

266266
IoT Hub enforces an 8 KB size limit on the value of `tags`, and a 32 KB size limit each on the value of `properties/desired` and `properties/reported`. These totals are exclusive of read-only elements like `$etag`, `$version`, and `$metadata/$lastUpdated`.
267267

268-
The size is computed by counting all characters, excluding UNICODE control characters (segments C0 and C1) and spaces that are outside of string constants.
268+
Twin size is computed as follows:
269269

270-
For example, consider the following JSON fragment for reported properties. Read-only elements like `$version` and `$metadata/$lastUpdated` are not shown as they are excluded from computation of the property size limit.
270+
* For each property in the JSON document, IoT Hub cumulatively computes and adds the length of the property's key and value.
271271

272-
```json
273-
"properties" : {
274-
...
275-
"reported" : {
276-
"intProperty" : 14000,
277-
"boolProperty" : true,
278-
"floatProperty" : 1.463E+200,
279-
"stringProperty" : "This is a string value",
280-
"objectProperty" : {
281-
"property1" : 1,
282-
"property2" : 2
283-
}
284-
}
285-
}
286-
```
272+
* Property keys are considered as UTF8-encoded strings.
287273

288-
The size of the reported properties for this fragment would be computed based on the UTF-8 encoded value of the following JSON, which represents the value of `properties/reported` with the white-space removed:
274+
* Simple property values are considered as UTF8-encoded strings, numeric values (8 Bytes), or Boolean values (4 Bytes).
289275

290-
```json
291-
{"intProperty":14000,"boolProperty":true,"floatProperty":1.463E+200,"stringProperty":"This is a string value","objectProperty":{"property1":1,"property2":2}}
292-
```
276+
* The size of UTF8-encoded strings is computed by counting all characters, excluding UNICODE control characters (segments C0 and C1).
293277

294-
This yields a length of 157 bytes.
278+
* Complex property values (nested objects) are computed based on the aggregate size of the property keys and property values that they contain.
295279

296280
IoT Hub rejects with an error all operations that would increase the size of those documents above the limit.
297281

0 commit comments

Comments
 (0)