简体   繁体   English

使用nhibernate的memcached或lucene.net

[英]memcached or lucene.net with nhibernate

Does anyone have used memcached as a level2 cache or lucene.net for searching with nhibernate ? 有没有人使用memcached作为level2缓存或lucene.net用于搜索nhibernate? Can you please share your advances on nhibernate caching & indexing/searching. 您能否分享一下nhibernate缓存和索引/搜索的进展。

And, is memcached (with enyim cilent on the same machine by appserver) the fastest l2cache solution with nhibernate ? 并且,使用nhibernate的memcached(使用appserver在同一台机器上使用enyim cilent)是最快的l2cache解决方案吗?

Best Regards sirmak 最好的问候sirmak

I have used both experimentally . 我已经通过实验使用过。 For the second-level-cache i can't compare it with any other option, as it was the only one i used, except perhaps of not having one: It will deliver performance gains immediately, but they will be more noticeable for scenarios where you mostly read than insert/update, when dealing with large datasets and when having a cluster. 对于二级缓存,我无法将它与任何其他选项进行比较,因为它是我使用的唯一选项,除非可能没有一个:它将立即提供性能提升,但对于其中的情况,它们将更加明显在处理大型数据集和拥有集群时,您主要阅读的不是插入/更新。 Specifically for memcached its a sound solution as the application can be run virtually on any kind of machine (like a cheap-o Linux machine) 特别是对于memcached来说它是一个合理的解决方案,因为应用程序可以在任何类型的机器上虚拟运行(比如廉价的Linux机器)

For Lucene.NET i've used it both vanilla (no nhibernate though, but on production not just experiments) and in the form of NHibernate.Search whereas the integration with nhibernate is seamless: the indexes are generated and manipulated behind the curtain and everything is configured at the Class declaration (unfortunately with class and property attributes, would have preferred on the mapping). 对于Lucene.NET,我既使用了vanilla(虽然没有nhibernate,但生产不仅仅是实验)和NHibernate.Search的形式,而与nhibernate的集成是无缝的:索引是在窗帘后面生成和操作的在类声明中配置(遗憾的是具有类和属性属性,在映射上会有首选)。 Comparing it with Sql-Server's Fulltext Search engine i think it is more maintainable as you don't have to write normal SQL to fetch using the FT Engine, you just use the Criteria mechanism as well as an exposed mechanism for Lucene queries. 与Sql-Server的全文搜索引擎相比,我认为它更易于维护,因为您不必使用FT引擎编写正常的SQL来获取,您只需使用Criteria机制以及Lucene查询的公开机制。

Sync'ing with the database is automatically done during update/insert/delete. 在更新/插入/删除期间自动完成与数据库的同步。 Performance of the Lucene.NET engine depends both on the cpu/ram configuration of the machine as well as the speed of the storage medium and i find it comparable if not faster than SqlServer's FullText Engine. Lucene.NET引擎的性能取决于机器的cpu / ram配置以及存储介质的速度,我发现它可以比SqlServer的FullText引擎更快。 As a note, NHibernate.Search indexes are simple and each indexed Class has its own index file making development and peeking in the index easier. 需要注意的是,NHibernate.Search索引很简单,每个索引类都有自己的索引文件,使索引中的开发和查看更容易。

We have used Lucene.NET with success to improve the search performance of a several GB's large database. 我们已成功使用Lucene.NET来提高几GB大型数据库的搜索性能。 The Lucene.NET result id's are then passed on to NHibernate for fetching. 然后将Lucene.NET结果id传递给NHibernate进行读取。 NHibernate queries would time-out, yet Lucene.NET would return the results in a matter of seconds. NHibernate查询会超时,但Lucene.NET会在几秒钟内返回结果。 We haven't used Memcached, so I can't compare both solutions. 我们还没有使用Memcached,所以我无法比较两种解决方案。

The biggest drawback is the fact that the Lucene index has to be kept in sync with the actual database. 最大的缺点是Lucene索引必须与实际数据库保持同步。

Edit: One thing you might want to look at is NHibernate.Search, if you're going to go the Lucene.NET & NHibernate route, it's a project which handles the Lucene index creation & synchronization for you. 编辑:你可能想看的一件事是NHibernate.Search,如果你要去Lucene.NET和NHibernate路线,它是一个为你处理Lucene索引创建和同步的项目。 It has some nice features, last time I checked it made an index per class, indexing all the properties automatically. 它有一些不错的功能,上次我检查它为每个类创建一个索引,自动索引所有属性。 This wasn't useful for us, since we wanted to index referenced objects as well, but in some cases this should be sufficient. 这对我们没用,因为我们也想索引引用的对象,但在某些情况下这应该足够了。 Don't know in which state the project is now, it has been a while since I had a look. 不知道该项目现在处于哪个状态,从我看一看已经有一段时间了。

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

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