views:

50

answers:

1

We have a situation, where we feel we do not fully take advantage of NHibernate's capabilities, which reduces performance. The actual situation is reduced to a "blogs with posts" example for this question.

A blog site, where each user can have its own blog which has an arbitrary number of posts. Therefore, there is a table for posts defined with the following columns:

id, blog_id, post_title, post_contents

Most blogs are rarely updated, while a few are "twitter-like" with frequent updates. There are many more reads than writes.

The front page of each blog displays the latest 5 entries.

SELECT TOP 5 * FROM blog_posts WHERE blog_id = ?

This will result in a number of elements being placed in both the 2nd level cache and query cache.

Our problem is, that the cached query results for the blogs with 99%+ reads are destroyed because of the few blogs being updated frequently.

How do you others usually solve this issue? What are the best practices?

+1  A: 

Is this an ASP.NET application? For this type of application, I would look into ASP.NET's page output caching capabilities before NHibernate's 2nd level cache.

Jamie Ide
I will look into that and reply then
Thomas