Found it - son of the developer ;)

log4net should be set for lower debugging level. Had all, and this was 
generating 1second query time not 120ms as right now.

This was very useful 
http://stackoverflow.com/questions/6777561/nhibernate-criteria-query-slow-in-web-app-but-fast-in-unit-tests-why

Thanks all.

Freud

On Wednesday, October 24, 2012 11:01:58 AM UTC+2, Freud wrote:
>
> Hello,
>
>   I've one query performance problem.
>  
>   I hope you can help me. Even little help should be very very helpful for 
> me - any tip could be great for me. 
>   I have no idea what I can do more.
>
>   So - I try to describe the problem and will be preaciated for answer and 
> any tip, if you will know what could be "wrong".
>
>   The problem I have is about migration web app from NH 2.1.1.4 to NH 
> 3.3.1.4 (ASP.MVC 2 to ASP.MVC 4).
>   It takes two days but is working okay now.
>
>   The problem is with queries performance.
>
>   In the ASP.MVC2 and NH 2.1.1.4 queries was really fast. NHProfiler show 
> 0 or 1 ms time for every second round trip, without second level cache 
> (looks like mysql db query caching).
>   In the ASP.MVC4 and NH 3.x queries are always slower, because NH gets 
> data every time without any caching. So queries takes always some normal 
> (long) time (in ms) (like without any caching).
>
>   I think the point is that previous version of NH was using some kind of 
> not documented caching - some "feature" which was good for me and not 
> controlled consciously or NH3 is not using or making db to not caching 
> anything - really don't know.
>   Now queries are slower because NH3 is getting normally data without any 
> caching.
>
>   Two applications: in MVC2 and MVC3 (NH2 and NH3) has the same logic, the 
> same nh config files, the same connection string and the same DB.
>   The difference is in the NH (FluentNH etc) and MVC versions. 
>
>   I'm just thinking - what was in the NH2, which is not exists in the NH3, 
> that queries was getting faster.
>   I'm using MySQL.Also MySQL .net connector was updated, but tried to use 
> old one in MVC4/NH3 app and the same behaviour.
>
>   Maybe MySQL DB is not using default query cache? But why? MVC2/NH2 app 
> has no problem with it. MVC4/NH3 has different behaviour.
>  
>   Do You have any idea?
>
>   Do you know what can be wrong or what is the difference between those 
> versions of NH, that queries have different query time behaviour?
>   I checked almost everyting. NH config, configuration, sys cache etc. 
> Everything are the same I think - not sure.
>
>   Below is my web config (the same before in NH2 and now in NH3):
>
>   <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">  
>        <session-factory>
>                <property 
> name="connection.connection_string">Server=localhost;Database=db;Uid=root;Pwd=root;Pooling=false</property>
>     <property name="dialect">NHibernate.Dialect.MySQL5Dialect</property>
>     <property 
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
>     <property 
> name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
>     <property name="show_sql">false</property>
>     <property name="connection.release_mode">auto</property>
>     <property name="adonet.batch_size">500</property>
>     <property 
> name="proxyfactory.factory_class">NHibernate.Bytecode.DefaultProxyFactoryFactory,
>  
> NHibernate</property>
>     <property name="hbm2ddl.keywords">auto-quote</property>
>     <property 
> name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, 
> NHibernate.Caches.SysCache</property>
>
>     <property name="cache.use_query_cache">true</property>
>     <property name="cache.use_second_level_cache">false</property>
>     <!--<property name="cache.expiration">300</property>-->
>     <!--<property 
> name="cache.provider_class">NHibernate.Caches.MemCache.MemCacheProvider,NHibernate.Caches.MemCache</property>-->
>   </session-factory>  
> </hibernate-configuration>
>
> Freud
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/23TU7ycdEzoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to