Link to home
Start Free TrialLog in
Avatar of RICHARDH
RICHARDH

asked on

Application variables.

I am writing a little chat program using ASP and am thinking about using an Application variable to store all of the messages. I will restrict the number of lines of text to the last ten only.

Is there any server performance issue I should be aware of that would make this a silly idea. If this is the case then can you please suggest an alternative approach.

Thanks for the help

Richard.H
Avatar of enkay022798
enkay022798

The only server performance issue with Application variables that I think sometimes is that when you write to an App variable you need to lock it so access to it by multiple processes becomes serial. Other than this I have used app variables in a bunch of asp applications... never had ne great problem with performance.
application variable re the best for chats...
all other possibilities i can think of have more performance issues...

regards,

ASPGuru
Avatar of RICHARDH

ASKER

Thanks for the comments guys. You mentioned the fact that you need to Lock the application variable so that requests become serial, how is that achieved.

Thanks again for the advice.
ASKER CERTIFIED SOLUTION
Avatar of ASPGuru
ASPGuru

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
here's a function for adding lines to the appl. obj. and also handles the locking....

note, that this is faster, than the solution you graded in the other Q, so i suggest you use this...

<%
sub addMessage(message)
 dim buffer
 buffer = Application("theChat")
 if buffer<>"" then buffer = buffer & vbCrLf
 buffer = buffer & message
 dim p,n
 n = 0 : p = -1
 do while n<10 and p<>0 'take just the last 10 lines
   p = InStrRev(buffer,vbCrLf,p)
   if p<>0 then n = n + 1
 loop
 if p<>0 then buffer = mid(buffer,p+2)
 Application.lock
 Application("theChat") = buffer
 Application.unlock
end sub

addMessage "test1"
addMessage "test2"
addMessage "test3"
addMessage "test4"
addMessage "test5"
addMessage "test6"
addMessage "test7"
addMessage "test8"
addMessage "test9"
addMessage "test10"
addMessage "test11"
addMessage "test12"
addMessage "test13"
addMessage "test14"
addMessage "test15"
Response.Write "<pre>" & Application("theChat") & "</pre>"
%>
Excellent article on 15Seconds.com regarding the use of the Application Object.

Using the Application Object to Improve Performance
http://www.15seconds.com/Issue/010511.htm
RICHARDH:

You have many open questions:

https://www.experts-exchange.com/jsp/qShow.jsp?qid=11342298
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11355858
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11382838
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11415199
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11670638
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20001107
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20004454
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20065368
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20073152
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20084825
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20084821
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20086663
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20086784
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20107892
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109405
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109357
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109887
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20110886
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20117400
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118020
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118934
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118648
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11342618
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20130049
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20132692
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20142937
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20146293
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20147289
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20148615
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20149087
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20148609
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20150501
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20150630
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154720
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154865
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154980
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20155947
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20180018
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20189434
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193459
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20222409
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20235436
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20244279
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20244276
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193051
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20256056
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20257136
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20257135
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20127746
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20259971
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20259964

To assist you in your cleanup, I'm providing the following guidelines:

1.  Stay active in your questions and provide feedback whenever possible. Likewise, when feedback has not been provided by the experts, commenting again makes them receive an email notification, and they may provide you with further information. Experts have no other method of searching for questions in which they have commented, except manually.

2.  Award points by hitting the Accept Comment As Answer button located above and to the left of that expert's comment.

3.  When grading, be sure to read:
https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
to ensure that you understand the grading system here at EE. If you grade less than an A, you must explain why.

4.  Questions that were not helpful to you should be PAQ'd (stored in the database for their valuable content?even if not valuable to you) or deleted. To PAQ or delete a question, you must first post your intent in that question to make the experts aware. Then, if no experts object after three full days, you can post a zero-point question at community support to request deletion or PAQ. Please include the link(s) to the question(s).
CS:  https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
At that point, a moderator can refund your points and PAQ or delete the question for you. The delete button does not work.

5.  If you fail to respond to this cleanup request, I must report you to the Community Support Administrator for further action.

Our intent is to get the questions cleaned up, and not to embarrass or shame anyone. If you have any questions or need further assistance at all, feel free to ask me in this question or post a zero-point question at CS. We are very happy to help you in this task!


thanks!
amp
community support moderator

1/27
Sorry for the delay in crediting.
Thanks for the help.
Problem now solved.

Richard