Open
Description
Around the line of latest commit:
https://github.com/RJ/ketama/blob/master/libketama/ketama.c#L428
for( i = 0; i < numservers; i++ )
{
float pct = (float)slist[i].memory / (float)memory;
unsigned int ks = floorf( pct * 40.0 * (float)numservers );
#ifdef DEBUG
int hpct = floorf( pct * 100.0 );
syslog( LOG_INFO, "Server no. %d: %s (mem: %lu = %u%% or %d of %d)\n",
i, slist[i].addr, slist[i].memory, hpct, ks, numservers * 40 );
#endif
for( k = 0; k <
51AD
; ks; k++ )
{
when servers being added into or removed from pool, the ks value of other untouched servers and the points on the circle will be changed. That means hit ratio will be decreased when the pool changed. Why not implement as:
unsigned int ks = 40.0 * (int)(slist[i].memory);//memory in MB
Do I misunderstand the ketama algorithm or your implementation?
Metadata
Metadata
Assignees
Labels
No labels