Recently Armanovers were asked to migrate a module from Oracle Forms Builder to an ASP.NET + AJAX web app for PoC (Proof-of-Concepts) purposes.
Because of the short timeframe (5 days), we decided to use Castle ActiveRecord for the Data Access Layer. Turns out we had to deal with 107 Oracle Tables, so our decision for going with ActiveRecord was a huge time-saver :)
Kudos goes to Renggo, the armanover who created the generator for the Oracle-to-C# class mapping files.
First Demo: 1 module, performance good (within 1 second getting data from Oracle).
Second Demo: 2 modules, performance was 4 seconds to get data from Oracle.
Where did we go wrong with the second module? Well, at first we used NHibernate’s ICriteria and a mix of LINQ, could this be the problem?
So we fired up Ayende’s NHibernate Profiler (NHProf) and decided to peek into the generated queries:
Do you see the problems? Some queries are actually returning more-than-1-row, especially the one that returns 2084 rows!
So then we converted all queries into LINQ queries, and this is what happens next:
Every query just returned 1 row instead! Of course we could improve the performance further by probably squashing the above multiple SELECTs into one long SELECT, but at the time NHibernate-to-LINQ provider didn’t support JOIN keyword yet (and we didn’t want to specify that very long query in HQL).
Calling 16 Entities from Oracle server in Surabaya to a developer PC in Jakarta within 0.9 seconds is pretty fast I think :)
I think I’m gonna buy NHibernate Profiler soon (awaiting my Finance Controller’s approval). Btw, if you too wanna get NHProf, I suggest you subscribe to Rob Conery & Ayende Rahien’s Mastering NHibernate screencasts (http://www.tekpub.com/preview/nhibernate) to get a Euro50 discount code (NHProf costs Euro200).
NHibernate + NHProf = leaving developers to focus on business-related codes and optimization, good bye handcrafted/not-invented-here DALs.
NHibernate + NHProf is also a proof of how great an opensource project can be and how an opensource developer can make money from it (this point is emphasized for MS-MVP-***-University of Indonesia’s lecturer, om Agus Kurniawan hehehe)