Can I update Application("SomeVariableName") on server A in response to user's action on server B? There is no problem in updating the same variable on server B, of course, but we would like both variables to be in sync since users can view the value stored on arbitrary server.

So far I have tried server.execute and server.transer to execute script updating Application("SomeVariableName") value on server A in response to user's action on server B but these methods didn't work - documentation conformed it.

Is there another, perhaps some creative way of doing it?

Re: Update Application value on multiple servers? by Tom

Tom
Mon Jul 19 14:01:11 CDT 2004

"Art" <Art@discussions.microsoft.com> wrote in message
news:13EE1D5E-F3B0-4F91-936C-A3FCE417273A@microsoft.com...
> Can I update Application("SomeVariableName") on server A in response to
user's action on server B? There is no problem in updating the same variable
on server B, of course, but we would like both variables to be in sync since
users can view the value stored on arbitrary server.
>
> So far I have tried server.execute and server.transer to execute script
updating Application("SomeVariableName") value on server A in response to
user's action on server B but these methods didn't work - documentation
conformed it.
>
> Is there another, perhaps some creative way of doing it?

Store the value in a database.

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserver2003/community/centers/iis/
http://mvp.support.microsoft.com/
http://www.iisfaq.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://www.tryiis.com



Re: Update Application value on multiple servers? by Aaron

Aaron
Mon Jul 19 15:24:16 CDT 2004

Maybe you misunderstood Tom's point. You would only hit the DB when
application_onstart is fired, e.g. in Global.asa:

