Page 1 of 1

Question about NHibernate

Posted: Tue Jun 10, 2014 6:29 am
by rmaweb
Hello Everyone,

I am working on merging my codebase with the new able gold R8 update. I am not familiar with NHibernate so when it is being used in the category conlib pages, is it doing anything for those pages? Or is it "preloading" the data into a cache for when someone clicks to a product page from that category page? Because I see it "fetching" various stuff like "productOptions", "productKitComponents", "productTemplates", etc which aren't used on the category pages.

Thanks,
Ryan

Re: Question about NHibernate

Posted: Tue Jun 10, 2014 8:07 am
by Katie
Hi Ryan,

I've asked a developer to look into this for you. In the change log, there is a feature "Use Eager Fetch on retail side when loading products", but you make a valid point about why we are preloading product options, kit components, etc. We should have an answer by tomorrow morning.

Thanks for your patience.
Katie

Re: Question about NHibernate

Posted: Tue Jun 10, 2014 10:55 am
by rmaweb
Thank you Katie for the quick response. Look forward to their answer.

Thanks,
Ryan

Re: Question about NHibernate

Posted: Wed Jun 11, 2014 3:20 am
by Naveed
Ryan is right about fetching related product data from database for all category pages. The data is pre-fetched/loaded from database and cached by nhibernate before rendering products information at category pages, this data is later used by different controls (e.g. ~/ConLib/ProductPrice.ascx, ~/ConLib/ProductItemDisplay.ascx etc.). We do this for performance boost, so that instead querying database for one product at a time we load all related data in one go. This saves multiple database access round trips.

Re: Question about NHibernate

Posted: Wed Jun 11, 2014 4:46 am
by rmaweb
Thank you for your answer Naveed. That is a pretty neat feature. But now I have another question, lol. The data that is NHibernate is accessing/caching, is that for use only by that user that is browsing that category? Or is the cache used by other browsing people too? And is the cache timeout a relatively short one that won't interfere with daily product updates?

Thank you for your time,
Ryan

Re: Question about NHibernate

Posted: Wed Jun 11, 2014 7:38 am
by Naveed
The data is cached/fetched only for current nhibernate session. We usually use one session per http request, so you can safely assume it is cached for only one browser request. Next time the page is loaded, it will use a new nhibernate session and will again access the database.