I have 2 azure vm's created, 1 windows server 2012 r2, and 1 Ubuntu 14.
It takes both those vm's approximately 5 minutes to startup.
Is there a way I can speed up the process?
I don't need the vm's running continuously, I prefer to start/stop, as per need.
There are no steps you can take to speed up the VM start. Resources must be allocated and the VM provisioned.
What I can recommend is setting up a script to auto start / stop your VM's based on a schedule. For example, if you are using them in a class room environment you can set it up so that they start early (6am?) and shut down each day by 5pm.
You can find some more information about this here.
Related
If I have 5 bots for trading and a along with this a script that does some updating on prices using scraping. All these files uses Node js. Now, I was able to deploy all the 6 scripts on digital ocean, but due to 6 scripts running together as 6 different processes the CPU usage in even their most expensive plan became 100%. Then I decided to shift to google cloud. But it turns out with GPU it is hell expensive.
Essentially what I want to do is that run the 6 scripts at 3 distinct times in a day for 10 mins. Other than those particular times the 6 scripts do nothing.
I have set a file named concurrently.js that runs all these scripts using the command concurrently.
Is it possible to run concurrently.js at 3 particular times of the day and then after 10 mins when the job is done, shut down the virtual machine?
Say machine turns on at 12.00pm then the 6 files work for 10 mins and then the machine shuts off at 12.10 pm. And then turns on at say 3.05 pm and so on.
If I can schedule on and off of the VM I can afford google cloud.
I got to know about cron and google cloud scheduler, but they need an App url to schedule tasks. But I don't have an app url because I don't have app only, I just want to run the concurrently.js file present in the virtual machine along with other files, can I do the scheduling?
Any help is highly appreciated!!!
You can do this with Google Cloud. Here the process
Cloud Scheduler start your Compute Engine VM
At startup, the Compute Engine VM runs a startup script that run your process
At the end of the process the VM auto shutdown
So for that you need to
Call the Compute Engine start API
Set a startup script on your VM
Shutdown the VM automatically at the end of the processing
If you are stuck in one step, let me know, I could narrow my help.
I need an Azure VM (Ubuntu) to do some task (java application) every 10 minutes. Because the task lasts usually less than a minute I would save money if could start the machine every 10 minutes and stop it when the task accomplishes. I learned that I can schedule start and stop times in automation account, but more optimal would be to stop the VM in the very moment that task is completed. Is there a simple way to do that?
This really sounds like a job for Azure Batch. If you are looking for an IaaS solution, Azure Batch will do the job for you. Have a look at it: https://azure.microsoft.com/en-gb/services/batch/#overview.
It allows you to use VM's with your preferred OS (in Azure Batch it is called a node), and run a set of tasks. Once finished, the VM will be de-allocated.
So each node runs a set of pools, in each pool you have a job, and in each job you can have tasks. A task can be for example a cmd line that runs a specific app. So for instance you could just run example.exe 1 2 on a windows OS or the equivalent command line for an Ubuntu OS.
The power here is that it will allocate the tasks to run on the VM when you add them to the job, and then the VM will be disposed off once finished, and you would only pay for the compute time.
The disadvantages of this is that it is a stateless VM, therefore anything that you need installing or storing you would have to use alternative methods. Azure Batch allows you to pre-install a program (for example your Java application) each time it initiates. Also if you are using files and/or expecting files to be created, you would need a blob storage to support this. So if you are expecting it to use a certain amount of files, store them on blob storage and then write back to the blob storage if your program is doing this.
Finally your scheduler, this really depends on how you want to deal with it, if you have a local server or a server on Azure that is already running 24/7 you can add a scheduled job to the scheduler and run a program that will add the task to the Azure Batch. Or if you don't mind using Azure Functions, you can just add a timer Azure Function that will add a task to the job. There are multiple ways of dealing with this, you may already have an existing solution.
Hope you find this useful!
Virtual Machine scale set in Azure doesn't scale. The CPU usage on the VM is 99%, but the utilziation shown on Azure for only one is around 10%-20%.
I have tried adjusting the scale lower for the average cpu to 40%, but it doesn't change anything.
When the virtual machine starts, there is a load of around %80-90 instantly from my code. The scale set should scale to a second machine after 5 minutes and keep repeating until the load decreases and all runs are complete. What happens the machine starts and if you RDP to the machine, task manager shows the process using 80-90% cpu constantly. If you view Azure to see the scale set as a whole it only list 10-20% cpu usage. The virtual machine is a server 2016 core edition built-in to Azure. It is almost like it isn't reporting back to azure the CPU usage, so it never scales beyond 1 maybe 2 every once in a while.
Today we had an issue with Azure VMs where one VM in availability set of 2 just stopped responding. After few mins we noticed that machine was shutdown and the other VM in the set wasn't turned on (which should be ok as this isn't a failover). We have take a look at the VM monitoring and there wasn't a single log telling us that there was any downtime. The only thing that we found is 2 strange logs in the Management Services - Operation Logs.
11/12/2013 10:12:02 PM AutoscaleAction Succeeded VirtualMachinesAvailabilitySet:xyz Autoscale
11/12/2013 9:36:56 PM AutoscaleAction Succeeded VirtualMachinesAvailabilitySet:xyz Autoscale
The first one was with following details:
Description: The autoscale engine attempting to scale resource
'xyz' from 0 instances count to 1 instances count.
LastScaleActionTime: 20131106T173020Z
NewInstancesCount: 1
OldInstancesCount: 0
Second one:
The autoscale engine attempting to scale resource 'xyz' from 2
instances count to 1 instances count.
LastScaleActionTime: 20131112T203656Z
NewInstancesCount: 1
OldInstancesCount: 2
Does anyone know what may had happen ?
UPDATE
Azure Support has provided me with the feedback and they explained that machines were down due to host update.
Regards
Whenever you use autoscale you set an instance range that tells Azure the minimum and maximum number of VM's you want to be running at a given point in time. In this case, it looks like you've set the minimum to be 1. That would explain why, when both VM's were stopped, it turned on one of them.
In addition, the scale from 2 to 1 was likely because load was low on your VM's (assuming you're scaling by CPU). If the average CPU remains below the target you've established (by default 60%), it will scale down until it hits the minimum (in this case, 1).
Both of my machines were down because of the host update and AutoScaling set from 1 to 2 machines based on CPU usage. So I have found out that AutoScaling won't turn the second machine on when doing host update (which can be pretty helpful and make my apps online).
I think that will explain the 0 of 1 instances issue, so don't use AutoScaling with above setup to get HA.
Regards
I have 2 VM machines on Azure.
One suddenly stopped responding.
It was down for around 30 minutes, until I just browsed into the Azure portal, and then I saw it was in the Starting state, and then it was up & running again.
How can I tell why my VM was shutdown?
EDIT: I'm assuming you're talking about Virtual Machines (IaaS), and not Cloud Services (PaaS).
Virtual Machines can, and will, restart, for several reasons. For example:
Hardware failure, where your Virtual Machine will then be restarted on another server.
Host OS refresh. This is the operating system running the physical server.
Some type of OS crash
Also keep in mind: Virtual Machines are in Preview with no SLA today. So there wouldn't be any information readily available to you for determining why your Virtual Machine became unavailable.
If it was unavailable for 30 minutes, then this hints at something akin to a host OS update or your virtual machine being moved. If it was down for, say, 5 minutes, then I'd guess it was an OS crash.
UPDATE I just looked at the Azure Dashboard which is showing degraded Compute with Virtual Machines (see RSS feed with problem description). Perhaps this is the root cause of your particular outage...
there are several things that might cause this to happen, your VM may have been crashed due to bad coding or bad development, the second reason I think is that the number of VM you created is not enough to the incoming traffic. this could cause your VM to restart if the number of incoming traffic is more than the number of VMs can handle.