RavenDb和MultiTenancy [英] RavenDb and MultiTenancy

查看:93
本文介绍了RavenDb和MultiTenancy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看过RavenDb并玩了一段时间,并开始研究MultiTenancy.用于多租户的Ayendes示例如下:

I have looked and played around with RavenDb for a while and have started to look at MultiTenancy. Ayendes sample for multitenancy looks like this:

using(var store = new DocumentStore
{
    Url = "http://localhost:8080"
}.Initialize())
{
    store.DatabaseCommands.EnsureDatabaseExists("Brisbane");

    store.DatabaseCommands.EnsureDatabaseExists("Melbroune");
    store.DatabaseCommands.EnsureDatabaseExists("Sidney");

    using (var documentSession = store.OpenSession("Brisbane"))
    {
        documentSession.Store(new { Name = "Ayende"});
        documentSession.SaveChanges();
    }
}

我不知道每个数据库的存储方式,因此不禁要问:这种方法是否适用于拥有大量租户的大型应用程序?

I don't know how each database is stored and hence the question: Will that work for large applications with a lot of tenants?

推荐答案

请参阅文档的第一段和最后一段( v2.5 | v3.0 ).

See the first and last paragraphs from the docs (v2.5 | v3.0).

RavenDB的数据库在设计时考虑了多租户,并且 旨在在单个服务器上支持大量数据库.在 为了做到这一点,RavenDB将仅使活动数据库保持打开状态.如果 您第一次访问数据库时,该数据库将被打开 并开始,因此对该数据库的下一个请求将不必付费 打开数据库的成本.但是如果没有数据库 访问一段时间后,RavenDB将清除所有关联的资源 数据库并关闭它.

RavenDB's databases were designed with multi tenancy in mind, and are meant to support large number of databases on a single server. In order to do that, RavenDB will only keep the active databases open. If you access a database for the first time, that database will be opened and started, so the next request to that database wouldn't have to pay the cost of opening the database. But if a database hasn't been accessed for a while, RavenDB will cleanup all resources associated with the database and close it.

这使得RavenDB可以管理大量数据库,因为 在任何给定时间,只有活动数据库实际上正在占用 资源.

That allows RavenDB to manage large numbers of databases, because at any given time, only the active databases are actually taking resources.

是的,它将支持它,并且每个数据库将存储在磁盘上的单独文件夹中.

So yes it will support it and each database will be stored in a separate folder on disk.

这篇关于RavenDb和MultiTenancy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