Amac
Amac

Reputation: 107

Azure Web Roles constantly recycling with Autoscaler

I have a wcf service hosted on azure. When I deploy it and start the autoscaler object the web service roles are constantly being recycled and in an unhealthy state. If I do not start the autoscaler I have no issues, however I would like to use WASABi.

Here is my WebRole.cs

ublic class WebRole : RoleEntryPoint
{
    private Autoscaler autoscaler;
    public override bool OnStart()
    {

        // To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config  
        DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
        diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
        diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());

        // For information on handling configuration changes
        // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            autoscaler = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();
            autoscaler.Start();


        return base.OnStart();
    }

    public override void OnStop()
    {
        autoscaler.Stop();
    }
}

Upvotes: 2

Views: 435

Answers (2)

Dave Bending
Dave Bending

Reputation: 171

What does your Run method look like? It needs to keep the role alive so it should be something like this:

    public override void Run()
    {         
        Trace.TraceInformation("ScalerRole entry point called", "Information");

        while (true)
        {
            Thread.Sleep(100000);
            Trace.TraceInformation("Working", "Information");
        }
    }

Upvotes: 0

Petar Vučetin
Petar Vučetin

Reputation: 3615

Have you tried using IntelliTrace to diagnose the reason for recycling? Here is a good article descirbing how to setup and trouble shoot with IntelliTrace.

Upvotes: 0

Related Questions