Varnish load balancer & (keep session)

Rob S rtshilston at gmail.com
Sat Feb 6 12:59:33 CET 2010


Hi,

To answer some of your questions:

1) 503 error when shutting down a backend:  When you shutdown the 
backend, do you see varnishlog say that the backend is healthy or sick?  
If one is sick, then the other should get the traffic if your VCL 
contains set req.backend = b1;

2) Vanish load balanced does not keep e-commerce sessions for PHP.  The 
simplest solution to this is to install memcache, and put the following 
lines in your php.ini file:

[Session]
session.save_handler = memcached
session.save_path = "memcache-server1:11211,memcache-server2:11211"

instead of session.save_handler = files

However, I can't say for certain that this will definitely work - it 
depends on how your ecommerce application operates. 

3) S-flag: I'm not sure about this, but my gut feeling is that it's not 
causing the problems you're seeing.



Rob


alertebox wrote:
>
> Version: 2.0.6-1
>
> Insall: .deb
>
> Os: Debian 5.0.3
>
> Hi,
>
> I've got two backends running apache2: front1.domain.com & 
> front2.domain.com, set with the load balancing configuration 
> from http://varnish-cache.org/wiki/LoadBalancing.
>
> _The issue is, when I shutdown apache2 of the first backend varnish 
> don't switch to the second and display "Error 503 Service 
> Unavailable", is that a normal answer from varnish?_
>
> Other question, _does varnish load balancer keep php sessions for 
> e-commerce, if yes how will I do?_
>
> Varnishlog :
>
> 0 Backend_health - front1 Still healthy 4--X-RH 10 8 10 0.040008 
> 0.039814 HTTP/1.1 200 OK
>
> 0 Backend_health - front2 Still healthy 4--X-RH 10 8 10 0.066948 
> 0.066591 HTTP/1.1 200 OK
>
> _The S flag is missing in my log, is that an issue…_
>
> "4--X-S-RH" to notify that TCP socket shutdown succeeded 
> from http://varnish-cache.org/wiki/BackendPolling
>
> Part of default.vcl
>
> backend front1 {
>
>   .host = "front1.domain.com";
>
>   .port = "80";
>
>   .probe = { .url = "/";
>
>              .interval = 10s;
>
>              .timeout = 5s;
>
>              .window = 10;
>
>              .threshold = 8;
>
>  }
>
> }
>
>  
>
> backend front2 {
>
>   .host = "front2.domain.com";
>
>   .port = "80";
>
>   .probe = { .url = "/";
>
>              .interval = 10s;
>
>              .timeout = 5s;
>
>              .window = 10;
>
>              .threshold = 8;
>
>  }
>
> }
>
>  
>
> director b1 random
>
> {
>
>    { .backend = front1; .weight = 1; }
>
>    { .backend = front2; .weight = 1; }
>
> }
>
>  
>
> #director b1 round-robin {
>
> #    { .backend = front1; }
>
> #    { .backend = front2; }
>
> #}
>
> _Is that part of configuration is wrong_ ?
>
>  
>
> Thanks for your help...
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>   



More information about the varnish-misc mailing list