Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Stored Procedure Vs Business Logic Layer QuestionStored Procedure Vs Business Logic Layer Question
Previous
 
Next
New Post
10/11/2006 2:12 PM
 
I'm converting an existing appointment calendar to a DNN module. A single recurring appointment can often create hundreds or thousands of database records.

To avoid many thousands of database calls the existing application sends a single record to a Stored Procedure. This Stored Procedure contains the logic to split and save the recurring appointment into individual dates.

It is unlikely that we will ever use anything other then MSSQL so portability is not an big issue. Also the MSSQL database is located on a separate server so that may be a factor too.

My gut tells me to keep the logic in the SP but that goes against the concept of n-tier design.
I haven't been able to find anything that talks about exceptions to placing all the logic in the BLL so I thought I would ask your opinion before making a decision.
 
New Post
10/11/2006 5:53 PM
 
You should always keep the communications between the database and your app down to a minimum. If you can send all your data to the database in one call I say go for it. Let the stored procedure do all the work! I'm not sure why you wouldn't? But I never really use a DAL or BL.

And why don't I?

Look at how many connections are made just for one empty DNN page to load, about 10 to 15? Surely there must be a lot of excessive DAL and BL going on there that could be streamlined into maybe 3 calls. For example, you shouldn't need to pull the entire user roles table in for each page load, and I'm 99% sure DNN does.

Jason Honingford - Web & Software Developer
www.PortVista.com
 
New Post
10/12/2006 6:09 AM
 

1. Why store thousands records in DB for recurring meeting?
I'm sure there must me elegant way to solve this with one record...

2. Using layer seperation increases your flexbility and reduces your performance.
For complex and large application i would always use DAL and BLL.
Remember that each DB call is taken from the connection pool and no
new connection is being opened.
To avoid to much DB call try use extensive and smart cache.

For example, hold in cache the calendar data of X popular users,
as long as they don't update their calendar - don't even make db call...
when they write new data to calendar - updaet the cache,
that way you almost never read calendar data from db , you just write.


 
New Post
10/12/2006 8:51 AM
 
I guess you're right -- the same session opening and closing "connections" aren't really opening new db connections, so maybe I'm wrong on that. The number of reads and writes is probably the only important factor to performance.

Jason Honingford - Web & Software Developer
www.PortVista.com
 
New Post
10/12/2006 9:15 AM
 
johnyG wrote

1. Why store thousands records in DB for recurring meeting?
I'm sure there must me elegant way to solve this with one record...



Thanks for the input.
These calendars are used for large multi-group medical offices. The data changes continuously during business hours so caching isn't practical.

I split the recurring appointments when they are added for performance reasons. The appointment is added once but read many times. If someone is viewing the appointments for a given day the application doesn't have to re-evaluate every recurring appointment that could potentially fall on that date.

There are other advantages to separating recurring events too, such as conflict checking and the ability to modify a single date within a recurring set. The database is normalized so most of the appointment data is stored only once.

I think I found a good compromise to my problem. I will move the logic to the BLL but instead of making many calls to the database I will send a single comma delimited string to the database. The Stored Procedure will parse this string to create the records. BLL is happy and I can still use transaction processing in the Stored Procedure insure that the entire recurring set was added correctly.

Questions and comments welcome.

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Stored Procedure Vs Business Logic Layer QuestionStored Procedure Vs Business Logic Layer Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out