4

We have a pretty sizable .NET rich client app that currently uses nHibernate and Firebird embedded for persistence. Due to the nature of the app, we need to load the entire database into memory when the file is loaded, so we get all the costs of an ORM without many of the benefits. The main benefit we do get is the ability to write upgrade code to transition the structure of the data between versions.

We're finding that this setup is both slow and memory intensive (unsurprisingly, given that we're not using it as intended). We could move to a document/KVP DB, but again, given that we're not doing any on-demand loading or searching, it doesn't feel like the right solution.

I've toyed with the idea of binary serialization and somehow archiving off the 'persistence' namespace so that we could load an old format, but it seems a bit of a convoluted approach to what I would think would be a common problem.

What are our options?

  • 1
    It's hard to give a good answer to this without more detail. How is you application architectured? Why do you need to load everything; is it because the client will need all the data eventually? Is the data largely interweaved/interdependent? I have an answer in mind but I am afraid it will be donwvoted for being to general. – TheCatWhisperer Jun 12 '15 at 13:01
  • Essentially, it's simulation app where users are either editing or running the model. Running requires everything to be loaded, and it's very rare that a user edits without running afterwards. We decided to front-load the IO cost rather than leaving it until the first run. Hope that clarifies things. – Ben Hughes Jun 13 '15 at 23:21
  • Thanks, and how is your application currently architechtured? – TheCatWhisperer Jun 16 '15 at 12:30
  • Why not just skip the ORM and read and write direct to DB? – paparazzo Jun 19 '15 at 11:56
  • For a couple of reasons. Firstly, it won't solve our issue (we'd still be loading every row out of the DB) plus we'd have to hand-craft the SQL to do it. I'm not sure it would give us anything, especially for the effort involved. – Ben Hughes Jun 20 '15 at 12:43
2

For info, I went down the binary serialization path, with a light-weight mapping structure between the domain and the serializer. Initial, unoptimized tests have it at about 40% faster than nHibernate.

I'm hoping to get approval to open source it - if I do I'll edit this answer with the details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.