[Ovirt-devel] re: got it!

Steve Linabery slinabery at redhat.com
Tue Jul 29 19:30:29 UTC 2008


On Tue, Jul 29, 2008 at 03:24:50PM -0400, Mohammed Morsi wrote:
> mark wagner wrote:
>>
>>
>> Steve Linabery wrote:
>>> Pursuant to my previous email with same subject line...
>>>
>>> Here's a bit of follow-up information.
>>>
>>> The
>>>          0.upto(@pool.hosts.total_memory) { |x|             if x %  
>>> 1024 == 0
>>>                 scale.push((x / 1024).to_s) # divide by 1024 to  
>>> convert to MB
>>>             end
>>>          }
>>
>> Would seem to be easier and quicker to do something like the following  
>> pseudo code
>>
>>    ticks =  pool.hosts.total_memory / 1024
>>    0.upto(@ticks)
>>    { |x|
>>       scale.push(x.to_s)
>>       end
>>    }
>>
>> Not saying its that its the correct or even the best solution, just  
>> that it
>> would seem to be faster... You are going through the loop 1024 times  
>> less and
>> only doing one divide ( in this case the divide probably gets turned  
>> into 10
>> right shifts) instead of pool.hosts.total_memory divides and comparisons.
> Ya that looks like a better algorithm to do what was intended.
>

Yes, that's what I did for my own workaround (just to resolve the issue of the timeout error), but as this code needs some more substantial gutting, I'm not committing the workaround.

>
>>
>>>
>>> block eventually completes, after several minutes, before which the  
>>> request times out.
>>>
>> Sounds like you need a faster computer....
>>

heh heh...I'll expense a few quad-cores and we can parallelize ruby in our spare time.

>>> On my setup, @pool.hosts.total_memory is 522555392.
>> Is that in KB or bytes ?

It's whatever unit @pool.hosts.total_memory evaluates to.

>> The comment in the code indicated that it was dividing by 1024 to get MB.
>> Do you have 522 GB of memory in your pool?
> I believe memory is stored in KB.
>
>
>
>>
>> -mark
>>>
>>
>>
>>> There's no infinite loop.
>>>
>>> --Steve
>>>
>>> _______________________________________________
>>> Ovirt-devel mailing list
>>> Ovirt-devel at redhat.com
>>> https://www.redhat.com/mailman/listinfo/ovirt-devel
>>
>> _______________________________________________
>> Ovirt-devel mailing list
>> Ovirt-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/ovirt-devel
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel




More information about the ovirt-devel mailing list