473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Good Design Practice Question

I'm fairly new to programming, that said, I know how to 'program', but my
question is about design.

How big and what sort of objects should be stored in Session.

I'm doing an e-commerce website, and I've created an xsd based around the
shopping cart, customers details and the order's tables. The resulting
dataset is then populated accordingly and stored in session.

Is this bad news? I ask because the articles I read suggest limiting the
number of database hits... but then also say that the session object should
not be used excessively.

It's obviously about getting a balance, but how do I tell? Look at the task
manager to see how much memory the aspnet_wp worker process is using. About
50,000kbs... kind of feels too much

Nov 17 '05 #1
2 2007
Databases are meant to be used for reliable, scalable and fast data-access. When you read that it is best to keep the database hits
to a minimum there is a discrepency about what actually is considered "minimum". If your site is not expecting alot of hits, say
under 100 concurrently, then accessing the database will not be your bottle neck on a server that is of a descant calliber,
especially when the amount of data being sent and retrieved can be done in a single batch. Also, using stored procedures will
greatly increase the effeciency of your database hits.

1) Use stored procedures to read/write the data from the dataset
2) Keep the "hits" to a minimum by making the "least" amount of calls to the database
3) Keep the effiecency maxed by only pulling/saving what is needed in context. i.e., don't just SELECT * FROM customers if you only
need one customer. (if you forsee requiring more customers in a single context, then it may be better to make one hit immediately
to get all of them. This is a trade-off for db hits --> data transfer speed and memory usage.)
4) Data Access Appication Blocks for .NET show how parameter caching can add to the effeciency of using a database.
5) Ensure that your database server is configured to properly handle the largest load you expect. Isolating this server is always
better, when possible. (i.e. Keep the web server and database servers on physically seperate machines)

Session state is usefull for minimizing database hits and reducing the amount of times you have to "munge" the data before it's
usable directly from the Db.

1) Use session state when the data being read from/written to the database is being changed dramattically on the client (which in
this case, is the web server). This aids in performance of your application since applying business rules to data, when this is a
heavy process, will only need to occur once.
2) Data stored in the session can be located in a few different places. Choose the best config that meets the needs of your app.
(check out session state inproc, stateserver and sqlserver)

There are pleanty of points I have not listed above. The list was meant to show you how there can't be a general-purpose answer for
your question. It really depends on alot of factors, all though you will hear people argue one way or the other without knowing all
of the facts I've mentioned above.

Making assumtions can be dangerous, so using ACT or other testing tools will also be in your favor.

Wade in the facts for a bit, choose what you believe is the best solution, and test it until it crumbles. You'll get an idea of
what solution will be best in your particular situation.
--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Calvin" <ca****@discussions.microsoft.com> wrote in message news:BE9DE5AE.18D2%ca****@discussions.microsoft.co m...
I'm fairly new to programming, that said, I know how to 'program', but my
question is about design.

How big and what sort of objects should be stored in Session.

I'm doing an e-commerce website, and I've created an xsd based around the
shopping cart, customers details and the order's tables. The resulting
dataset is then populated accordingly and stored in session.

Is this bad news? I ask because the articles I read suggest limiting the
number of database hits... but then also say that the session object should
not be used excessively.

It's obviously about getting a balance, but how do I tell? Look at the task
manager to see how much memory the aspnet_wp worker process is using. About
50,000kbs... kind of feels too much

Nov 17 '05 #2
Thanks Dave,

I'll stick with what I've done and see how it goes, it seems to be working
well at the moment.
On 4/5/05 9:46 am, in article uM**************@TK2MSFTNGP09.phx.gbl, "Dave"
<NO*********@dotcomdatasolutions.com> wrote:
Databases are meant to be used for reliable, scalable and fast data-access.
When you read that it is best to keep the database hits
to a minimum there is a discrepency about what actually is considered
"minimum". If your site is not expecting alot of hits, say
under 100 concurrently, then accessing the database will not be your bottle
neck on a server that is of a descant calliber,
especially when the amount of data being sent and retrieved can be done in a
single batch. Also, using stored procedures will
greatly increase the effeciency of your database hits.

1) Use stored procedures to read/write the data from the dataset
2) Keep the "hits" to a minimum by making the "least" amount of calls to the
database
3) Keep the effiecency maxed by only pulling/saving what is needed in context.
i.e., don't just SELECT * FROM customers if you only
need one customer. (if you forsee requiring more customers in a single
context, then it may be better to make one hit immediately
to get all of them. This is a trade-off for db hits --> data transfer speed
and memory usage.)
4) Data Access Appication Blocks for .NET show how parameter caching can add
to the effeciency of using a database.
5) Ensure that your database server is configured to properly handle the
largest load you expect. Isolating this server is always
better, when possible. (i.e. Keep the web server and database servers on
physically seperate machines)

Session state is usefull for minimizing database hits and reducing the amount
of times you have to "munge" the data before it's
usable directly from the Db.

1) Use session state when the data being read from/written to the database is
being changed dramattically on the client (which in
this case, is the web server). This aids in performance of your application
since applying business rules to data, when this is a
heavy process, will only need to occur once.
2) Data stored in the session can be located in a few different places.
Choose the best config that meets the needs of your app.
(check out session state inproc, stateserver and sqlserver)

There are pleanty of points I have not listed above. The list was meant to
show you how there can't be a general-purpose answer for
your question. It really depends on alot of factors, all though you will hear
people argue one way or the other without knowing all
of the facts I've mentioned above.

Making assumtions can be dangerous, so using ACT or other testing tools will
also be in your favor.

Wade in the facts for a bit, choose what you believe is the best solution, and
test it until it crumbles. You'll get an idea of
what solution will be best in your particular situation.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: matty | last post by:
Go away for a few days and you miss it all... A few opinions... Programming is a craft more than an art (software engineering, not black magic) and as such, is about writing code that works,...
2
by: ggg | last post by:
I'm looking for a complete project/application done with heavy use of of object-oriented programming & design. Preferably something well documented and/or commented so that I can pick it apart...
3
by: Erik De Keyser | last post by:
Hi group, I have a couple of projects with up to 8 forms. On most projects I write the code on each form with no modules. The last project I use 1 module and minimal code on each form , in fact...
7
by: farseer | last post by:
Here is the scenario: I have an interface which defines get methods for data that will make up a row in a table. However, the source of this data may, over time, switch/change (The company may...
2
by: Sky Sigal | last post by:
Hello: I'm currently messing around, and need as much feedback/help as I can get, trying to find the most economical/graceful way to build usercontrols that rely on styling to look any good... ...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
24
by: Gaijinco | last post by:
I found one of that problems all of us have solve when they begin programming: given 3 numbers print the greater and the lesser one of the set. I was trying to remember the if-then-else...
19
by: JoeC | last post by:
I have seen many books that teack coding for C++. What are ways to improve my techniques for writing larger programs. I have written many demo programs learning some aspects of code wether it be...
6
by: MLH | last post by:
I have frmMainMenu with the following two code lines invoked on a button click... 2420 DoCmd.OpenForm "frmVehicleEntryForm", A_NORMAL, , , A_ADD, A_NORMAL 2440 DoCmd.GoToRecord , , A_NEWREC ...
5
by: macca | last post by:
Hi, I'm looking for a good book on PHP design patterns for a OOP beginner - Reccommendations please? Thanks Paul
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.