Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:17 PM
Art
Guest
 
Posts: n/a
Default Update Application value on multiple servers?

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?
  #2  
Old July 19th, 2005, 02:17 PM
Tom Kaminski [MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

"Art" <Art@discussions.microsoft.com> wrote in message
news:13EE1D5E-F3B0-4F91-936C-A3FCE417273A@microsoft.com...[color=blue]
> Can I update Application("SomeVariableName") on server A in response to[/color]
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.[color=blue]
>
> So far I have tried server.execute and server.transer to execute script[/color]
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.[color=blue]
>
> Is there another, perhaps some creative way of doing it?[/color]

Store the value in a database.

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/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


  #3  
Old July 19th, 2005, 02:17 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

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


  #4  
Old July 19th, 2005, 02:17 PM
Mark Schupp
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

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...[color=blue]
> 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...[color=green]
> > Tom,
> > Thanks for your help but our point was to avoid hitting the DB.
> >
> > "Tom Kaminski [MVP]" wrote:
> >[color=darkred]
> > > "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[/color][/color]
> to[color=green][color=darkred]
> > > user's action on server B? There is no problem in updating the same[/color][/color]
> variable[color=green][color=darkred]
> > > on server B, of course, but we would like both variables to be in sync[/color][/color]
> since[color=green][color=darkred]
> > > users can view the value stored on arbitrary server.
> > > >
> > > > So far I have tried server.execute and server.transer to execute[/color][/color]
> script[color=green][color=darkred]
> > > updating Application("SomeVariableName") value on server A in response[/color][/color]
> to[color=green][color=darkred]
> > > user's action on server B but these methods didn't work -[/color][/color][/color]
documentation[color=blue][color=green][color=darkred]
> > > 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/windowsserv...y/centers/iis/
> > > http://mvp.support.microsoft.com/
> > > http://www.iisfaq.com/
> > > http://www.iistoolshed.com/ - tools, scripts, and utilities for[/color][/color][/color]
running[color=blue]
> IIS[color=green][color=darkred]
> > > http://www.tryiis.com
> > >
> > >
> > >[/color][/color]
>
>[/color]


  #5  
Old July 19th, 2005, 02:17 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

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...[color=blue]
> I think he wants to update he app var dynamically through an asp page on[/color]
one[color=blue]
> 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[/color]
the[color=blue]
> db.[/color]


  #6  
Old July 19th, 2005, 02:17 PM
Ray at
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?


"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:ukARKIdbEHA.1732@TK2MSFTNGP09.phx.gbl...[color=blue]
> 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...[/color]

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

Ray at home


  #7  
Old July 19th, 2005, 02:18 PM
Tom Kaminski [MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OZNBrpfbEHA.1356@TK2MSFTNGP09.phx.gbl...[color=blue]
>
> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> news:ukARKIdbEHA.1732@TK2MSFTNGP09.phx.gbl...[color=green]
> > 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...[/color]
>
> This is going on my wall of quotes, as soon as I get around to having one.[/color]

: )


  #8  
Old July 19th, 2005, 02:18 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

> 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!
[color=blue]
> But the problem again is - how do you make sure that Application variable[/color]
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.)


  #9  
Old July 19th, 2005, 02:18 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

Art wrote:[color=blue][color=green]
>> Why are you using poor database design as an excuse for poor
>> application
>> design? Fix the database![/color]
>
> 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.
>[color=green]
>> 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![/color]
>
> 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?[/color]

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.


  #10  
Old July 19th, 2005, 02:19 PM
Mark Schupp
Guest
 
Posts: n/a
Default Re: Update Application value on multiple servers?

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...[color=blue]
>[color=green]
> > Why are you using poor database design as an excuse for poor application
> > design? Fix the database![/color]
>
> If this was up to me then yes, fixing database is the proper course of[/color]
action. It is, however, something I'm not going to discuss as an option here
since, like I said, I don't control it.[color=blue]
>[color=green]
> > I still don't understand the problem. If you update the database and[/color][/color]
keep[color=blue][color=green]
> > 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[/color][/color]
a[color=blue][color=green]
> > central place for exactly this reason![/color]
>
> Well, that's what we have right now:) On average it takes 2-3 seconds to[/color]
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.[color=blue]
> We suggested that perhaps we could cache the value and requery DB for an[/color]
upated one at some interval but users said NO - they want to see accurate
count.[color=blue]
> Next thought - let's use Application variable, query for the count at[/color]
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).[color=blue]
> We are trying to shave off 2 seconds per page here! Of course, database[/color]
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?


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles