Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,48 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5D8A1D8A-C5B5-4FBC-B10E-1265A4A4ECBF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ServiceBusThroughputTest.Common</RootNamespace>
<AssemblyName>ServiceBusThroughputTest.Common</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ILogger.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.*"/>
<PackageReference Include="System.Text.Json" Version="9.*"/>
</ItemGroup>

</Project>
44 changes: 11 additions & 33 deletions ThroughputTest_v2/ServiceBusThroughputTest/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//---------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//---------------------------------------------------------------------------------

namespace ServiceBusThroughputTest
Expand All @@ -17,21 +17,18 @@ namespace ServiceBusThroughputTest
using CommandLine.Text;
using System.Diagnostics;
using ServiceBusThroughputTestLib;
using System.Configuration;

class Program
{
const string connString = "<ns-conn-str>";
const string queue = "queue1";
const string MetricsSamplesPerDisplayIntervalSenderKeyName = "MetricsSamplesPerDisplayIntervalSender";
const string MetricsSamplesPerDisplayIntervalReceiverKeyName = "MetricsSamplesPerDisplayIntervalReceiver";
const int MetricsSamplesPerDisplayIntervalSenderDefault = 2000;
const int MetricsSamplesPerDisplayIntervalReceiverDefault = 10000;

static void Main(string[] args)
{
CommandLine.Parser.Default.ParseArguments<Settings>(args)
.WithParsed<Settings>(opts => StartSendReceives(opts));
.WithParsed<Settings>(opts => StartSendReceives(opts));
}

static void StartSendReceives(Settings settings)
Expand All @@ -46,9 +43,8 @@ static void StartSendReceives(Settings settings)

settings.PrintSettings();

int metricsSamplesPerDisplayIntervalSender, metricsSamplesPerDisplayIntervalReceiver;
GetConfigValue(MetricsSamplesPerDisplayIntervalSenderKeyName, int.Parse, out metricsSamplesPerDisplayIntervalSender, MetricsSamplesPerDisplayIntervalSenderDefault);
GetConfigValue(MetricsSamplesPerDisplayIntervalReceiverKeyName, int.Parse, out metricsSamplesPerDisplayIntervalReceiver, MetricsSamplesPerDisplayIntervalReceiverDefault);
int metricsSamplesPerDisplayIntervalSender = MetricsSamplesPerDisplayIntervalSenderDefault;
int metricsSamplesPerDisplayIntervalReceiver = MetricsSamplesPerDisplayIntervalReceiverDefault;

Console.WriteLine("Starting senders and receivers. Press Enter key to stop at anytime...");

Expand Down Expand Up @@ -127,7 +123,7 @@ private static void Metrics_OnMetricsDisplay(object _, MetricsDisplayEventArgs e

Console.Write("R|{0,10}|{1,10}|{2,5}|{3,5}|", rList.First().Tick / Stopwatch.Frequency + 1, rList.Last().Tick / Stopwatch.Frequency + 1, settings.ReceiveBatchSize, settings.MaxInflightReceives);
WriteStat(rList, i => i.ReceiveDuration100ns, Stopwatch.Frequency / 1000.0);

var msgs = rList.Sum(i => i.Messages);
receiveTotal += msgs;
Console.Write("{0,10:0.00}|{1,10}|{2,10}|{3,10}|{4,10}|{5,10}|", rList.Sum(i => i.Messages) / (double)settings.MetricsDisplayFrequency, msgs, rList.Sum(i => i.Receives), rList.Sum(i => i.Errors), rList.Sum(i => i.BusyErrors), receiveTotal);
Expand Down Expand Up @@ -157,33 +153,15 @@ static void WriteStat<T>(IList<T> list, Func<T, long> f, double scale)
Console.Write("{0,10:0.00}|{1,10:0.00}|{2,10:0.00}|{3,10:0.00}|", list.Average(f) / scale, list.Min(f) / scale, list.Max(f) / scale, Percentile(list.Select(s => f(s)).ToArray(), 0.99) / scale);
}

static bool GetConfigValue<T>(string keyName, Func<string, T> parseFunc, out T val, T defaultVal = default(T))
{
if (ConfigurationManager.AppSettings.AllKeys.Contains(keyName))
{
try
{
val = parseFunc(ConfigurationManager.AppSettings[keyName]);

return true;
}
catch { }
}

val = defaultVal;

return false;
}

static void TestSBReceiver()
{
ServiceBusThroughputTestLib.Receiver receiver = new ServiceBusThroughputTestLib.Receiver(connString, "queue1", 1024*10, 10, 1024, 1, 60000, false);
ServiceBusThroughputTestLib.Receiver receiver = new ServiceBusThroughputTestLib.Receiver(connString, "queue1", 1024 * 10, 10, 1024, 1, 60000, false);
CancellationTokenSource cts = new CancellationTokenSource();
Task rt = receiver.Run(cts.Token);
Thread.Sleep(TimeSpan.FromMinutes(2));
cts.Cancel();
rt.Wait();
}
}

static void TestSBSender()
{
Expand Down Expand Up @@ -288,7 +266,7 @@ public static IEnumerable<Example> Examples
get
{
yield return new Example("queue scenario", new Settings { ConnectionString = "{Connection-String}", QueueName = "{Queue-Name}" });
yield return new Example("topic scenario", new Settings { ConnectionString = "{Connection-String}", QueueName = "{Topic-Name}:{Subsription-Name}"});
yield return new Example("topic scenario", new Settings { ConnectionString = "{Connection-String}", QueueName = "{Topic-Name}:{Subsription-Name}" });
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,77 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{72A4A64B-EADB-4A0D-8541-6893895ADFAD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ServiceBusThroughputTest</RootNamespace>
<AssemblyName>ServiceBusThroughputTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Metrics.cs" />
<Compile Include="MetricsData.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser">
<Version>2.9.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="System.Buffers">
<Version>4.5.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceBusThroughputTest.Common\ServiceBusThroughputTest.Common.csproj">
<Project>{5d8a1d8a-c5b5-4fbc-b10e-1265a4a4ecbf}</Project>
<Name>ServiceBusThroughputTest.Common</Name>
</ProjectReference>
<ProjectReference Include="..\ServiceBusThroughputTestLib\ServiceBusThroughputTestLib.csproj">
<Project>{da73050d-b46d-4760-aef5-cd86e25dfab5}</Project>
<Name>ServiceBusThroughputTestLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.*"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ServiceBusThroughputTest.Common\ServiceBusThroughputTest.Common.csproj"/>
<ProjectReference Include="..\ServiceBusThroughputTestLib\ServiceBusThroughputTestLib.csproj"/>
</ItemGroup>

</Project>

This file was deleted.

Loading