About Azure Table Storage Row 1MB Limit, How it counts for UTF8 Code?

半世苍凉 提交于 2019-12-20 20:34:33

问题


Lets first quote:

Combined size of all of the properties in an entity cannot exceed 1MB. (for a ROW/Entity) from msdn

My Questions is: Since everything is XMLed data, so for 1MB, is 1MB of what, 1MB of ASCII Chars, or 1MB of UTF8 Chars, or something else?

Sample:

Row1: PartitionKey="A', RowKey="A", Data="A"
Row2: PartitionKey="A', RowKey="A", Data="A"  (this is a UTF8 unicode A)

Is Row1 and Row2 same size (in length), or Row2.Length=Row1.Length+1?


回答1:


Single columns such as "Data" in your example are limited to 64 KB of binary data and single rows are limited to 1 MB of data. Strings are encoding into binary in the UTF8 format so the limit is whatever the byte size ends up being for your string. If you want your column to store more than 64 KB of data you can use a technique such as FAT Entity which is provided to you with Lokad (https://github.com/Lokad/lokad-cloud-storage/blob/master/Source/Lokad.Cloud.Storage/Azure/FatEntity.cs). The technique is pretty simple, you just encode your string to binary and then split the binary across multiple columns. Then when you want to read the string from the table, you would just re-join the columns again and convert the binary back to a string.




回答2:


Azure table row size calculation is quite involved and includes both the size of the property name and its value plus some overhead.

http://blogs.msdn.com/b/avkashchauhan/archive/2011/11/30/how-the-size-of-an-entity-is-caclulated-in-windows-azure-table-storage.aspx

Edit. Removed statement that earlier said that size calculation was slightly inaccurate. It is quite accurate.



来源:https://stackoverflow.com/questions/8950693/about-azure-table-storage-row-1mb-limit-how-it-counts-for-utf8-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!