Browse Source

Added benchmark for evhttp-sharp (libevent2-based simple web server)

Nikita Tsukanov 12 years ago
parent
commit
1fe7a79c6a

+ 8 - 0
evhttp-sharp/.gitignore

@@ -0,0 +1,8 @@
+*.user
+*.suo
+*/bin/*
+*/obj/*
+obj/
+[Bb]in
+[Dd]ebug*/
+[Rr]elease*/

+ 24 - 0
evhttp-sharp/benchmark_config

@@ -0,0 +1,24 @@
+{
+  "framework": "evhttp-sharp",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/",
+      "plaintext_url": "/plaintext",
+      "port": 8085,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "evhttp-sharp",
+      "language": "C#",
+      "orm": "Raw",
+      "platform": "Mono",
+      "webserver": "none",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "evhttp-sharp",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 28 - 0
evhttp-sharp/setup.py

@@ -0,0 +1,28 @@
+import subprocess
+import sys
+import setup_util
+import os
+
+root = os.getcwd() + "/evhttp-sharp"
+app = root + "/src"
+
+def start(args):
+  if os.name == 'nt':
+    return 1
+
+  try:
+    # build
+    subprocess.check_call("rm -rf bin obj", shell=True, cwd=app)
+    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd=app)
+    
+    subprocess.Popen("mono -O=all bin/Release/EvHttpSharpBenchmark.exe 127.0.0.1 8085 " + str(args.max_threads) + " &", shell=True, cwd=app)
+    return 0
+  except subprocess.CalledProcessError:
+    return 1
+
+def stop():
+  if os.name == 'nt':
+    return 0
+  
+  subprocess.check_call("pkill -9 mono", shell=True)
+  return 0

+ 69 - 0
evhttp-sharp/src/EvHttpSharpBenchmark.csproj

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{94B0D092-4377-4A5C-B222-4F005D316DB0}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>EvHttpSharpBenchmark</RootNamespace>
+    <AssemblyName>EvHttpSharpBenchmark</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </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="EvHttpSharp">
+      <HintPath>lib\EvHttpSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>lib\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <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.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="libevent_core-2-0-5.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="libevent_extra-2-0-5.dll">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 20 - 0
evhttp-sharp/src/EvHttpSharpBenchmark.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvHttpSharpBenchmark", "EvHttpSharpBenchmark.csproj", "{94B0D092-4377-4A5C-B222-4F005D316DB0}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{94B0D092-4377-4A5C-B222-4F005D316DB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{94B0D092-4377-4A5C-B222-4F005D316DB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{94B0D092-4377-4A5C-B222-4F005D316DB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{94B0D092-4377-4A5C-B222-4F005D316DB0}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 37 - 0
evhttp-sharp/src/Program.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using EvHttpSharp;
+using Newtonsoft.Json;
+
+namespace EvHttpSharpBenchmark
+{
+	class Program
+	{
+		public static readonly JsonSerializer Serializer = new JsonSerializer();
+
+		static void Main (string[] args)
+		{
+			var host = new EventHttpListener(Handler);
+			host.Start(args[0], ushort.Parse(args[1]), int.Parse(args[2]));
+		}
+
+		private static void Handler(EventHttpRequest req)
+		{
+			var headers = new Dictionary<string, string>();
+			var resp = "Hello, World!";
+
+			if (!req.Uri.Contains("plaintext"))
+			{
+				var sw = new StringWriter();
+				Serializer.Serialize(sw, new {message = "Hello, world"});
+				resp = sw.ToString();
+				headers["Content-Type"] = "application/json";
+			}
+			req.Respond (HttpStatusCode.OK, headers, Encoding.UTF8.GetBytes (resp));
+		}
+	}
+}

+ 36 - 0
evhttp-sharp/src/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle ("EvHttpSharpBenchmark")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("EvHttpSharpBenchmark")]
+[assembly: AssemblyCopyright ("Copyright ©  2013")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible (false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid ("8c379b35-c45f-4d4b-b54a-2a38ec7112d4")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: AssemblyFileVersion ("1.0.0.0")]

BIN
evhttp-sharp/src/lib/EvHttpSharp.dll


BIN
evhttp-sharp/src/lib/Newtonsoft.Json.dll


BIN
evhttp-sharp/src/lib/libevent_core-2-0-5.dll


BIN
evhttp-sharp/src/lib/libevent_extra-2-0-5.dll


BIN
evhttp-sharp/src/libevent_core-2-0-5.dll


BIN
evhttp-sharp/src/libevent_extra-2-0-5.dll