473,734 Members | 2,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Measuring Session Size

Hi

I'm trying to profile my application and do sizing of the app.
is there a way to size the session ??

--
Logu Krishnan

Mar 23 '07 #1
5 3694
Logu Krishnan wrote:
Hi

I'm trying to profile my application and do sizing of the app.
is there a way to size the session ??

--
Logu Krishnan
If you are worried that the Session objects might be containing too much
data, then you are putting too much data in them.

The Session objects lives for a very long time, compared to most objects
in a web application. The objects used to create a response lives for a
fraction of a second, while a Session object normally lives for at least
20 minutes. The memory resources that you use when creating a response
is used a very short time, but everything you put in the Session object
will occupy memory for a much longer time, therefore you should not put
large objects in the Session object.

If you put a lot of data in the Session objects, the application gets
sensetive to DoS attacks. It's not hard to fool the application to
create a lot of Session objects, and if the Session objects contain a
lot of data, it can easily fill up the memory of the server.

--
Göran Andersson
_____
http://www.guffa.com
Mar 23 '07 #2
Thanks. But, is there a way to measure the amount of memory my session
objects are consuming in the server ?

--
Logu Krishnan

"Göran Andersson" <gu***@guffa.co mwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Logu Krishnan wrote:
>Hi

I'm trying to profile my application and do sizing of the app.
is there a way to size the session ??

--
Logu Krishnan

If you are worried that the Session objects might be containing too much
data, then you are putting too much data in them.

The Session objects lives for a very long time, compared to most objects
in a web application. The objects used to create a response lives for a
fraction of a second, while a Session object normally lives for at least
20 minutes. The memory resources that you use when creating a response is
used a very short time, but everything you put in the Session object will
occupy memory for a much longer time, therefore you should not put large
objects in the Session object.

If you put a lot of data in the Session objects, the application gets
sensetive to DoS attacks. It's not hard to fool the application to create
a lot of Session objects, and if the Session objects contain a lot of
data, it can easily fill up the memory of the server.

--
Göran Andersson
_____
http://www.guffa.com

Mar 23 '07 #3
Hi Göran,

Whilst I agree with your drift, I think it's worth making a couple of
points, even though they don't address the OP's concerns directly. Firstly,
it is the purpose of the Session to be long lived, so it is reasonable to
store in it any objects that need to stay alive while ever the Session stays
alive. These might be quite large contstructs that represent the state of
the objects in the application: but if you need them, you need them. Of
course, the Session object itself will only store references to such
objects, so the Session may not actually be very large. However, the
referenced objects may be taking up a lot of room on the heap. Developers
need to be aware of this, and take steps to destroy objects that they have
finished with.

Secondly, and in passing, virtual memory on modern servers is huge. Objects
on the heap that are only used infrequently will be swapped out if
necessary, so they won't be eating much (as my grandmother used to say).
Getting them back when they are needed might slow an application down
fractionally, but not enough for a user to notice.

Lastly, of course, developers should set the Session timeout value to
something that makes sense for their application. It might be quite a bit
shorter than 20 minutes - or quite a bit longer, of course. Ten minutes
might be adequate for some applicaitons.

Just my 2c. YMMV.
Peter

"Göran Andersson" <gu***@guffa.co mwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Logu Krishnan wrote:
>Hi

I'm trying to profile my application and do sizing of the app.
is there a way to size the session ??

--
Logu Krishnan

If you are worried that the Session objects might be containing too much
data, then you are putting too much data in them.

The Session objects lives for a very long time, compared to most objects
in a web application. The objects used to create a response lives for a
fraction of a second, while a Session object normally lives for at least
20 minutes. The memory resources that you use when creating a response is
used a very short time, but everything you put in the Session object will
occupy memory for a much longer time, therefore you should not put large
objects in the Session object.

If you put a lot of data in the Session objects, the application gets
sensetive to DoS attacks. It's not hard to fool the application to create
a lot of Session objects, and if the Session objects contain a lot of
data, it can easily fill up the memory of the server.

--
Göran Andersson
_____
http://www.guffa.com

