DAL and the nHibernate Question


I have recently been stifled and somewhat annoyed by object persistence when it comes to databases and the .NET framework. On first search of google and NHibernate, several 'tools' pop up which supposedly speed up the development of nHibernate based applications. I tried the Crainiate implementation available at www.crainiate.net

and I was actually impressed by the framework, just not impressed by the actual nHibernate implementation.

My problem with nHibernate is when it is used in high performance desktop applications, ones which are not actually web based. The project I was working on is described by the following:

  • A Flash/Flex GUI front-end
  • A custom COM bridge interface using WDXX .NET
  • A Microsoft access database
  • A DAL using nHibernate

A bottle neck occured which actually caused almost 3/4 seconds of actual delay when pulling updated information back from the database,and All tricks where used, reflection was kept to a minimum. the business logic was a compiled assembly and the XML mapping had all the recommend tweaks but the performance really was dire, to the extent that the project performance was so poor, it was almost dropped.

Through benchmark tests and unit test, the bottle neck was narrowed down to:

  • The JET Driver for MS Access
  • The nHibernate implementation

So I went about rewiriting the framework to better suit our business logic.

I ended up writing and replacing the Access database with a binary dataandstore and serialisable collections. I then converted all HQL queries into methods which sorted the collections into datasets, and used a singleton pattern and static objects to store the collections in memory. The DAL was a 'like-for-like' published interface which resembled the published interface of nHibernate. It allowed us to plug the new DAL implementation directly into the software and hey presto, the software saw a marked improvement in performance. We implemented a threaded subsystem which added more speed to system by deferring updates to the binary database only during idle time.

So the moral of the story is, object persistence in a database is only good when the application isn't mission critical or requires high performance and speed. In those cases, it is better if a DAL is written from scratch, allowing the developer to implement only the features they require to make sure the software runs and works the way it suppose to. It is also my belief that one of the main drawbacks to nHibernate is reflection, as it severely impedes on the performance of Object relation mapping and abstraction.

Search site for '

Ajmal Khan' and all related documents.

Home | Privacy Policy | Site Map | Links | Company | Contact Us | Arena           

We provide cutting edge software development, consultancy and web design services            

There are currently 520 user(s) with 31112 hits.