我计划在 Windows Azure 上运行数值模拟。模拟可能需要几天或几周的时间。每隔一秒左右,模拟就会产生一组数字,例如温度:double
、压力:double
、速度:double[]
等。想要存储。
要求是:
- 立即保存每秒生成的所有数据,最好是在一个请求中保存。
- 即使在数值模拟运行时也能够读取任何存储的数据(例如使用 JavaScript)。
- 将温度、压力、速度等分开。我想读例如一次调用即可显示所有压力,无需读取速度等。
- 在全局层面上,存储应分为项目,项目应包含温度"file"、压力"file"等,每个"file"应包含一系列数字。
- 应该很便宜。
- 我不需要任何高级功能 -> 它应该或多或少像文件系统中的文件一样运行
我应该使用哪个存储?您能给我指出一个讨论此类用例的教程吗?
最佳答案
我的建议是为您的项目使用 Azure 表存储。它非常便宜,并且能够存储大量数据。
达到具体要求:
To save all the data produced every second immediately and preferably in one request.
您可以使用Entity Group Transactions
将数据存储在一个请求中。这有一些限制,所以我建议您仔细阅读。
To be able to read any of the stored data (using e.g. javascript) even during the numerical simulation runtime.
由于 Windows Azure 表存储是基于 REST 的服务,因此您也可以使用 JavaScript 获取数据,尽管我实际上建议使用 Shared Access Signatures
用于查询数据,因为它更安全。
To have temperature, pressure, velocity etc. separate. I would like to read e.g. all the pressures in one call without reading velocities etc.
On a global level, the storage should be split into projects and the projects should contain temperature "files", pressure "files" etc. and each "file" should contain a sequence of numbers.
这就是事情变得有趣的地方。基本上,您要做的就是对数据进行反规范化,而 Azure 表存储就是为此目的而设计的。你所说的"file",我称之为“表”。所以就会有“温度”表和“压力”表等等。我建议的方法是,当您第一次收集消息时,将数据保存在 Windows Azure 队列中,然后让另一个进程(可能是辅助角色)拉取此消息,并通过转换所需的数据将数据推送到不同的表中对于每个表。
It should be cheap.
Windows Azure 表存储很便宜。您基本上为存储的数据量、针对服务执行的事务数量以及流出数据中心的数据付费。请访问Windows Azure Pricing页面了解更多详情。
I do not need any advanced features -> it should behave more or less as files in the file-system
Azure 表存储本质上是一个基于键值对的数据存储,因此相对易于使用。
注意事项
Azure 表存储与常规 SQL 表略有不同,因为您无法在表上创建其他索引(称为二级索引)。您只能在表上获得单个索引(在 PartitionKey/RowKey 上)。因此,非常重要的是,您必须考虑如何从表中读回数据,非常明智地选择“PartitionKey/RowKey”值。
您可能会发现这些链接很有用:
关于c# - azure : data storage with append,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16711544/