On 12/06/2013, at 3:13 PM, Michael Schwartzkopff <mi...@clusterbau.com> wrote:
> Am Mittwoch, 12. Juni 2013, 08:06:43 schrieb Andrew Beekhof: > > On 08/06/2013, at 6:49 PM, Michael Schwartzkopff <mi...@clusterbau.com> > > wrote: > > > Am Donnerstag, 6. Juni 2013, 14:08:26 schrieb Andrew Beekhof: > > > > On 06/06/2013, at 4:44 AM, Michael Schwartzkopff <mi...@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. You know that, and I know that, but not everyone reading this thread might know that :-) They might have appreciated seeing the cib parts. Also, I missed the "/ 2" part the first time I saw the patch, so I wasn't sure what you had in mind. > > 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 > _______________________________________________ > Pacemaker mailing list: Pacemaker@oss.clusterlabs.org > http://oss.clusterlabs.org/mailman/listinfo/pacemaker > > Project Home: http://www.clusterlabs.org > Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf > Bugs: http://bugs.clusterlabs.org _______________________________________________ Pacemaker mailing list: Pacemaker@oss.clusterlabs.org http://oss.clusterlabs.org/mailman/listinfo/pacemaker Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://bugs.clusterlabs.org