First, check SocketPool.cs, around line 160. That's the code that fires if
it failed to open a socket. You want to check if
deadEndPointSecondsUntilRetry is larger than some sort of threshhold (A
minute or so, you don't want to remove servers the first time they fail, you
can have short temporary network errors). If it is, you would do a call to
owner.RemoveSocketPool(this).

Then, in ServerPool.cs, you would have to create that method, which removes
a socket pool from the three data structures that are used for lookup. You
first want to remove it from the array hostList. Then you want to find all
entries in hostDictionary that have your socket pool as a value, and then
remove those keys from the array hostKeys, and the entry from
hostDictionary. And that should be it.


/Henrik

On Thu, Oct 22, 2009 at 14:57, Adi <adeelna...@gmail.com> wrote:

>
> Hi Henrik,
> could you please tell me how can i remove the dead node from the pool,
> or can you provide me any documentation of BeIT memcached client so
> that i understand it easily.
>
> Actually, In BeIT client there is method to detech the status of the
> host, i want to remove it from the socket pool if detect the server is
> dead. let me know where can i change the code.
>
> example:
>
> public void RemoveDeadNode()
>        {
>            foreach (SocketPool pool in serverPool.HostList)
>            {
>               if (!serverPool.Execute<bool>(pool, false, delegate
> { return true; }))
>                    {
>                        pool.Remove(pool.Host);  //This method not
> exist
>                     }
>             }
>
>        }
>
> On Oct 19, 4:00 pm, Henrik Schröder <skro...@gmail.com> wrote:
> > How it works depends on which client you use. If you use the
> BeITMemcached
> > client, when one instance goes down it will internally mark it as dead,
> > start writing about it in the error log, and all requests that would end
> up
> > at that server will be cache misses, which means that if you only have
> two
> > servers, half of your data will not be cached. Your application should be
> > able to handle this, and you should have something monitoring the servers
> > and the error log so that you can see that one instance is down, and then
> > you have the choice of either bringing the server back up again, or
> removing
> > it from the configuration of you application and restarting it.
> >
> > If you have a client that supports automatic failover (BeITMemcached
> > doesn't) then in the scenario above, all your data would be cached on the
> > other instance instead, so you would still be fully cached while bringing
> > the failing instance back up, or removing it from the configuration.
> > However, you would still have to restart your application to reset the
> > failover. This would be the best option, I'll try to add failover to the
> > BeITMemcached client as soon as I have time for it. :-)
> >
> > The third case is a client that supports automatic failover, and
> automatic
> > recovery from failover. It's similar to the scenario above, except it
> won't
> > need an application restart when the failing memcached server comes back
> up,
> > HOWEVER this means that your cache will not be synchronized while your
> > application gradually discovers that the memcached server is back up.
> > Depending on your application, this can be catastrophic, or it can be
> > inconsequential. I don't really want to add this to my client, and if I
> do,
> > there will be lots of warnings about it.
> >
> > /Henrik
> >
> >
> >
> > On Mon, Oct 19, 2009 at 11:37, Adi <adeelna...@gmail.com> wrote:
> >
> > > Thanks to All,
> >
> > > In a web farm where two memcached server is hosted separately, when
> > > one server is down could all request served from server 2
> > > automatically or we need to remove the dead node explicitly from the
> > > client?
> >
> > > I have tested a scenario:
> >
> > > Key1, Data1 Cached on Server1
> > > Key2, Data2 Cached on Server2
> >
> > > If Server1 dead, than data would get from database NOT from the
> > > Server2, (The defualt behaviour should be, if Key1 not found in
> > > Server1 OR server not respond than client should check Server2 for the
> > > data correspond to Key1 and if not found then store that data on
> > > Server2 so that in next request it would fetch from Server2.
> >
> > > As dormando said: "standby server to take over the IP of a
> > > dead host, or make it easy to push an update to your server list."
> >
> > > if i update the server list manually doesn't it effect the cache?- Hide
> quoted text -
> >
> > - Show quoted text -

Reply via email to