Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Pete French
I am just looking at this again, and am in a bit of a mood
for writing some patches, so I wanted to run the following idea past people
as regards the priority system in the 'prefer' balancing method.

Just to recap, creating a gmirror creates the first device with priority
zero. Adding extra devices lets you set their priorities, but you cant
set negative values. The upshot is that the first device in the mirror
always has the lowest priority - so you cannot (for example) create a mirror
with a local disc, subsequently add a remote disc, but then set the mirror
up to prefer the local drive.

I am thinking of a couple of changes - the first being the patch prroposed
from Andrew Snow which would create the mirror with the priority at something
other than zero (128 would be my preference) so that extra devices can be
inserted both above and below it. This solves the problem for newly
created mirrors as the priority can then be set as appropiate.

The other change I wanted to make was to add a second 'prefer' mode to gmirror
though - one which would prefer the *lowest* priority instead of the
highest priority. I would probably rename the existing mode to 'prefer-high'
(keeping 'prefer' as a synonym for backward compatibility) and add
a 'prefer-low' as well. As an existing gmirror can have it's load balance
algorithm changed on the fly, this lets you change which of the drives
is preferred in an existing installationg. This is precisely what you need
when switching between two machines so that the local and remote drives
become reversed.

I havent looked at the code in detail, but I can't see that it would be too
difficult. What do people think ?

-pete.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Ivan Voras
Pete French wrote:
 I am just looking at this again, and am in a bit of a mood
 for writing some patches, so I wanted to run the following idea past people
 as regards the priority system in the 'prefer' balancing method.
 
 Just to recap, creating a gmirror creates the first device with priority
 zero. Adding extra devices lets you set their priorities, but you cant
 set negative values. The upshot is that the first device in the mirror
 always has the lowest priority - so you cannot (for example) create a mirror
 with a local disc, subsequently add a remote disc, but then set the mirror
 up to prefer the local drive.

Ok.

 I am thinking of a couple of changes - the first being the patch prroposed
 from Andrew Snow which would create the mirror with the priority at something
 other than zero (128 would be my preference) so that extra devices can be
 inserted both above and below it. This solves the problem for newly
 created mirrors as the priority can then be set as appropiate.
 
 The other change I wanted to make was to add a second 'prefer' mode to gmirror
 though - one which would prefer the *lowest* priority instead of the
 highest priority. I would probably rename the existing mode to 'prefer-high'
 (keeping 'prefer' as a synonym for backward compatibility) and add
 a 'prefer-low' as well. As an existing gmirror can have it's load balance
 algorithm changed on the fly, this lets you change which of the drives
 is preferred in an existing installationg. This is precisely what you need
 when switching between two machines so that the local and remote drives
 become reversed.
 
 I havent looked at the code in detail, but I can't see that it would be too
 difficult. What do people think ?

Couple of ideas:

- Don't use 128 as the default since it will lead people to think
there's an 8-bit quantity behind the setting (and subsequently develop
weird theories about how the setting works), when it isn't so. Use 100
or 1000.
- Why not go all the way and make another argument or a switch that will
specify exactly which drive to prefer, so you could say prefer N,
where N is any drive / component, not only the one with lowest/highest
priority? This is slightly more complex and will probably require an
addition to the metadata (which isn't complicated but you have to be
careful) and a workaround so the old semantics of the plain setting is
supported.




signature.asc
Description: OpenPGP digital signature


Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Pete French
 Couple of ideas:

 - Don't use 128 as the default since it will lead people to think
 there's an 8-bit quantity behind the setting (and subsequently develop
 weird theories about how the setting works), when it isn't so. Use 100
 or 1000.

