Browse Source

Fix aspnet-mono-ngx-my tests (#5010)

Lloyd Ho 6 years ago
parent
commit
95944820b0

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-jn.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my-ef.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-ss.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 CMD bash run.sh

+ 1 - 1
frameworks/CSharp/aspnet-mono-ngx/nginx.conf

@@ -2,7 +2,7 @@ pid /tmp/nginx.pid;
 error_log stderr error;
 
 events {
-    worker_connections 8192;
+    worker_connections 16384;
 }
 
 http {

+ 8 - 7
frameworks/CSharp/aspnet-mono-ngx/run.sh

@@ -4,24 +4,25 @@ CPU_COUNT=$(nproc)
 
 # one fastcgi instance for each thread
 # load balanced by nginx
-port_start=9001
-port_end=$(($port_start+$CPU_COUNT))
+socket_index_start=1
+socket_index_end=$(($socket_index_start+$CPU_COUNT))
 
 # To debug, use --printlog --verbose --loglevels=All
-for port in $(seq $port_start $port_end); do
-	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:/aspnet/src --socket=tcp:127.0.0.1:$port &
+for port in $(seq $socket_index_start $socket_index_end); do
+	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:/aspnet/src --filename=/tmp/fastcgi-mono-server4-$port --socket=unix &
 done
 
 sleep 5s
 
 # nginx
 conf="upstream mono {\n"
-for port in $(seq $port_start $port_end); do
-  conf+="\tserver 127.0.0.1:${port};\n"
+for port in $(seq $socket_index_start $socket_index_end); do
+  chmod -R 777 /tmp/fastcgi-mono-server4-$port
+  conf+="\tserver unix:/tmp/fastcgi-mono-server4-${port};\n"
 done
 conf+="}"
 
 echo -e $conf > nginx.upstream.conf
-nginx -c /aspnet/nginx.conf -g "worker_processes ${CPU_COUNT};"
+nginx -c /aspnet/nginx.conf
 
 wait

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.build.proj

@@ -6,9 +6,9 @@
     <Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
     <NuGetExe Condition=" '$(NuGetExe)'=='' ">packages/nuget.exe</NuGetExe>
     <NuGetExeDir>packages/</NuGetExeDir>
-    <NuGetDownloadAddress Condition=" '$(NuGetDownloadAddress)'=='' ">http://nuget.org/nuget.exe</NuGetDownloadAddress>
+    <NuGetDownloadAddress Condition=" '$(NuGetDownloadAddress)'=='' ">https://dist.nuget.org/win-x86-commandline/latest/nuget.exe</NuGetDownloadAddress>
     <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' == 'Windows_NT'">"$(NuGetExe)"</NuGetCommand>
-    <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExe)"</NuGetCommand>
+    <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' != 'Windows_NT' ">mono "$(NuGetExe)"</NuGetCommand>
     <Properties>Configuration=$(Configuration);SolutionDir=$(SolutionDir)</Properties>
   </PropertyGroup>
 

+ 36 - 25
frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.csproj

@@ -12,7 +12,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Benchmarks.AspNet</RootNamespace>
     <AssemblyName>Benchmarks.AspNet</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
     <MvcBuildViews>false</MvcBuildViews>
     <RestorePackages>true</RestorePackages>
   </PropertyGroup>
@@ -47,10 +47,6 @@
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
     </Reference>
-    <Reference Include="System.Web.Razor">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
-    </Reference>
     <Reference Include="System.Web.WebPages">
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
@@ -65,22 +61,6 @@
     <Reference Include="ServiceStack.Text">
       <HintPath>$(SolutionDir)\packages\ServiceStack.Text.4.0.34\lib\net40\ServiceStack.Text.dll</HintPath>
     </Reference>
-    <Reference Include="EntityFramework">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
-    </Reference>
-    <Reference Include="EntityFramework">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
-    </Reference>
-    <Reference Include="MySql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\MySql.Data.6.9.5\lib\net45\MySql.Data.dll</HintPath>
-    </Reference>
-    <Reference Include="MySql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\MySql.Data.Entity.6.9.5\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
-    </Reference>
     <Reference Include="Npgsql">
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
@@ -89,10 +69,6 @@
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Npgsql.EntityFramework.2.2.3\lib\net45\Npgsql.EntityFramework.dll</HintPath>
     </Reference>
-    <Reference Include="Npgsql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
-    </Reference>
     <Reference Include="MongoDB">
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Bson.dll</HintPath>
@@ -101,6 +77,41 @@
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Driver.dll</HintPath>
     </Reference>
+    <Reference Include="System.Web.Razor">
+      <Private>True</Private>
+      <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
+    </Reference>
+    <Reference Include="Renci.SshNet">
+      <HintPath>packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
+    </Reference>
+    <Reference Include="BouncyCastle.Crypto">
+      <HintPath>packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer">
+      <HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="Google.Protobuf">
+      <HintPath>packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data.EntityFramework">
+      <HintPath>packages\MySql.Data.EntityFramework.8.0.17\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Xml" />
+    <Reference Include="EntityFramework">
+      <HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data">
+      <HintPath>packages\MySql.Data.8.0.17\lib\net452\MySql.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="Npgsql">
+      <Private>False</Private>
+      <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Application.cs" />

+ 5 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Controllers/AdoController.cs

@@ -22,9 +22,12 @@ namespace Benchmarks.AspNet.Controllers
             return connection;
         }
         
