Optimization Question

Optimization Question

Old forum URL: forums.lhotka.net/forums/t/7967.aspx


Phlar posted on Tuesday, November 10, 2009

Hi All,

I have a generic optimization question.  We currently have 117 distinct configuration settings (i.e. Combo boxes) with a total of 773 records to retrieve and create ReadOnlyListBase and ReadOnlyBase objects.

Is it more optimal to load and construct these objects at project start up or retrieve them as required on a Web Page/Win Form/WPF Window basis as required?

Thoughts?

RockfordLhotka replied on Tuesday, November 10, 2009

That's a difficult question to answer in the abstract.

Magenic is working with a client to build an app where nearly all their config settings are in one huge SQL table. They suck that table into memory (as an ROLB) when the app starts up, and generate distinct NVL objects (and some ROLB objects) off that cached in-memory collection.

So that's certainly one option.

Another is to "trickle load" the data - load each NVL on demand, and then cache it once loaded. So the user never sees a multi-second delay while all the data is loaded, instead the load cost is defrayed over time.

The problem with this second model, is if you have a form with, say, 20 combobox controls, that first on demand load of 20 NVL objects could be slow.

The solution to that is to use a unit of work pattern. Have one ROB object with 20 properties - each property being one of the NVL objects. Then the UI can make one data portal call to get this ROB, and it ends up with the 20 NVL objects, all in one chunk. Much more efficient.

Phlar replied on Tuesday, November 10, 2009

Thanks Rocky,

Our configuration settings span 3 SQL tables (based on language and filter options).  Initially we have the application designed to load the objects on demand.  I like your idea of the "trickle load" but I agree the initial page load will be costly.  However, I am still leaning on the initial load on start-up as this (potentially) reduces the network traffic.

Another consideration is the expiration (and frequency) of the NVL to ensure the application has the most up to date values contained in the database.

 

Copyright (c) Marimer LLC