473,407 Members | 2,676 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,407 software developers and data experts.

Asp and Application.lock

What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.

Apr 10 '07 #1
5 2431
As everything else, it is bad if misused. It is good for ensuring data
integrity on short operations. But it locks the application and forces other
requests to queue up. A sort of bottleneck.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<Je*************@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.

Apr 10 '07 #2
Access to the Application object is serialized to prevent the corruption
which could occur if more than one user writes to it at the same time.

The requests to modify application variables are queued up,
and they are given access in the order they were received.

That reduces performance somewhat, but prevents data corruption.

You should try to avoid letting users change application variables.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<Je*************@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.

Apr 10 '07 #3
On Apr 10, 11:27 am, "Juan T. Llibre" <nomailrepl...@nowhere.com>
wrote:
Access to the Application object is serialized to prevent the corruption
which could occur if more than one user writes to it at the same time.

The requests to modify application variables are queued up,
and they are given access in the order they were received.

That reduces performance somewhat, but prevents data corruption.

You should try to avoid letting users change application variables.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================<Jennifer.Ber.. .@gmail.comwrote in message

news:11**********************@w1g2000hsg.googlegro ups.com...
What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.- Hide quoted text -

- Show quoted text -
Well see....we had a huge bottleneck where the server rose up to 94%
usage and it was due to an application.lock command in a global.asa
file. It is for a visitor counter...

Apr 10 '07 #4
re:
It is for a visitor counter...
One of the flimsiest reasons to use Application.Lock.

I'd prefer to write to a text file which, even though it's also serialized,
creates far less contention than going through Application.Lock/Unlock.

There's a fairly decent sample you could adapt here :
http://www.asp101.com/samples/counter_aspx.asp

And there's another sample here :
http://www.codeproject.com/aspnet/EasyHit.asp

Adapt either one. Either that, or use a commercial counter.
Use *anything*, except code that uses Application.Lock/Unlock.

;-)


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<Je*************@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
On Apr 10, 11:27 am, "Juan T. Llibre" <nomailrepl...@nowhere.com>
wrote:
Access to the Application object is serialized to prevent the corruption
which could occur if more than one user writes to it at the same time.

The requests to modify application variables are queued up,
and they are given access in the order they were received.

That reduces performance somewhat, but prevents data corruption.

You should try to avoid letting users change application variables.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================<Jennifer.Ber.. .@gmail.comwrote in message

news:11**********************@w1g2000hsg.googlegro ups.com...
What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.
Well see....we had a huge bottleneck where the server rose up to 94%
usage and it was due to an application.lock command in a global.asa
file. It is for a visitor counter...
Apr 10 '07 #5
On Apr 10, 2:16 pm, "Juan T. Llibre" <nomailrepl...@nowhere.com>
wrote:
re:
It is for a visitor counter...

One of the flimsiest reasons to use Application.Lock.

I'd prefer to write to a text file which, even though it's also serialized,
creates far less contention than going through Application.Lock/Unlock.

There's a fairly decent sample you could adapt here :http://www.asp101.com/samples/counter_aspx.asp

And there's another sample here :http://www.codeproject.com/aspnet/EasyHit.asp

Adapt either one. Either that, or use a commercial counter.
Use *anything*, except code that uses Application.Lock/Unlock.

;-)

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================<Jennifer.Ber.. .@gmail.comwrote in message

news:11*********************@q75g2000hsh.googlegro ups.com...
On Apr 10, 11:27 am, "Juan T. Llibre" <nomailrepl...@nowhere.com>
wrote:


Access to the Application object is serialized to prevent the corruption
which could occur if more than one user writes to it at the same time.
The requests to modify application variables are queued up,
and they are given access in the order they were received.
That reduces performance somewhat, but prevents data corruption.
You should try to avoid letting users change application variables.
Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
===================================<Jennifer.Ber.. .@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
What is it exactly that makes application.lock such a bad thing? I
just need a better explanation or link to a resource desribing it's
downfall.

Well see....we had a huge bottleneck where the server rose up to 94%
usage and it was due to an application.lock command in a global.asa
file. It is for a visitor counter...- Hide quoted text -

- Show quoted text -
I agree...I'm the administrator but because I used to be a developer I
have become quite useful to the company because I can point out errors
in the coding. I just needed a solid answer to application.lock. I
was always taught it was a "no no" and to never do so I never really
looked into it further. Thanks!

Apr 11 '07 #6

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

Similar topics

9
by: J. Baute | last post by:
I'm caching data in the Application object to speed up certain pages on a website The main reason is that the retrieval of this data takes quite a while (a few seconds) and fetching the same data...
10
by: florian | last post by:
Hi, we have a contention problem because of an application which tries to insert a duplicate row in a table with primary key. This insert fails of course but the locks are not released within...
4
by: Eidolon | last post by:
Quick question about Application.Lock()... When you lock the application, does it still allow read access, or does it deny read as well as write? thanks in advance, - Aaron.
2
by: zorro | last post by:
Hello there, To lock or not to lock, that is my question... I have an arrayList in my application object. The arrayList contains objects of a class that I defined. I have my own mechanisms...
5
by: Homer J. Simpson | last post by:
Hi, Any idea to get the -REAL- number of active users -WITHOUT- this kind of code ? ---------------------------------------------------------------------------- --------- Sub Session_OnStart...
4
by: John Cosmas | last post by:
I need to execute some threads that load items into my APPLICATION object. I haven't figured out how to do that when I fire off a thread on a page, that takes its time and loads data into the...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
0
by: rkumar4acc | last post by:
Hi, We are encountering frequent deadlock- timout issues in QA Databases.Further looking into the lock snapshot, it seems that there is an agentID with appl hande ID as 0 and also we are not able...
6
by: DaveRook | last post by:
Hi I have some code from a friend and I don't understand why they have used the application lock feature! I understand this produces a random quote, but can some one explain to me what happens...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.