Posted on Leave a comment

JMeter Introduction – Load test your website

The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance.

You can download from the official webpage and install it for your system given than you already have Java installed.

For windows installations the only thing that you need to do, will be to run as Administrator the jmeter.bat file.

Then you can access the GUI and perform actions with clicks. In this guide I will demonstrate how you can create an http call on your website and perform a load test on it.

In order to start you will need to add a thread group. Right click on test plan and then click threads and select thread group.

Inside the thread group you can create a HTTP Request action. In order to do that you will select add Sampler and then from the available Samplers you will select the HTTP Request.

ON the HTTP Request you will need to configure the host and also the protocol. As my site is working on https I will use this one along with the port 443.

Additionally you can add a listener on your HTTP Request in order to get the results either with a Graph or with a table. To add the result output you will have to press Listener and then select the one that you want.

The below result will be the aggregate report which will show statistics for the requests.

We can also visualize the results using a Graph result

The most important part of the configuration will be the Thread group options which can be found under Thread Group.

There you can configure the below three important things:

Number of threads: Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.

The ramp-up period is the time JMeter should take to start the total number of threads, the time frame (in seconds) for all requests to start. All the threads specified in the Number of Threads input will start within Ramp-up period. For example 100 threads and 100 seconds ramp-up: each second JMeter will start 1 Thread until all threads are started by the time the 100 seconds are up.

The loop count tells JMeter how many times to repeat your test. If you enter a loop count value of 1, then JMeter will run your test only once. To have JMeter repeatedly run your Test Plan, select the Forever checkbox.

Posted on Leave a comment

Add log analytics workspace to Azure app service – Terraform

Most times you will need to store logs for your azure resources in order to troubleshoot when things do not work as expected. Diagnostic settings for an app service can be enabled from the pane under Monitoring.

Then you should configure the diagnostic settings that will point which logs should be forwarded.

You can choose from the available categories shown below.

Lets now discover how we can enable diagnostic settings for an app service using terraform.

Create a file for example diagnostic_settings.tf and apply. The below configuration will enable all diagnostic settings categories.

resource "azurerm_monitor_diagnostic_setting" "diag_settings" {
  name               = "diag-settings"
  target_resource_id = azurerm_windows_web_app.app_service1.id
  log_analytics_workspace_id = local.log_analytics_workspace_id
  
  log {
    category = "AppServiceHTTPLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

    log {
    category = "AppServiceConsoleLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

    log {
    category = "AppServiceAppLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

    log {
    category = "AppServiceAuditLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

    log {
    category = "AppServiceIPSecAuditLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

     log {
    category = "AppServicePlatformLogs"
    enabled  = true

    retention_policy {
      enabled = false
    }
  }

  metric {
    category = "AllMetrics"

    retention_policy {
      enabled = false
      days = 30
    }
  }

}

You can also perform the same using a loop and a local variable in order to minimize code and make it more readable.

Assign a new variable inside your locals.tf file.

 log_analytics_log_categories     = ["AppServiceHTTPLogs", "AppServiceConsoleLogs","AppServiceAppLogs","AppServiceAuditLogs","AppServiceIPSecAuditLogs","AppServicePlatformLogs"]

Then perform terraform apply.

resource "azurerm_monitor_diagnostic_setting" "diag_settings" {
  name               = "diag-rule"
  target_resource_id = azurerm_windows_web_app.app_service1.id
  log_analytics_workspace_id = local.log_analytics_workspace_id
  
  dynamic "log" {
    iterator = entry
    for_each = local.log_analytics_log_categories
    content {
        category = entry.value
        enabled  = true

        retention_policy {
      enabled = false
        }
    }
   
  }

  metric {
    category = "AllMetrics"

    retention_policy {
      enabled = false
      days = 30
    }
  }

}

After applying terraform all the settings will be enabled.

Posted on Leave a comment

Query Azure Easy Tables with Postman

There is an easy way to interact with Easy Tables on Azure when you want to test things.

 

You can use a program like postman and create a post request for your table. For example if your table is named users, you should use users after tables/

http://YOURURL.azurewebsites.net/tables/users

 

 

I was testing some requests and I was dealing an exception and I figured that the request should contain the following things.

In the headers is necessary to add Content-Type and Zumo-Api-Version.

 

 

After that you should easily send your post request by selecting raw in the body section.