Truong Hong Thi said:
I think creating a new thread for each request is not the recommended
way since you don't know how many requests there might be. That harms
the app's scalability very much.
yes, I am thinking in the same direction. More over user computer is limited
to the amount of RAM they can have.
The second option to cache data (for
example, for the next month) sounds better.
I can pull 3 months (one each way) but again the problem is limited amount
of memory. On a avg one month worth of data goes anywhere between 15000 to
25000 records (many have blob). It will kill user machine, which I guess
will not have more than 128MB of RAM shared between other apps (e.g. word,
excel etc).
The UI should also provides
an easy way for user to jump to a specific month instead of constantly
click "next" or something like that.
There are 2 options, direct jump to the month and click next. Cause of UI
guidelines I can't take away next from them. So basically I got to find a
way to live with it.
As always, measure to see if there
is really any performance gain when you try an improvement.
Performance is great if I pull the data for 3 months locally and do a
forward cacha for future request. DB responce time is bottleneck here. SPs
do not return records fast, more because records are mixed of text and blob
and DB is a very busy DB with these kind of requests.
Regarding "lock" (that is, the Monitor class), once one thread
successfully acquire a lock on an object, other threads requesting lock
on the same object will have to busy wait (no timeout applied) until
the owning thread release it.
That is not good, it might turn into a big deadlock.