Mar 23 '07 #4
Not sure, but if you are concerned about memory consumption you can get a
simple (not very accurate) "drive by" idea by looking at the VM Size of the
ASP.NET worker process in Task Manager.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Logu Krishnan" wrote:
Hi

I'm trying to profile my application and do sizing of the app.
is there a way to size the session ??

--
Logu Krishnan

Mar 23 '07 #5
Peter Bradley wrote:
Hi Göran,

Whilst I agree with your drift, I think it's worth making a couple of
points, even though they don't address the OP's concerns directly. Firstly,
it is the purpose of the Session to be long lived, so it is reasonable to
store in it any objects that need to stay alive while ever the Session stays
alive. These might be quite large contstructs that represent the state of
the objects in the application: but if you need them, you need them.
But there is rarely an absolute need to have things in memory. If the
data comes from a database, you can just store the user id in a session
variable, and fetch whatever you need from the database when you need
it. If the data is any important, you wouldn't want to only keep it in
such a volatile place as a session variable anyway.

A database is of course not as fast as having everything in memory, but
it's scalable. If each user has a large object in a session variable,
you can only serve a specific number of users on the server (free_mem /
object_size), while if you keep the data in the database, the number of
users is practically unlimited.

In reality the optimal balance between performance and scalabilty is
somewhere in the middle. You can't fetch everything from the database as
it's too slow, and you can't keep everything in memory as it runs out.
Of
course, the Session object itself will only store references to such
objects, so the Session may not actually be very large. However, the
referenced objects may be taking up a lot of room on the heap. Developers
need to be aware of this, and take steps to destroy objects that they have
finished with.

Secondly, and in passing, virtual memory on modern servers is huge. Objects
on the heap that are only used infrequently will be swapped out if
necessary, so they won't be eating much (as my grandmother used to say).
Getting them back when they are needed might slow an application down
fractionally, but not enough for a user to notice.
True, but the amount of memory is also a resource that has an absolute
limit. If you are out of memory, the server doesn't serve any more.
Lastly, of course, developers should set the Session timeout value to
something that makes sense for their application. It might be quite a bit
shorter than 20 minutes - or quite a bit longer, of course. Ten minutes
might be adequate for some applicaitons.

Just my 2c. YMMV.
Peter
--
Göran Andersson
_____
http://www.guffa.com
Mar 24 '07 #6

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

Similar topics

18
2873
by: Peter Mount | last post by:
Hello I've started using CSS more in the last couple of weeks and in the last week I've started using em units. Are there any rulers I download that can show measurements in em units or is there another way of showing a graphical representation of em units in a simple manner. I know that an em unit is based on the size of the default font in the body of the web page and I've been placing temporary coloured borders in containers to get...
2
1098
by: Guadala Harry | last post by:
Just wondering if/how it is possible to measure how much memory (physical and/or virtual) is used by objects stored in 1. Cache object 2. Application State 3. Session States (across all current sessions of an application) 4. Output Cache (Page/Control caching) Thanks
1
2406
by: Bill Cohagan | last post by:
We are attempting to convert an already existing application over to using multiple worker processes; thus we need to store state via session state server rather than in process. Since this app previously used in process state there was little back pressure against storing objects in the session. Now we're paying the price because serialization sucks in referenced objects resulting in possibly huge state storage and serialize/deserialize...
9
9778
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later retrieve the image from the session object, convert it back to an image, and re-save it to the database? Thanks?
3
3517
by: Lee Moore | last post by:
I have some user controls defined that represent a common header and footer for a particular site. the footer contains links with querystring parameters based on session variables. The problem is, I cannot access the session variables within my user control. The user controls work perfectly otherwise. Example code included.
0
2476
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of product (ie. Wine, Cheese, etc...)
1
2601
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking name of that file from attaching file page to email page through in session file .i am giving a facility of attaching five files to user . and i am taking names of both files in session variables but user attach less than five five
2
399
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page that gets redirected to, I've swapped in a simple page for testing that reads the session variables and displays their values.
9
1922
by: karthi84 | last post by:
hi, i have used session in my .net project. its version is 1.1, when ever i load that page i get the following error, Server Error in '/Alfi/invoice generation/WebApplication1' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated...
0
8946
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.