0

In my case, I have a custom forum shared among several users in asp.net and C#. I found the loading process pretty costly (several tables joined for different purposes). The users can modify and add new entries. But I don't want to load the object per user. Considering that the static variables - especially when editable- are not thread safe. I wonder what is the best practice to do so.

1
  • If you run the application on web garden or web farm, you can not use static to keep modified data, only for read only data because each static can be different on each request. Commented Jun 26, 2013 at 19:28

1 Answer 1

2

There is a short answer... and a very long answer to this question. The long answer can be found over on programmers.stackexchange.com the short answer is what I'll give you here.

I would recommend (very conditionally as I don't know the nature of the query) that you create a view in your database for that complicated join, the reason being that the database will cache the view for you and will update it every time the tables touched by the query are updated. This would mean that you only have to do a query for that view and not the massively complicated query you're doing now. Mind you this is a short term solution, if your user count grows this will likely cause your DB to start chewing CPU and ram.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you Mgetz for the answer. Could you point to the url address of the long answer? I think view would solve the problem temporarily as you mentioned but I am up for the long answer. Thank you.
It was more of an "in general" long answer, as architecture is discussed over on Programmers. But if you're looking for a specific answer I would highly suggest reading Implementing Domain Driven Design by Vaughn Vernon
Thanks for the suggestion, I took a look at the content table. Now I got what you meant by long answer ;)
Unfortunately the long answer is usually architectural change, but that is rarely the answer people want in the short term. Given that this seems to be limited to a few users you can probably scrape by with the answer above for now.
True. At least I realized there is no short cut. Initially I thought there is a simple point I am missing. Anyway, I have a long weekend ahead and the book looks like a good read. will try and see how far can I dig into it. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.