-        public ActionResult Index(string providerName, int? queries)
+        public ActionResult Index(string providerName, string queries)
         {
-            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queries ?? 1)));
+            int queryInt = 1;
+            int.TryParse(queries, out queryInt);
+            
+            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queryInt)));
             
             using (DbConnection connection = CreateConnection(providerName))
             {

+ 5 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Controllers/EntityFrameworkController.cs

@@ -10,9 +10,12 @@ namespace Benchmarks.AspNet.Controllers
     {
         Random random = new Random();
 
-        public ActionResult Index(string providerName, int? queries)
+        public ActionResult Index(string providerName, string queries)
         {
-            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queries ?? 1)));
+            int queryInt = 1;
+            int.TryParse(queries, out queryInt);
+
+            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queryInt)));
 
             using (EntityFramework db = new EntityFramework(providerName))
             {

+ 21 - 19
frameworks/CSharp/aspnet-mono-ngx/src/Web.config

@@ -1,31 +1,33 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
   </configSections>
   <!-- Connection Strings -->
   <!-- Names are case insensitive -->
   <connectionStrings>
-    <add name="MySQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="MySql.Data.MySqlClient"/>
-    <add name="PostgreSQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="Npgsql"/>
-    <add name="MongoDB" connectionString="mongodb://tfb-database"/>
-    <add name="SQLServer" connectionString="server=tfb-database; user id=benchmarkdbuser; password=B3nchmarkDBPass; database=hello_world" providerName="System.Data.SqlClient"/>
+    <add name="MySQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="MySql.Data.MySqlClient" />
+    <add name="PostgreSQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="Npgsql" />
+    <add name="MongoDB" connectionString="mongodb://tfb-database" />
+    <add name="SQLServer" connectionString="server=tfb-database; user id=benchmarkdbuser; password=B3nchmarkDBPass; database=hello_world" providerName="System.Data.SqlClient" />
   </connectionStrings>
   <!-- ADO.NET -->
   <system.data>
     <DbProviderFactories>
-      <clear/>
-      <add name="MySql.Data.MySqlClient" description="Data Provider for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.5"/>
-      <add name="Npgsql" description="Data Provider for PostgreSQL" invariant="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.3"/>
-      <add name="System.Data.SqlClient" description="Data Provider for Microsoft SQL Server" invariant="System.Data.SqlClient" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0"/>
+      <clear />
+      <add name="MySql.Data.MySqlClient" description="Data Provider for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.17" />
+      <add name="Npgsql" description="Data Provider for PostgreSQL" invariant="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.3" />
+      <add name="System.Data.SqlClient" description="Data Provider for Microsoft SQL Server" invariant="System.Data.SqlClient" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0" />
     </DbProviderFactories>
   </system.data>
   <!-- Entity Framework -->
   <entityFramework>
     <providers>
-      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5"/>
-      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.3"/>
+      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.3" />
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.17">
+      </provider>
     </providers>
   </entityFramework>
   <appSettings>
@@ -40,23 +42,23 @@
   </appSettings>
   <system.web>
     <!-- Show errors -->
-    <customErrors mode="Off"/>
+    <customErrors mode="Off" />
   </system.web>
   <!-- Register the application as an HTTP module -->
   <system.webServer>
     <!-- Used by IIS -->
     <modules>
-      <remove name="Framework Benchmarks"/>
-      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application"/>
+      <remove name="Framework Benchmarks" />
+      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application" />
     </modules>
     <!-- In IIS >= 7.0 it's not possible to have both <httpModules> and <modules>, this setting disables the warning -->
-    <validation validateIntegratedModeConfiguration="false"/>
+    <validation validateIntegratedModeConfiguration="false" />
   </system.webServer>
   <system.web>
     <!-- Used by the XSP web server on mono -->
     <httpModules>
-      <remove name="Framework Benchmarks"/>
-      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application"/>
+      <remove name="Framework Benchmarks" />
+      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application" />
     </httpModules>
   </system.web>
-</configuration>
+</configuration>

+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csproj.CoreCompileInputs.cache


BIN
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csprojAssemblyReference.cache


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs


+ 15 - 12
frameworks/CSharp/aspnet-mono-ngx/src/packages.config

@@ -1,15 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="EntityFramework" version="6.1.1" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
-  <package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
+  <package id="BouncyCastle" version="1.8.3.1" targetFramework="net472" />
+  <package id="EntityFramework" version="6.2.0" targetFramework="net472" />
+  <package id="Google.Protobuf" version="3.6.1" targetFramework="net472" />
+  <package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net472" />
+  <package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net472" />
+  <package id="mongocsharpdriver" version="1.9.2" targetFramework="net472" />
   <package id="MSBuild.Microsoft.VisualStudio.Web.targets" version="11.0.2.1" />
-  <package id="mongocsharpdriver" version="1.9.2" targetFramework="net45" />
-  <package id="MySql.Data" version="6.9.5" targetFramework="net45" />
-  <package id="MySql.Data.Entity" version="6.9.5" targetFramework="net45" />
-  <package id="Npgsql" version="2.2.3" targetFramework="net45" />
-  <package id="Npgsql.EntityFramework" version="2.2.3" targetFramework="net45" />
-  <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net45" />
-  <package id="ServiceStack.Text" version="4.0.34" targetFramework="net45" />
+  <package id="MySql.Data" version="8.0.17" targetFramework="net472" />
+  <package id="MySql.Data.EntityFramework" version="8.0.17" targetFramework="net472" />
+  <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net472" />
+  <package id="Npgsql" version="2.2.3" targetFramework="net472" />
+  <package id="Npgsql.EntityFramework" version="2.2.3" targetFramework="net472" />
+  <package id="ServiceStack.Text" version="4.0.34" targetFramework="net472" />
+  <package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
 </packages>