Re: Hash code based routing?

To: " users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Hash code based routing?
From: "Brett E." <brettspamacct@xxxxxxxxxxxxx>
Date: Thu, 15 Jan 2004 09:45:37 -0800
Joseph Mack wrote:

"Brett E." wrote:

I'm curious about the interest in a hash code based algorithm that would
redirect packets to a real server based on source IP.  So it would
compute a function given the IP and mod that by the number of real
servers. If a real server went down then it could do another hash
function for the machine that went down.  So let's say machine a5 out of
real servers a1...a16 wend down.  If the hash function maps someone to
a5, it would then compute a hash based on 15 machines(excluding a5).

We're always up for new ideas and a new useful scheduler would be
welcome. Currently failover is handled by removing the realserver
from the virtual service table - this is independant of the scheduler
used. Is the advantage of your scheduler that it handles realserver
failover better? What is the point of using the source IP? There
is already an -sh scheduler, which looks at the source IP. This
is for multi-gateway directors


I guess the big advantage would be not having to store sessions in memory. There would be less of a memory footprint and hopefully less CPU overhead as we wouldn't have to traverse a session hash table which may be unbalanced. Just do the hash on the IP and choose a realserver. It would hopefully make LVS even more light weight and scaleable.

The -sh scheduler, if I recall, maps an IP range to a realserver, which is similar but different. The new scheduler would, upon every packet arrival, generate a hash number based on the source IP and choose a real server.

For example, let's say we get a packet, generate a hash of the IP and we get the number 838475, we mod that by 16 if there are 16 real servers, giving us 11, so we would redirect the packet to real server number 11.

Not that this would be the exact way it would be implemented but it gives you an idea of what I was thinking about.

I am leaving out details, I'm unsure of the best approach, but I wanted to throw this out there to see what people thought before I pursued this further.

<Prev in Thread] Current Thread [Next in Thread>