All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about the implementation of bucket_straw_choose in src/crush/mapper.c
@ 2012-03-29  9:16 胡瀚森
  2012-03-29 15:52 ` Sage Weil
  2012-04-01  2:33 ` zhurongze
  0 siblings, 2 replies; 3+ messages in thread
From: 胡瀚森 @ 2012-03-29  9:16 UTC (permalink / raw)
  To: ceph-devel

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.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about the implementation of bucket_straw_choose in src/crush/mapper.c
  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
  2012-04-01  2:33 ` zhurongze
  1 sibling, 0 replies; 3+ messages in thread
From: Sage Weil @ 2012-03-29 15:52 UTC (permalink / raw)
  To: 胡瀚森; +Cc: ceph-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about the implementation of bucket_straw_choose in src/crush/mapper.c
  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
@ 2012-04-01  2:33 ` zhurongze
  1 sibling, 0 replies; 3+ messages in thread
From: zhurongze @ 2012-04-01  2:33 UTC (permalink / raw)
  To: 胡瀚森; +Cc: ceph-devel

于 2012年03月29日 17:16, 胡瀚森 写道:
> 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.
>
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Are you chinese?  I wrote 2 articles about  CRUSH design and source code 
analysis in Chinese, I think this is useful for you.
The Link is http://toplab.sinaapp.com
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-01  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2012-04-01  2:33 ` zhurongze

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.