load balancing HTML link ? 
Author Message
 load balancing HTML link ?

I have two websites and trying to balance the load with the link that leads
to those two sites.
currently I have two links listed on main page but people ususally click the
first one.. is there a way to create a link(cgi, java, VBScript, etc) to
create a link that will point to one server and for next user, points to
second server link?

it doesn't need to work perfectly 50/50  just spreading load around will do.
thanks!



Fri, 25 Apr 2003 03:00:00 GMT  
 load balancing HTML link ?

You could use a random number generation and cause each link to appear
roughly 50% of the time.  Like you said, it wouldn't be exact.  It also
seems better to load balance at the web server level, but if you must do it
at the page level, here's some MS VBScript

<%
Randomize Timer 'only once per page, not before every link
...
If Rnd < .5 Then%>
        <A HREF="..page1path">Link Text</A>
<%Else%>
        <A HREF="..page2path">Link Text</A>
<%End If%>
--

Belbet Chimera MCSE


Quote:
> I have two websites and trying to balance the load with the link that
leads
> to those two sites.
> currently I have two links listed on main page but people ususally click
the
> first one.. is there a way to create a link(cgi, java, VBscript, etc) to
> create a link that will point to one server and for next user, points to
> second server link?

> it doesn't need to work perfectly 50/50  just spreading load around will
do.
> thanks!



Fri, 25 Apr 2003 03:00:00 GMT  
 load balancing HTML link ?

Although it chokes me to say it (or type it) this is a situation where use
of a (*gulp*) application variable might be useful.

<%
 Dim AppVar: AppVar = Application ("SvrID")
 If AppVar = True Or AppVar = Empty
  Response.Write ("<a href=""http://servera/"">Click Here</a>")
  Application ("SvrID") = False
 ElseIf AppVar = False
  Response.Write ("<a href=""http://serverb/"">Click Here</a>")
  Application ("SvrID") = True
 End If
%>
<

--
Dominic

Read The Docs? http://msdn.microsoft.com/scripting


Quote:
> I have two websites and trying to balance the load with the link that
leads
> to those two sites.
> currently I have two links listed on main page but people ususally click
the
> first one.. is there a way to create a link(cgi, java, VBscript, etc) to
> create a link that will point to one server and for next user, points to
> second server link?

> it doesn't need to work perfectly 50/50  just spreading load around will
do.
> thanks!



Fri, 25 Apr 2003 03:00:00 GMT  
 load balancing HTML link ?

On the client:

... text ...
<SCRIPT><!--
    if(Math.random() < .5)
        document.write('<A HREF="url1">link1<\/A>');
    else
        document.write('<A HREF="url2">link2<\/A>');
//--></SCRIPT>
<NOSCRIPT>
    <A HREF="url1">link1</A>
    <A HREF="url2">link2</A>
</NOSCRIPT>
... other text ...


Quote:
> I have two websites and trying to balance the load with
the link that leads
> to those two sites.
> currently I have two links listed on main page but people
ususally click the
> first one.. is there a way to create a link(cgi, java,
VBscript, etc) to
> create a link that will point to one server and for next
user, points to
> second server link?

> it doesn't need to work perfectly 50/50  just spreading

load around will do.
Quote:
> thanks!



Fri, 25 Apr 2003 03:00:00 GMT  
 load balancing HTML link ?

I'm thinking maybe a simple randomization would be better because if each
visitor only hits the link once, an application variable would fall short
and the same link would be displayed for each visitor, right?  Unless you
randomly choose the first link to be displayed...in which case you've
actually done both a randomization AND an app variable :)  The application
variable would be useful if you knew that each visitor would be going over
many load balanced links in a single visit.  I take it by your (*gulp*) that
you don't feel this is a good situation in which to take up resources for an
app variable.  I agree.  Perhaps just a simple randomization would be
better.

--

Belbet Chimera MCSE


Quote:
> Although it chokes me to say it (or type it) this is a situation where use
> of a (*gulp*) application variable might be useful.

> <%
>  Dim AppVar: AppVar = Application ("SvrID")
>  If AppVar = True Or AppVar = Empty
>   Response.Write ("<a href=""http://servera/"">Click Here</a>")
>   Application ("SvrID") = False
>  ElseIf AppVar = False
>   Response.Write ("<a href=""http://serverb/"">Click Here</a>")
>   Application ("SvrID") = True
>  End If
> %>
> <

> --
> Dominic

> Read The Docs? http://msdn.microsoft.com/scripting



> > I have two websites and trying to balance the load with the link that
> leads
> > to those two sites.
> > currently I have two links listed on main page but people ususally click
> the
> > first one.. is there a way to create a link(cgi, java, VBscript, etc) to
> > create a link that will point to one server and for next user, points to
> > second server link?

> > it doesn't need to work perfectly 50/50  just spreading load around will
> do.
> > thanks!



Fri, 25 Apr 2003 03:00:00 GMT  
 load balancing HTML link ?
Hi

Something like this perhaps:

<script type="text/JavaScript">
function goThere(){
var a = new Array( "Server1", "Server2" );
location.href = a[ Math.floor( Math.random() * a.length ) ];

Quote:
}

</script>
<a href="JavaScript:goThere()">bla</a>

--
--
Best Regards
  Vidar Petursson
 ==============================
 Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
 No matter where you go there you are
--


Quote:
> I have two websites and trying to balance the load with the link that
leads
> to those two sites.
> currently I have two links listed on main page but people ususally click
the
> first one.. is there a way to create a link(cgi, java, VBscript, etc) to
> create a link that will point to one server and for next user, points to
> second server link?

> it doesn't need to work perfectly 50/50  just spreading load around will
do.
> thanks!



Sun, 27 Apr 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Questions about Load Balanced IIS Design.

2. MSMQ and load balancing

3. Load Balancing, DCOM and NT server

4. .net and load balancing

5. Windows Load Balancing

6. Implementing Load Balancing Programmatically?

7. COM Load Balancing

8. COM+ Load Balancing clients

9. Load Balancing

10. Need further explanation of Transcender test question RE load balancing

11. COM+ Load Balancing

12. Load balancing without Application Center

 

 
Powered by phpBB® Forum Software