Sub Application_OnStart()
Set conn = CreateObject("ADODB.Connection")
conn.open "<connection string>"
set rs = conn.execute("SELECT ConstantValue FROM Constants WHERE
ConstantName = 'foo'")
application("foo") = rs(0)
rs.close: set rs = nothing
conn.close: set conn = nothing
End Sub

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Art" <Art@discussions.microsoft.com> wrote in message
news:6D707C6C-86EC-4490-9326-F160C7DECD71@microsoft.com...
> Tom,
> Thanks for your help but our point was to avoid hitting the DB.
>
> "Tom Kaminski [MVP]" wrote:
>
> > "Art" <Art@discussions.microsoft.com> wrote in message
> > news:13EE1D5E-F3B0-4F91-936C-A3FCE417273A@microsoft.com...
> > > Can I update Application("SomeVariableName") on server A in response
to
> > user's action on server B? There is no problem in updating the same
variable
> > on server B, of course, but we would like both variables to be in sync
since
> > users can view the value stored on arbitrary server.
> > >
> > > So far I have tried server.execute and server.transer to execute
script
> > updating Application("SomeVariableName") value on server A in response
to
> > user's action on server B but these methods didn't work - documentation
> > conformed it.
> > >
> > > Is there another, perhaps some creative way of doing it?
> >
> > Store the value in a database.
> >
> > --
> > Tom Kaminski IIS MVP
> > http://www.microsoft.com/windowsserver2003/community/centers/iis/
> > http://mvp.support.microsoft.com/
> > http://www.iisfaq.com/
> > http://www.iistoolshed.com/ - tools, scripts, and utilities for running
IIS
> > http://www.tryiis.com
> >
> >
> >



Re: Update Application value on multiple servers? by Mark

Mark
Mon Jul 19 15:41:58 CDT 2004

I think he wants to update he app var dynamically through an asp page on one
server and not require an app restart.

I would suggest putting the new value into a db for when the app does
restart and then using ServerXMLHTTP to hit an update page on the other
server to either change the app var directly or reload all the vars from the
db.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:OG95p5cbEHA.1652@TK2MSFTNGP09.phx.gbl...
> Maybe you misunderstood Tom's point. You would only hit the DB when
> application_onstart is fired, e.g. in Global.asa:
>
> Sub Application_OnStart()
> Set conn = CreateObject("ADODB.Connection")
> conn.open "<connection string>"
> set rs = conn.execute("SELECT ConstantValue FROM Constants WHERE
> ConstantName = 'foo'")
> application("foo") = rs(0)
> rs.close: set rs = nothing
> conn.close: set conn = nothing
> End Sub
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "Art" <Art@discussions.microsoft.com> wrote in message
> news:6D707C6C-86EC-4490-9326-F160C7DECD71@microsoft.com...
> > Tom,
> > Thanks for your help but our point was to avoid hitting the DB.
> >
> > "Tom Kaminski [MVP]" wrote:
> >
> > > "Art" <Art@discussions.microsoft.com> wrote in message
> > > news:13EE1D5E-F3B0-4F91-936C-A3FCE417273A@microsoft.com...
> > > > Can I update Application("SomeVariableName") on server A in response
> to
> > > user's action on server B? There is no problem in updating the same
> variable
> > > on server B, of course, but we would like both variables to be in sync
> since
> > > users can view the value stored on arbitrary server.
> > > >
> > > > So far I have tried server.execute and server.transer to execute
> script
> > > updating Application("SomeVariableName") value on server A in response
> to
> > > user's action on server B but these methods didn't work -
documentation
> > > conformed it.
> > > >
> > > > Is there another, perhaps some creative way of doing it?
> > >
> > > Store the value in a database.
> > >
> > > --
> > > Tom Kaminski IIS MVP
> > > http://www.microsoft.com/windowsserver2003/community/centers/iis/
> > > http://mvp.support.microsoft.com/
> > > http://www.iisfaq.com/
> > > http://www.iistoolshed.com/ - tools, scripts, and utilities for
running
> IIS
> > > http://www.tryiis.com
> > >
> > >
> > >
>
>



Re: Update Application value on multiple servers? by Aaron

Aaron
Mon Jul 19 15:50:13 CDT 2004

Then I don't understand why it can't be in a database. It's not like
hitting a database is going to add noticeable response time to the page,
unless you're using Access and it's connected to your web server via the
floppy drive on a remote PC logged into a VPN over dial-up...

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Mark Schupp" <mschupp@ielearning.com> wrote in message
news:#exLNDdbEHA.3728@TK2MSFTNGP10.phx.gbl...
> I think he wants to update he app var dynamically through an asp page on
one
> server and not require an app restart.
>
> I would suggest putting the new value into a db for when the app does
> restart and then using ServerXMLHTTP to hit an update page on the other
> server to either change the app var directly or reload all the vars from
the
> db.



Re: Update Application value on multiple servers? by Ray

Ray
Mon Jul 19 20:41:26 CDT 2004


"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:ukARKIdbEHA.1732@TK2MSFTNGP09.phx.gbl...
> It's not like
> hitting a database is going to add noticeable response time to the page,
> unless you're using Access and it's connected to your web server via the
> floppy drive on a remote PC logged into a VPN over dial-up...

This is going on my wall of quotes, as soon as I get around to having one.

Ray at home



Re: Update Application value on multiple servers? by Tom

Tom
Tue Jul 20 08:33:35 CDT 2004

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OZNBrpfbEHA.1356@TK2MSFTNGP09.phx.gbl...
>
> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> news:ukARKIdbEHA.1732@TK2MSFTNGP09.phx.gbl...
> > It's not like
> > hitting a database is going to add noticeable response time to the page,
> > unless you're using Access and it's connected to your web server via the
> > floppy drive on a remote PC logged into a VPN over dial-up...
>
> This is going on my wall of quotes, as soon as I get around to having one.

: )



Re: Update Application value on multiple servers? by Aaron

Aaron
Tue Jul 20 09:13:54 CDT 2004

> very expensive to get (no indexes, full table scans

Why are you using poor database design as an excuse for poor application
design? Fix the database!

> But the problem again is - how do you make sure that Application variable
storing this reference count gets updated throughout all the servers in a
web farm?

I still don't understand the problem. If you update the database and keep
whatever reference count you're talking about in a database, there is no
need to synchronize between all the servers in the farm. It belongs in a
central place for exactly this reason!

--
http://www.aspfaq.com/
(Reverse address to reply.)



Re: Update Application value on multiple servers? by Bob

Bob
Tue Jul 20 10:05:44 CDT 2004

Art wrote:
>> Why are you using poor database design as an excuse for poor
>> application
>> design? Fix the database!
>
> If this was up to me then yes, fixing database is the proper course
> of action. It is, however, something I'm not going to discuss as an
> option here since, like I said, I don't control it.
>
>> I still don't understand the problem. If you update the database
>> and keep
>> whatever reference count you're talking about in a database, there
>> is no
>> need to synchronize between all the servers in the farm. It belongs
>> in a
>> central place for exactly this reason!
>
> Well, that's what we have right now:) On average it takes 2-3 seconds
> to execute this query (to get the count) + anything else that a page
> might be doing. More often than not that particular query is the
> bottleneck in our application. This is done once per page.
> We suggested that perhaps we could cache the value and requery DB for
> an upated one at some interval but users said NO - they want to see
> accurate count.
> Next thought - let's use Application variable, query for the count at
> application's start up and then whenever user performs an action
> which updates the count we just add the code to up the Application
> variable's value. That's trivial to implement and maintain. The value
> of this information is also trivial since it's just a count for
> informative purposes - so it's not like we are going to lose a sale
> because the count might be off by one (which it would not be anyway).
> We are trying to shave off 2 seconds per page here! Of course,
> database needs to be fixed but you have no control over it and you
> need to come up w/ competetive and/or alternative idea to speed that
> up - do you have one?

Since you have a web farm, you can't use an Application variable. The count
needs to be stored centrally. How about caching it in a separate table in
your database? You could use triggers to maintain the value.

Or are you unable to even add a new table to your database?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Update Application value on multiple servers? by Mark

Mark
Wed Jul 21 10:27:19 CDT 2004

I have to agree with Aaron and Bob on this one even though I originally
suggested using a post from the affected server to the others. What if an
action that would change the count takes place one 2 servers
"simultaneously"?

Build the count on app startup and put it in a separate "reference count"
table as Bob suggests. Then perform your updates to that table until the
next app restart.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"Art" <Art@discussions.microsoft.com> wrote in message
news:3C293CCE-E796-41E5-A1FB-05C0A43C50A0@microsoft.com...
>
> > Why are you using poor database design as an excuse for poor application
> > design? Fix the database!
>
> If this was up to me then yes, fixing database is the proper course of
action. It is, however, something I'm not going to discuss as an option here
since, like I said, I don't control it.
>
> > I still don't understand the problem. If you update the database and
keep
> > whatever reference count you're talking about in a database, there is no
> > need to synchronize between all the servers in the farm. It belongs in
a
> > central place for exactly this reason!
>
> Well, that's what we have right now:) On average it takes 2-3 seconds to
execute this query (to get the count) + anything else that a page might be
doing. More often than not that particular query is the bottleneck in our
application. This is done once per page.
> We suggested that perhaps we could cache the value and requery DB for an
upated one at some interval but users said NO - they want to see accurate
count.
> Next thought - let's use Application variable, query for the count at
application's start up and then whenever user performs an action which
updates the count we just add the code to up the Application variable's
value. That's trivial to implement and maintain. The value of this
information is also trivial since it's just a count for informative
purposes - so it's not like we are going to lose a sale because the count
might be off by one (which it would not be anyway).
> We are trying to shave off 2 seconds per page here! Of course, database
needs to be fixed but you have no control over it and you need to come up w/
competetive and/or alternative idea to speed that up - do you have one?