Are you sure it isn't an 8 bit value underneath ? I know it is defined as
an int, but trying to set it to anything outside the range 0-255 results
in it wrapping round (e.g. you try making the defalt 1000 and it comes
out as 232). I havent looked in detail as *why* thats happening, but it
certainly behaves like it is 8 bits, hence my choice of default.

 - Why not go all the way and make another argument or a switch that will
 specify exactly which drive to prefer, so you could say prefer N,
 where N is any drive / component, not only the one with lowest/highest
 priority? This is slightly more complex and will probably require an
 addition to the metadata (which isn't complicated but you have to be
 careful) and a workaround so the old semantics of the plain setting is
 supported.

I thought about that, but the priority scheme doesnt just specify one
drive, it specifies a whole set - effectively you find the highest usable
drive. Just defining one isn't sufficient, you need to have a defined
way of falling back if that one isn't active. Secondly I want to avoid
having to search the whole list event time. Currently the list of drives
is created in priority order (no matter what the balance algorithm) so
the 'prefer' algorithm simply traverses the list looking for the first
active drive. I wanted to keep that and thus simply convert the list to
a tailq so I can traverse it both ways, rather than having to seek the
whole list every time. It keeps the code as close to the current code
as possible.

I'll get an initial version out and then maybe take a look at doing
something more complex though.

cheers,

-pete.
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Ivan Voras
Pete French wrote:
 Couple of ideas:

 - Don't use 128 as the default since it will lead people to think
 there's an 8-bit quantity behind the setting (and subsequently develop
 weird theories about how the setting works), when it isn't so. Use 100
 or 1000.
 
 Are you sure it isn't an 8 bit value underneath ? I know it is defined as
 an int, but trying to set it to anything outside the range 0-255 results
 in it wrapping round (e.g. you try making the defalt 1000 and it comes
 out as 232). I havent looked in detail as *why* thats happening, but it
 certainly behaves like it is 8 bits, hence my choice of default.

Ah, I see; It's defined as

u_intd_priority;/* Disk priority. */

in struct g_mirror_disk but as

uint8_t md_priority;/* Disk priority. */

in struct g_mirror_metadata. Ok, 128 looks reasonable now.


 I thought about that, but the priority scheme doesnt just specify one
 drive, it specifies a whole set - effectively you find the highest usable
 drive. Just defining one isn't sufficient, you need to have a defined
 way of falling back if that one isn't active. Secondly I want to avoid
 having to search the whole list event time. Currently the list of drives
 is created in priority order (no matter what the balance algorithm) so
 the 'prefer' algorithm simply traverses the list looking for the first
 active drive. I wanted to keep that and thus simply convert the list to
 a tailq so I can traverse it both ways, rather than having to seek the
 whole list every time. It keeps the code as close to the current code
 as possible.

Hmm, it would seem you need N-and-upper and N-and-lower, but this is
inconvenient. Your original idea is probably better.

 I'll get an initial version out and then maybe take a look at doing
 something more complex though.




signature.asc
Description: OpenPGP digital signature


Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Pete French
 Hmm, it would seem you need N-and-upper and N-and-lower, but this is
 inconvenient. Your original idea is probably better.

Certainly simpler to implement. Ideally, of course, you could change the
priority on the fly (which would solve all of this) but the fact that it
is stored in priority order makes that a bit of a pain too I would imagine.

Do you have any thoughts on dumping by the way ? I initially implemnted the
code to chheck for 'prefer-low' and dump to the last disc instead of the first.
But the manual page suggests ways of working with prefer which may well be
broken doing it that way, so I took the change out in order to make the
manpage advice still correct.

I have a working implementation here now if anyone wants to test by the
way - I ended up simply adding a 'prefer-low' and changing the default
priority. Everything else behaves the same as it always did.

-pete.

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Pete French
O.K., heres an initial version of the patch - relative to 7.0 release.
Please test and let me know if there are any problems. Patch should
apply cleanly if you are in '/usr'.

cheers,

-pete.

