问题
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