确定存储在DocumentDB中的JSON文档的大小 [英] Determining size of a JSON document stored in DocumentDB
问题描述
我正在为在DocumentDB上运行的多租户应用程序开发分区策略.
I'm developing a partitioning strategy for a multi-tenant application running on DocumentDB.
由于每个集合只能容纳10gb的存储空间,因此我试图计算每个租户可以存储的文档数量,因此我可以得出可以放入集合中的租户数量.
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.
我有一个样本Json文档,该文档代表租户可以存储的普通文档.在Azure门户上使用Document Explorer不会告诉我这些文件之一在磁盘上的大小(只是使用率的一般图表).
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).
我也在使用DocumentDB Studio,无法确定那里的文档大小.我可以在本地使用记事本,但是根据我的编码设置(ANSI,等等),我会得到各种各样的结果.
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.
我的问题是:
是否有一种准确的方法来确定将Json文件存储在DocumentDB中的文件大小,以便我可以正确地计算应用程序的资源使用情况?
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?
推荐答案
是-您可以计算文档查询响应的大小,以便包括所有系统属性(例如_rid,_ts).您将需要使用UTF-8编码来获取正确的大小.
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.
您还希望将额外的〜10%的费用用于索引存储成本.
You will also want to factor in an additional ~10% for indexing storage costs.
这篇关于确定存储在DocumentDB中的JSON文档的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!