{"id":20066,"date":"2016-08-22T06:09:21","date_gmt":"2016-08-22T10:09:21","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=20066"},"modified":"2019-02-14T17:33:43","modified_gmt":"2019-02-15T01:33:43","slug":"use-cloud-load-agents-on-your-infrastructure","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/use-cloud-load-agents-on-your-infrastructure\/","title":{"rendered":"Use cloud load agents on your infrastructure"},"content":{"rendered":"<p>This blog talks about how you can configure your own machines (physical\/VMs) with Cloud-based Load Testing service to do a load test run. This is primarily useful when you want to load test an application which is not publically accessible. To get more context around this, please refer &#8216;<a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2016\/08\/23\/testing-privateintranet-applications-using-cloud-based-load-testing\/\">Load testing Applications behind Firewall using Cloud-based Load Testing Service<\/a>&#8216; . If you wish to provision the rig in your Azure subscription you can refer the previous blog.<\/p>\n<p>Following is the basic topology of load agents and CLT service. Once configured the load agents will get instructions from CLT to carry out the load test run.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0019.png\"><img decoding=\"async\" width=\"563\" height=\"314\" title=\"clip_image001\" class=\"aligncenter\" style=\"float: none;padding-top: 0px;padding-left: 0px;margin-left: auto;padding-right: 0px;margin-right: auto;border-width: 0px\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/clip_image001_thumb8.png\" border=\"0\" \/><\/a><\/p>\n<p align=\"center\"><em><span style=\"font-size: small\">Typical topology of having user&#8217;s own machines as load agents registered with CLT.<\/span><\/em><\/p>\n<p>It is recommended to use clean machines with already having .net 4.6 (download link for .net 4.6 is <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/5a4x27ek(v=vs.110).aspx\">here<\/a>). You can download the powershell script through following link.<\/p>\n<p><a href=\"https:\/\/elsprodch2su1.blob.core.windows.net\/ets-containerfor-loadagentresources\/bootstrap\/ManageVSTSCloudLoadAgent.ps1\">Download powershell script to configure user load agent<\/a><\/p>\n<p>Once you down, please make sure you unblock the script by going into the properties of the file.<\/p>\n<p><img decoding=\"async\" width=\"364\" height=\"512\" class=\"size-full wp-image-26625 alignnone\" alt=\"properties\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/properties.png\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0027.png\"><\/a><\/p>\n<p><strong>Script \u2013 ManageVSTSCloudLoadAgent.ps1<\/strong><\/p>\n<p><span>Mandatory parameters for the script:<\/span><\/p>\n<ol type=\"1\">\n<li value=\"1\"><span><strong>TeamServicesAccountName:<\/strong> <\/span>It is the name of the VSTS account with which you want to configure your machines. Use just need to pass the account name here e.g., please put &#8216;xyz&#8217; if your VSTS account url is <a href=\"https:\/\/xyz.visualstudio.com\/\">https:\/\/xyz.visualstudio.com<\/a><\/li>\n<li value=\"2\"><strong>PATToken: <\/strong>It is required for authentication. One has to first get the PAT token for the VSTS account. Follow this <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/setup-admin\/team-services\/use-personal-access-tokens-to-authenticate\">post<\/a> to get it. The scope should be selected as \u2018Load Test (read and write)\u2019.<\/li>\n<\/ol>\n<p><strong>Parameters to configure an agent:<\/strong><\/p>\n<p><strong>Agent group name-<\/strong> The machine will get registered under this agent group name. If the agent group doesn\u2019t exist, it&#8217;ll get created first. This input is mandatory.<\/p>\n<p>Example:<\/p>\n<p>.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName <a href=\"https:\/\/xyz.visualstudio.com\/\">https:\/\/xyz.visualstudio.com<\/a> -PATToken olxpldk2xcdfp5bt2ruemetwrmv7xyzk23l4cnnewi3rbaq -ConfigureAgent -AgentGroupName &#8216;trial&#8217;<\/p>\n<p>With the above command the current machine will be configured as VSTS cloud load agent for xyz.visualstudio.com under the agent group named as &#8216;trial. Once the powershell scripts completes, it would have installed and started a windows service on the machine named as &#8216;<span>VSTSLoadAgentService<\/span>&#8216;. This may take around 5-10 mins.<\/p>\n<p>At present we are treating all load agents same and if even though user has different machines as load agents we will get equal load generated from each machine. If you have some feedback around this, please reach out to us. Once configured these machines will be auto upgraded whenever needed.<\/p>\n<p>Apart from configuring an agent the above mentioned powershell script is capable more operations that are listed below.<\/p>\n<h2>Managing self-provisioned agents<\/h2>\n<p><strong>Get agent groups-<\/strong> It&#8217;ll list down all the registered agent groups with the VSTS account. Example is as follows:<\/p>\n<p>.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName <a href=\"https:\/\/xyz.visualstudio.com\/\">https:\/\/xyz.visualstudio.com<\/a> -PATToken olxpldk2xcdfp5bt2ruemetwrmv7xyzk23l4cnnewi3rbaq -GetAgentGroups<\/p>\n<p><strong>Get agents- <\/strong>It&#8217;ll list down all the agents and their latest status of a particular agent group name. Example is as follows:<\/p>\n<p>.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName <a href=\"https:\/\/xyz.visualstudio.com\/\">https:\/\/xyz.visualstudio.com<\/a> -PATToken olxpldk2xcdfp5bt2ruemetwrmv7xyzk23l4cnnewi3rbaq -AgentGroupName test -GetAgents<\/p>\n<p><strong>Delete an agent- <\/strong>It&#8217;ll delete the agent reference from service. The agent must be in the offline state before a user can delete it. Agent group name is mandatory. Refer the following for example:<\/p>\n<p>.ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName <a href=\"https:\/\/xyz.visualstudio.com\/\">https:\/\/xyz.visualstudio.com<\/a> -PATToken olxpldk2xcdfp5bt2ruemetwrmv7xyzk23l4cnnewi3rbaq -DeleteAgent -AgentGroupName test -AgentName dpk-param<\/p>\n<p>You can find more details by doing get-help on the ManageVSTSCloudLoadAgent.ps1.<\/p>\n<h3>How to queue a run using load agents<\/h3>\n<h3>Using VSTS portal<\/h3>\n<p>Now you can queue load test runs on self-provisioned agents through VSTS portal. As shown in below UI, you have a choice to select the type of agents in the settings tab.<\/p>\n<p><img decoding=\"async\" width=\"685\" height=\"617\" class=\"aligncenter size-full wp-image-26605\" alt=\"vsts\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/VSTS.png\" \/><\/p>\n<h3>Using Visual Studio Enterprise IDE<\/h3>\n<p>We are working on making it as first class experience in our product. Till then user can queue a run on these machines by having the following context parameter in Visual Studio Load Test file.<\/p>\n<blockquote><p>Context parameter name \u2013 UseStaticLoadAgents<\/p>\n<p>Context parameter value &#8211; true<\/p>\n<p>Context parameter name \u2013 StaticAgentsGroupName<\/p>\n<p>Context parameter value &#8211; &lt;name of the agent group&gt;<\/p><\/blockquote>\n<p><img decoding=\"async\" width=\"305\" height=\"276\" class=\"size-full wp-image-26615 alignnone\" alt=\"contextparam\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/contextparam.png\" \/><\/p>\n<p>User can set the number of machines to be used for a load test run through Agent core count property present in Run Settings. In user&#8217;s own load agents scenario every core is treated as a single machine. As shown in below image, 5 machines will be used for the run.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image0058.png\"><img decoding=\"async\" width=\"346\" height=\"90\" title=\"clip_image005\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" alt=\"clip_image005\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/clip_image005_thumb6.png\" border=\"0\" \/><\/a><\/p>\n<p>The runs done on user&#8217;s own load agents machines are not charged. User should be able to confirm this by looking into the status messages of the run.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/clip_image00611.jpg\"><img decoding=\"async\" width=\"1109\" height=\"253\" title=\"clip_image006\" class=\"aligncenter\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" alt=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/clip_image006_thumb10.jpg\" border=\"0\" \/><\/a><\/p>\n<p>Before you do that, we would recommend you to go through the FAQs as well.<\/p>\n<h3><span style=\"font-weight: bold\">Frequently asked question \u2013 <\/span><\/h3>\n<ol>\n<li><strong>How do the load agents communicate with CLT?\u00a0\u00a0 <\/strong>The load agents will communicate with CLT using HTTPs protocol. Since these machines\/VMs are inside user&#8217;s private network (Azure\/on-prem), they can reach the Application under Test (AuT) easily. The results are published back to the CLT service so that the analysis can happen in similar manner as done for other type of load test runs in CLT.<\/li>\n<li><strong>How I am being charged for this?\u00a0\u00a0 <\/strong>At present this feature is in preview mode and you will not incur load testing VUM charges for the runs where you deploy load agents on your premises or in your Azure subscription. However, you will be charged the applicable Azure VM costs.<\/li>\n<li><strong>Can I use these machines for some other purpose?\u00a0\u00a0 <\/strong>These machines can be used other your other tasks as well but it is recommended to not have anything running while a load test run is in progress.<\/li>\n<li><strong>Can I shut down the machines where I have configured load test agent?\u00a0\u00a0 <\/strong>Yes, the machines can be shut down when not in use. The load agent service will automatically start to receive commands from CLT, once the machine is up. If you are using Azure ARM template to deploy these agents, you can start\/stop the VMs based on your need. You can also do this using a powershell script. Refer following link to more on this.<a href=\"https:\/\/gallery.technet.microsoft.com\/scriptcenter\/Stop-All-VMs-in-Specified-40c8531e\">https:\/\/gallery.technet.microsoft.com\/scriptcenter\/Stop-All-VMs-in-Specified-40c8531e<\/a>You are also recommended to delete the Azure resource group once you are done with load testing. You should be able to re-create it anytime later if you need to.<a href=\"https:\/\/azure.microsoft.com\/en-in\/documentation\/articles\/resource-group-portal\/\">https:\/\/azure.microsoft.com\/en-in\/documentation\/articles\/resource-group-portal\/<\/a><\/li>\n<li><strong>I have proxy settings on my machines, will this work?\u00a0\u00a0 <\/strong>We support only default proxy scenario i.e., when the proxy settings are controlled through IE and it uses the current user&#8217;s credentials to connect to proxy server. In other cases, please reach out to us.<\/li>\n<li><strong>From where I can collect the logs to debug some issue?<\/strong><span>\nThe powershell script logs are stored in the logs folder which will be present in the same folder where the powershell script exists. These logs are displayed in the powershell window as well.\u00a0 <\/span>Run execution logs reside in %windir%tempCloudLoadTest logs folder.<\/li>\n<\/ol>\n<p>With all this, you should be able to go ahead and try out the load testing. Do reach out to us on <a href=\"mailto:vsoloadtest@microsoft.com\">vsoloadtest@microsoft.com<\/a>, if you have any query.<\/p>\n<p>Happy Load Testing!\u00a0<img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" alt=\"Smile\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/08\/wlEmoticon-smile5.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog talks about how you can configure your own machines (physical\/VMs) with Cloud-based Load Testing service to do a load test run. This is primarily useful when you want to load test an application which is not publically accessible. To get more context around this, please refer &#8216;Load testing Applications behind Firewall using Cloud-based [&hellip;]<\/p>\n","protected":false},"author":162,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[224,1,252],"tags":[],"class_list":["post-20066","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-devops","category-testing"],"acf":[],"blog_post_summary":"<p>This blog talks about how you can configure your own machines (physical\/VMs) with Cloud-based Load Testing service to do a load test run. This is primarily useful when you want to load test an application which is not publically accessible. To get more context around this, please refer &#8216;Load testing Applications behind Firewall using Cloud-based [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/20066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/162"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=20066"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/20066\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=20066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=20066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=20066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}