c# - Azure Cloud Service role instances - auto-scaling - Changing event not firing -
i got cloud service deployment 4 worker roles, 1 of got auto-scaling enabled. auto-scaling occurs, instances of roles recycling.
ideally, i'd stop roles recycling or @ least terminate work of other roles in controlled way.
i found out, can react roleenvironment.changing event , cancel request graceful shutdown (i.e. make onstop being called). however, adding tracing output changing event handler, noticed changing event not fired, cancellation not being registered either.
private void roleenvironmentchanging(object sender, roleenvironmentchangingeventargs e) { // tracing output not show in logs table. trace.traceinformation("roleenvironmentchanging event fired."); if ((e.changes.any(change => change roleenvironmentconfigurationsettingchange))) { // 1 neither. trace.traceinformation("one of changes roleenvironmentconfigurationsettingchange. cancelling.."); e.cancel = true; } if ((e.changes.any(change => change roleenvironmenttopologychange))) { // 1 neither. trace.traceinformation("one of changes roleenvironmenttopologychange. cancelling."); e.cancel = true; } } public override bool onstart() { // hook changing event prevent roles unnecessarily restarting. roleenvironment.changing += roleenvironmentchanging; // set maximum number of concurrent connections servicepointmanager.defaultconnectionlimit = 12; bool result = base.onstart(); return result; }
also adding internal endpoint each role did not bring change. here configuration .csdef:
<workerrole name="myrole" vmsize="medium"> [...configurationsettings...] <endpoints> <internalendpoint name="endpoint1" protocol="http" /> </endpoints> </workerrole>
also changing protocol "any" wasn't successful.
how can stop role instances recycling after scaling operation?
edit:
» included code snippets
» fixed typos
did try 1 of following?
- check whether event being fired in instances of role auto-scaling (to make sure not problem internal endpoint)
- do complete re-deployment (instead of update).
- add short thread.sleep() after tracing output in event handler (sometimes role being shut down before trace output can registered)
- do change in 1 of configs via management portal (and check whether event being triggered)
- check whether other events (for instance roleenvironment.changed) being fired
Comments
Post a Comment