vitalif / vitastor

Simplified distributed block and file storage with strong consistency, like in Ceph (repository mirror)
https://vitastor.io
Other
140 stars 22 forks source link

[Question] What is mon.js optimize_change() model? #6

Closed brucen1030 closed 3 years ago

brucen1030 commented 3 years ago

In optimize_change(), I understand it tries to create new PGs with penalty to old PGs.
As far as I see, addpg means the number a PG increases, and delpg means the number a PG decreased. Is it?

But what's the meaning of "'max: '+all_pg_names.map(pg_name => ( prev_weights[pg_name] ? ${pg_size+1}*add_${pg_name} - ${pg_size+1}*del_${pg_name} : ${pg_size+1-move_weights[pg_name]}*${pg_name} )).join(' + ')+';\n';" ?
Why (pg_size + 1) ?

And in OSD weight calculation, in "osd_pg_count = all_weights[osd]pg_effsize/total_weightpg_count - rm_osd_pg_count", why use rm_osd_pg_count ?

vitalif commented 3 years ago

Hi, the idea is to penalize PG movement. 1 is removed per each non-matching OSD in PG's set. It's not ideally correct but seems to work :-)