[Pacemaker] Announce: Making Resource Utilization Dynamic

Michael Schwartzkopff misch at clusterbau.com
Wed Jun 12 01:13:13 EDT 2013


Am Mittwoch, 12. Juni 2013, 08:06:43 schrieb Andrew Beekhof:
> On 08/06/2013, at 6:49 PM, Michael Schwartzkopff <misch at clusterbau.com> 
wrote:
> > Am Donnerstag, 6. Juni 2013, 14:08:26 schrieb Andrew Beekhof:
> > > On 06/06/2013, at 4:44 AM, Michael Schwartzkopff <misch at clusterbau.com> 
wrote:
> > > > Hi,
> > > > 
> > > > I was not satisfied with the situation that the utilization of
> > > > resources
> > > > is static. This is not how real world resources behave. Especially
> > > > virtual guests in a clustered environment show daily load patterns. So
> > > > I
> > > > thought it would be a good idea to make the utilization of resources
> > > > dynamic. I worte a small patch for the VirtualDomain resource agent
> > > > that
> > > > updates the CPU utilization every time it monitors the resource.
> > > > 
> > > > Please read about the background in the following article:
> > > > 
> > > > http://www.sys4.de/de/blog/54/
> > > > 
> > > > 
> > > > Any comments?
> > > > Where can I send the patch to?
> > > 
> > > What patch :)
> > > I see a code fragment but no context.
> > 
> > Patch:
> > 
> > --- VirtualDomain.orig  2013-06-08 10:24:54.403863313 +0200
> > +++ VirtualDomain.new   2013-06-08 10:43:16.184253755 +0200
> > @@ -187,6 +187,15 @@
> > 
> >         dom_mem=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} | awk
> >         '/Max memory/{printf("%d", $3/1024)}') test -n "$dom_mem" &&
> >         set_util_attr hv_memory "$dom_mem"
> >      
> >      fi
> > 
> > +
> > +    if [ -x /usr/bin/virt-top ]; then
> > +      CPUS=$(/usr/bin/virsh nodeinfo | awk '/CPU\(s/ {print $2}')
> > +      CPU_TICKS=$(/usr/bin/virt-top -n 2 -d 5 --stream | grep
> > $DOMAIN_NAME | tail -1 | awk '{printf "%.0f",$7}') +     
> > OLD_TICKS=$(crm_resource -r $OCF_RESOURCE_INSTANCE -z -g ticks) +     
> > NEW_TICKS=$(((OLD_TICKS + CPU_TICKS * CPUS) / 2))
> > +      /usr/sbin/crm_resource -r $OCF_RESOURCE_INSTANCE -z -p ticks -v
> > ${NEW_TICKS} +    fi
> > +
> > 
> >  }
> >  
> >  # Set options to be passed to virsh:
> > > Also, what does the resource/constraint config look like?
> > 
> > primitive resMyDomain ocf:heartbeat:VirtualDomain params config="..."
> > 
> > no constraints.
> 
> Ok, let me rephrase... is there any part of the config that makes use of the
> values the RA defines?

Perhaps I did not get the question right. But the rest is done by pacemaker 
automagically. If you set the utilizations of a node to 400 ticks and a 
VirtualDomain resources together consume more than 400 ticks pacemaker 
migrates at least one of the resources away from that node.

On the other hand if I set the utiliztion-strategy="minimal" pacemaker would 
migrate all resources to the minimal nodes possible without overloading one 
node. But whom do I tell ...

My idea is to switch off nodes if no resources run on that nodes and to switch 
on them again as utilization consumtion rises again. For that purpose I wrote 
a new Resource Agent that I want to publish in a next blog entry.

Given that setup you could save energy by running only as many nodes as really 
nescessary to deal with the utilizations of the resources.

-- 
Dr. Michael Schwartzkopff
Guardinistr. 63
81375 München

Tel: (0163) 172 50 98
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20130612/ac5cb42d/attachment-0003.html>


More information about the Pacemaker mailing list