Determining size of a JSON document stored in DocumentDB

∥☆過路亽.° 提交于 2020-01-04 18:15:32

问题


I'm developing a partitioning strategy for a multi-tenant application running on DocumentDB.

Since each collection only allows for 10gb of storage I am attempting to calculate how many documents each of my tenants can store, so I can come up with the number of tenants I can place into a collection.

I have a sample Json document that represents a common document that a tenant may store. Using Document Explorer on the Azure Portal does not tell me what the size of one of these documents is on disk (Just a general graph of usage percentage).

I'm also using DocumentDB Studio and am unable to determine the document sizes there. I can use Notepad locally, but depending on my encoding settings (ANSI, , Etc..) I am getting various results.

My questions are:

Is there an accurate way to determine the file size a Json file will be stored as within DocumentDB as so that I can properly calculate resource usage of my application?

Is there also a way to get back the size of a document or group of documents via a query against a collection?


回答1:


Yes - you can calculate the size of the document query response, so that all the system properties (e.g. _rid, _ts) are included. You will want to use UTF-8 encoding to get the correct size.

You will also want to factor in an additional ~10% for indexing storage costs.



来源:https://stackoverflow.com/questions/30175753/determining-size-of-a-json-document-stored-in-documentdb

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