begin 644 gmirror.patch.gz
M'XL(,/(T@`V=M:7)R;W(N[EMAIL PROTECTED](TC_+?\6$JRQV;($D/P!S
MX5L6G,1U8/:,DTV^U%J69)M%;+DE0DW'?WW[=TZ.GY=?[EMAIL PROTECTED]GJF
M_H]+N93)B\9%@'OF!,ST.QXYW/+7]^;'IF%X/'P`_XYU^/S(1B?`
MBBS+^Z6-$4YD96VK+:9IG:U=E?M'GQ#ZLKJJ)4ZO7ZSEM`A*(4#EE:@NP
M=9O-%83??\_DUDGCA-7Y_]]_7V$5%D9Y)C,G!D!XVQ[ICPS4\T_[\?^PU
[EMAIL PROTECTED],=-)CI[EMAIL PROTECTED]_;!8+%\:*Y\4V/!*;0=4P;P%K*62+(GXO
MJ^5N3C5\4([B/1%X``[HT`4\XK]U0JG9ZGB'HB^]8C-BCSPW'JX91L#0C
M-C4C5P_LG]DK^*_!EE[H3#W;8A/7F(:U\]+YAADY7XS(+L4!YQ6K/=4#56
M%T]DKO2$^Y.7U5DB;UB=P\-0.X'-IO;D6$9DJR]!FEA,^,\Y']L!,T(6
MDU0[JM1_P33F3R:A'%L!K./X?^)'[[EMAIL PROTECTED],8!KK_5ZC?T_C$M`
M%8QRHJ9VI!NAZ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7M42A60W.1ANX(Q
M:E$9[N9T,G+5DCMT)[[7ZB,0:+)14X^0T*-LWU^^Z6TBI,$BKLIE(\
M\MY\5?!B_B05\QL*BX'5TF5I%#S[EMAIL PROTECTED]/CPXRSQ44_P3)@7:S442H
MSI^5D0FX/F%I'`92%V)[EMAIL PROTECTED][EMAIL PROTECTED])@%+PKA
M_])-X2J.)S6FY92JZ090:ZI*:C5+BL?O8+55)-D)(?P[(=*+S8T0
MVH%/.%M%KJWPH;3%L8MBQ*0TG8`10Y6RMY:YZ:[EMAIL PROTECTED]('%WC5,DS
M-9MYS_3#X'!?YPGI!0J'CVXP=$];=9P88,*PQ,[EMAIL PROTECTED]
M0N_TCH]'B)E#)=BBT,$KB(0IM_'D#?`D%**[%PFH)V07*V:V0HT
M=SRQTTQ#1;%%)K0]2RS!05/52E2X]Z$W.G7=X/13Y?]4=QAV]+.L`I7UUJ0
MKM-PE,';U[G+PMG==%?5DJ1[9=B#A\E9U+O]?2IV%J2F-_-\;CO1W
MOOK+9U`=4)*CS'FHKL[FB!E+(JYOZC1]JK-2'M69_+*D]Q178;6F3?
MB)@@8,_]'`=ZC5985R1+^N!23-YGPDY,'J1)M;H5XLZ6M,VD;1CV*V^
MR?=KY!9Y2CW;(FVZDHM$7[X9]89K:Z13*!Y_A,8MR4)IW9UIVH^0I$S@
M_U!#\4Y(.+/U%BKGV+@QQK842C8ZJCI!P1;.J92(T6!BP_BWW:H=+LT\
M*C5,JA1,G6JM+96\)O^C?^5;3-,^OUBBRZ18)ZGWH7_5$3UKO?C2\^U3C
M[K8;T$M7^N-$F[EMAIL PROTECTED],6G::[EMAIL 

Re: Dreadful gmirror performance - suggested changes to 'prefer'

2008-05-08 Thread Andrew Snow

I havent looked at the code in detail, but I can't see that it would be too
difficult. What do people think ?


If the first drive is always priority=0, then it is going to be stuck at 
the highest priority, or under your plan, the lower priority.


My original idea OTOH (starting the counting at 100) solves the problem 
with aone-line patch.  Call me biased but this is what I prefer :-)



- Andrew

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]