我正在做我的第一个项目,但这是一个关于使用集成组件开发 Azure 应用程序的大型项目。
目前,大部分集成都是使用 SSIS 包完成的,并且希望将它们转换为 Azure 中的辅助角色。
有人可以帮助我理解以下有关工人角色的疑问吗?
-
有没有办法通过 GUI 启动或停止 Worker 角色(就像 SSIS 或 Windows Schedulers)?如果不是,如何实现这一点?
-
我如何知道我的辅助角色已经运行或没有运行(包括为什么它没有运行,即日志)
-
如何根据时间轮换多个辅助角色(即(上午 9:00 到上午 11:00 轮换 4 个角色,并在安静时段缩小规模)
-
以下代码是否会创建任何有害消息或死锁(如果有多个,则有 10,000 条消息需要处理,并且每 5 秒就会有一个新线程(正在处理.run) 已启动?
<前> <代码> while(真)
{
var 线程 = 新线程(运行);
线程.start();
线程.睡眠(5000);
Trace.WriteLine("工作中", "信息");
}
公共课照片处理
{
公共静态无效运行()
{
// 从队列中读取
CloudQueueMessage 消息 =
Storage.Queue.GetNextMessage();
while(msg != null)
{
string[] message = msg.AsString.Split('$');
if(消息.长度== 2)
{
添加水印(消息[0],消息[1]);
}
// 消息已被读取,因此将其删除
Storage.Queue.DeleteMessage(msg);
// 获取下一条消息(如果有)
msg = Storage.Queue.GetNextMessage();
}
}
I'm doing my first project but large one on developing Azure Application with Intergration Component.
Currently most of the integration are done using SSIS Packages and would like to transform them on to Worker Role in Azure.
Could someone please help me to understand the following queries regarding Worker Role please?
-
Is there way to start or stop the Worker role (just like SSIS or Windows Schedulers) via GUI? If not how to achieve this?
-
How do I know my worker role has been running or not running (including why it's not running ie. logs)
-
How do I spin multiple worker role based on time (i.e. (9:00AM to 11:00AM spin 4 roles and scale down on quiet period)
-
Does the following code creates any poison message or dead lock (if multiple there are 10,000 messages to process and every 5 seconds the new thread (Processsing.run) is started?
while(true)
{
var thread = new Thread(Run);
thread.start();
Thread.Sleep(5000);
Trace.WriteLine("Working", "Information");
}
public class PhotoProcessing
{
public static void Run()
{
// Read from queue
CloudQueueMessage msg =
Storage.Queue.GetNextMessage();
while(msg != null)
{
string[] message = msg.AsString.Split('
);
if(message.Length == 2)
{
AddWatermark(message[0], message[1]);
}
// Message has been read so remove it
Storage.Queue.DeleteMessage(msg);
// Get next message if any
msg = Storage.Queue.GetNextMessage();
}
}
发布评论
评论(1)
有没有办法通过 GUI 启动或停止 Worker 角色(就像 SSIS 或 Windows Scheduler 一样)?如果不是怎么实现?
实际上有很多方法可以实现这一点。您可以使用 Windows Azure 门户来执行此操作,也可以使用第 3 方工具(例如我们的 Cloud Storage Studio),或者您可以使用 Windows Azure 服务管理 API (http://msdn.microsoft.com/en-us/library/ee460799.aspx)
我如何知道我的辅助角色已运行或未运行(包括其未运行的原因,即日志)
您可以再次使用基于 GUI 的工具之一来查看角色的状态。至于角色未运行的原因,您需要在辅助角色中启用 Windows Azure 诊断 (http://msdn.microsoft.com/en-us/library/gg433048.aspx)
如何根据时间(即(上午 9:00 到11:00AM 旋转 4 个角色并在安静时段缩小规模)
您可以使用 Windows Azure 服务管理 API 编写自己的应用程序来执行此操作,也可以使用第三方工具,例如 Paraleap 的 AzureWatch 或 Azure Management Cmdlet(均来自 Microsoft 和我们公司)。虽然 cmdlet 可以完成工作,但我相信 Azure Watch 是更复杂的解决方案。几天前我们写了一篇关于自动缩放的博客文章,您可以在这里找到:http://www.cerebrata.com/Blog/post/Scale-your-Windows-Azure-instances-with-Azure-Management-Cmdlets.aspx。
Is there way to start or stop the Worker role (just like SSIS or Windows Schedulers) via GUI? If not how to achieve this?
There are actually many ways to achieve this. You can use Windows Azure Portal to do or you could use 3rd party tools (like our Cloud Storage Studio) or you could write your own application using Windows Azure Service Management API (http://msdn.microsoft.com/en-us/library/ee460799.aspx)
How do I know my worker role has been running or not running (including why it's not running ie. logs)
Again you could use one of the GUI based tools to see the status of your roles. As far as why the roles are not running, you would need to enable Windows Azure Diagnostics in your worker role (http://msdn.microsoft.com/en-us/library/gg433048.aspx)
How do I spin multiple worker role based on time (i.e. (9:00AM to 11:00AM spin 4 roles and scale down on quiet period)
You can write your own application using Windows Azure Service Management API to do so or you could make use of 3rd party tools like AzureWatch from Paraleap or Azure Management Cmdlets (both from Microsoft and our company). While the cmdlets will get the job done, I believe Azure Watch is much more sophisticated solution. We wrote a blog post for autoscaling some days back which you can find here: http://www.cerebrata.com/Blog/post/Scale-your-Windows-Azure-instances-with-Azure-Management-Cmdlets.aspx.