简体   繁体   English

在使用.NET的内存通信中

[英]In Memory Communication Using .NET

I've implemented a type of in memory database using generic Lists and Linq and it is consumed by an ASP.NET application. 我使用通用Lists和Linq实现了一种内存数据库,它被ASP.NET应用程序使用。 Building this database in memory takes about 45 seconds (it's built from a database) so we're trying to minimize ASP.NET app pool recycles to once a day at 1:00 am to avoid having the worker process recycle in the middle of the day and spin for 45 seconds rebuilding the database. 在内存中构建此数据库大约需要45秒(它是从数据库构建的)所以我们尝试将ASP.NET应用程序池回收最小化为每天凌晨1:00,以避免工作进程在中间进行回收。日和旋转45秒重建数据库。

I'd like to move our in memory database to another process isolated from the ASP.NET worker process but I'm unsure as to how I can get objects in the ASP.NET application talking to a separate process that would hold the database. 我想将我们的内存数据库移动到与ASP.NET工作进程隔离的另一个进程,但我不确定如何在ASP.NET应用程序中获取对象以与保存数据库的单独进程进行通信。 Should I use a TCP listener type of thing? 我应该使用TCP侦听器类型的东西吗? I know IIS used to be able to host libraries and make them available via remoting...is this still possible? 我知道IIS曾经能够托管库并通过远程处理使它们可用......这还有可能吗?

If you're wondering why I'm going to all the trouble of an in memory database it's because it's powering a faceted search application. 如果你想知道我为什么要在内存数据库中遇到麻烦,那是因为它为分面搜索应用程序提供了动力。 Using Linq and in memory lists is faster by many orders of magnitude than going to the database for each search. 使用Linq和内存列表比每次搜索到数据库要快许多个数量级。

Thanks in advance for any advice. 提前感谢任何建议。

You should probably look at WCF over named pipes: http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication . 您可能应该查看命名管道上的WCF: http//www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication

You could host your DB in a simple windows service. 您可以在简单的Windows服务中托管您的数据库。

Named pipes are one option to do it. 命名管道是一种选择。 You can abstract that away to an extent using WCF Named Pipes bindings . 您可以使用WCF命名管道绑定将其抽象到一定程度。 You can also apply security permission to said named pipes to improve security against arbitrary applications doing stuff to your in memory database. 您还可以对所述命名管道应用安全权限 ,以提高对内存数据库执行操作的任意应用程序的安全性。

CK1,WCF和Named Pipes就像其他人说的那样在同一台服务器上都没问题,如果你再将其他机器(如应用服务器)放入内存数据库托管中,你可以简单地更改绑定并使用netTCP进行快速二进制通信TCP上的机器......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM