ActiveRecord and NHibernate second level cache

Wow!!! NHibernate second level cache rocks!. Before enabling the NHibernate second level cache in my Castle web application, a controller accesing several models in the database delayed about 40 seconds in process and render a request. This becomes the application useless but is comprehensible, is the cost of relational objects because Im accesing the database several times with my objects and their relations. Thanks to the second level cache and the easy method to enable it in my ActiveRecord models, now the same request is processed in 1 second. Yes! 1 second!!!. I want to say thanks to ActiveRecord and NHibernate hackers (in special to Kevin Williams and Ayende Rahien for the help) for their efforts and really impressive work.

Read this to learn how to enable the cache in ActiveRecord.

  • alok

    Thank you

  • Ena Lark

    You’re Right…..
    I also found it very useful as NHibernate
    second level cache boosts the performance with scalability. By default NHibernate uses first level caching which is Session Object based. But if you are running in a multi-server environment, then the first level cache may not very scalable along with some performance issues. It happens because of the fact that it has to make very frequent trips to the database as the data is distributed over multiple servers. During one of my projects, I found a number of good reads on this particular topic and I am sharing one of them with you people, hopefully it’ll further clear the concept and working of L2 caching.

  • Joel Maitland

    Its fantastic as your other articles : D, thanks for putting up.