All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sage Weil <sage@newdream.net>
To: 胡瀚森 <softrank.net@gmail.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: Question about the implementation of bucket_straw_choose in src/crush/mapper.c
Date: Thu, 29 Mar 2012 08:52:53 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.1203290850020.32695@cobra.newdream.net> (raw)
In-Reply-To: <CALwGbP+0xWC=-zZYdx_D6ikgEq6NRYYfweEDn7z5WceCypPRNw@mail.gmail.com>

On Thu, 29 Mar 2012,  wrote:
> Hi everyone, i'm proceeding reading source code of crush
> 
> i'm reading src/crush/mapper.c which is describing the core
> implementation of crush alg.
> in reading function bucket_straw_choose, i compare the implementation
> with the idea written in the thesis and have some problem
> understanding it.
> 
> in the thesis, it said that the length of straw should multiply the
> weight of bucket item so that heavier items are more likely to be
> selected.
> in bucket_straw_choose, i see bucket->straws multiplying the hash value only.
> 
> next, i referred to crush.h to take a look at the data structure of
> crush_bucket_straw, and found two members named 'straws' and
> 'item_weights'.
> 
> i just don't know whether 'weight' and 'straw' in the implementation
> mean the same thing as in thesis. if so, why item_weights is not used
> in bucket_straw_choose.

The length of the straw is not directly proportional to the weight, and is 
non-trivial.  When the bucket is built/adjusted, the straw lengths are 
calculated so that the actual choose/placement calculation is fast and 
simple.

See crush_calc_straw() in src/crush/builder.c for the straw calculation.  
I needed to draw a picture for it to make any sense.

sage

  reply	other threads:[~2012-03-29 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29  9:16 Question about the implementation of bucket_straw_choose in src/crush/mapper.c 胡瀚森
2012-03-29 15:52 ` Sage Weil [this message]
2012-04-01  2:33 ` zhurongze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1203290850020.32695@cobra.newdream.net \
    --to=sage@newdream.net \
    --cc=ceph-devel@vger.kernel.org \
    --cc=softrank.net@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.