Skip to content

Commit

Permalink
Merge branch 'refactor_setup' into travis
Browse files Browse the repository at this point in the history
Conflicts:
	go/setup.py
	toolset/benchmark/benchmarker.py
	toolset/benchmark/framework_test.py
	toolset/benchmark/test_runner.py
	toolset/benchmark/utils.py
  • Loading branch information
hamiltont committed Jul 19, 2014
2 parents 16f4962 + 0421109 commit 7b078b9
Show file tree
Hide file tree
Showing 113 changed files with 17,487 additions and 2,415 deletions.
107 changes: 97 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ sudo useradd -m -G sudo tfb
$ sudo apt-get update && sudo apt-get upgrade
```
* Run the command: `sudo visudo`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=NOPASSWD: ALL`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=(ALL) NOPASSWD: ALL`
* Run the following **(Don't enter a password, just hit enter when the prompt pops up)**. **NOTE** This is still necessary if the client and database are on the same computer as the server
```bash
$ ssh-keygen
Expand All @@ -48,7 +48,7 @@ $ cd FrameworkBenchmarks
```
* Install the server software. This will take a long time
```bash
$ nohup python toolset/run-tests.py -s <server hostname/ip> -c <client hostname/ip> -u tfb --install-software --install server --list-tests &
$ nohup python toolset/run-tests.py -s <server hostname/ip> -c <client hostname/ip> -u tfb --install server --list-tests &
```
* If you want to view the process of installing, do the following. The session can be interrupted easily so no need to worry about keeping a connection.
```bash
Expand Down Expand Up @@ -76,10 +76,6 @@ sudo apt-get remove --purge openjdk-6-jre openjdk-6-jre-headless
# Change database-private-ip to the database ip
mongo --host database-private-ip < config/create.js
```
* Before running the tests, do the following
```bash
$ source ~/.bashrc
```

---

Expand All @@ -92,10 +88,10 @@ $ source ~/.bashrc
$ sudo apt-get update && sudo apt-get upgrade
```
* Run the command: `sudo visudo`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=NOPASSWD: ALL`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=(ALL) NOPASSWD: ALL`
* On the app server, run the following from the FrameworkBenchmark directory (this should only take a small amount of time, several minutes or so):
```bash
$ toolset/run-tests.py --install-software --install database --list-tests
$ toolset/run-tests.py --install database --list-tests
```

---
Expand All @@ -109,10 +105,10 @@ $ toolset/run-tests.py --install-software --install database --list-tests
$ sudo apt-get update && sudo apt-get upgrade
```
* Run the command: `sudo visudo`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=NOPASSWD: ALL`
* Change line 20 in from `%sudo ALL=(ALL:ALL) ALL` to `%sudo ALL=(ALL) NOPASSWD: ALL`
* On the app server, run the following from the FrameworkBenchmark directory (this should only take a small amount of time, several minutes or so):
```bash
$ toolset/run-tests.py --install-software --install client --list-tests
$ toolset/run-tests.py --install client --list-tests
```

You can validate that the setup worked by running a smoke test like this:
Expand Down Expand Up @@ -190,6 +186,8 @@ When adding a new framework or new test to an existing framework, please follow

* Update/add [benchmark_config](#the-benchmark_config-file)
* Update/add [setup file](#setup-files)
* Update/add [install.sh file](#install-file)
* (Optional) Update/add [bash_profile.sh file](#bash-environment-file)
* When creating a database test, please use the MySQL table hello_world.World, or the MongoDB collection hello_world.world

### The Tests
Expand Down Expand Up @@ -284,6 +282,95 @@ The steps involved are:
* Add the necessary tweaks to your [setup file](#setup-files) to start and stop on the new operating system. See, for example, [the script for Go](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/go/setup.py).
* Test on Windows and Linux to make sure everything works as expected.

## Install File

The `install.sh` file for each framework starts the bash process which will
install that framework. Typically, the first thing done is to call `fw_depends`
to run installations for any necessary software that TFB has already
created installation scripts for. TFB provides a reasonably wide range of
core software, so your `install.sh` may only need to call `fw_depends` and
exit. Note: `fw_depends` does not guarantee dependency installation, so
list software in the proper order e.g. if `foo` depends on `bar`
use `fw_depends bar foo`.

Here are some example `install.sh` files

```bash
#!/bin/bash

# My server only needs nodejs
fw_depends nodejs
```

```bash
#!/bin/bash

# My server is weird and needs nodejs and mono and go
fw_depends nodejs mono go
```

```bash
#!/bin/bash

# My server needs nodejs...
fw_depends nodejs mono go

# ...and some other software that there is no installer script for.
# Note: Use IROOT variable to put software in the right folder.
# You can also use FWROOT to refer to the project root, or
# TROOT to refer to the root of your framework
# Please see guidelines on writing installation scripts
wget mystuff.tar.gz -O mystuff.tar.gz
untar mystuff.tar.gz
cd mystuff
make --prefix=$IROOT && sudo make install
```

To see what TFB provides installations for, look in `toolset/setup/linux`
in the folders `frameworks`, `languages`, `systools`, and `webservers`.
You should pass the filename, without the ".sh" extension, to fw_depends.
Here is a listing as of July 2014:

```bash
$ ls frameworks
grails.sh nawak.sh play1.sh siena.sh vertx.sh yesod.sh
jester.sh onion.sh play2.sh treefrog.sh wt.sh
$ ls languages
composer.sh erlang.sh hhvm.sh mono.sh perl.sh pypy.sh racket.sh urweb.sh
dart.sh go.sh java.sh nimrod.sh phalcon.sh python2.sh ringojs.sh xsp.sh
elixir.sh haskell.sh jruby.sh nodejs.sh php.sh python3.sh ruby.sh yaf.sh
$ ls systools
leiningen.sh maven.sh
$ ls webservers
lapis.sh mongrel2.sh nginx.sh openresty.sh resin.sh weber.sh zeromq.sh
```

## Bash Environment File

The `bash_profile.sh` file is sourced before installing software or before
running the framework test. This is mostly used when running your
framework, to perform actions such as updating `PATH` or defining environment
variables your framework requires e.g. `GOROOT`. You can use these
variables:

* FWROOT: Root of project
* IROOT: Root of installation for the current framework
* TROOT: Root directory for the current framework

Example of `bash_profile.sh`:

```bash
# Set the root of our go installation
export GOROOT=${IROOT}/go

# Where to find the go executable
export PATH="$GOROOT/bin:$PATH"

export GOPATH=${FWROOT}/go
```

Do not cause any output, such as using `echo`, inside of `bash_profile.sh`

## Setup Files

The setup file is responsible for starting and stopping the test. This script is responsible for (among other things):
Expand Down
16 changes: 8 additions & 8 deletions aspnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
**Platforms**

* .NET Framework 4.5 (Windows)
* Mono 3.2.1 (Linux)
* Mono 3.2.8 (Linux)

**Web Servers**

Expand All @@ -29,26 +29,26 @@
**Web Stack**

* ASP.NET 4.5
* ASP.NET MVC Framework 4
* ASP.NET MVC Framework 5.1.0

**Databases**

* MySQL Connector/Net 6.7.2-beta ([custom build](https://github.com/pdonald/mysql-connector-net))
* Npgsql 2.0.13-beta1
* Entity Framework 6.0.0-beta1
* Mongo C# Driver 1.8.2
* MySQL Connector/Net 6.8.3
* Npgsql 2.0.14.3
* Entity Framework 6.0.2
* Mongo C# Driver 1.8.3

**Developer Tools**

* Visual Studio 2012

## Mono Installation

sudo apt-get install git-core build-essential autoconf automake libtool zlib1g-dev pkg-config
sudo apt-get install git-core build-essential autoconf automake libtool zlib1g-dev pkg-config gettext

git clone git://github.com/mono/mono
cd mono
git checkout mono-3.2.1
git checkout mono-3.2.8
./autogen.sh --prefix=/usr/local
make get-monolite-latest
make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe
Expand Down
19 changes: 10 additions & 9 deletions aspnet/lib/packages.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.0.0-beta1" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
<package id="EntityFramework" version="6.0.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.1.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MSBuild.Microsoft.VisualStudio.Web.targets" version="11.0.2.1" />
<package id="mongocsharpdriver" version="1.8.2" targetFramework="net45" />
<package id="MySql.Data.Entity" version="6.7.2-beta-ef6" targetFramework="net45" />
<package id="Npgsql" version="2.0.13-beta1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.56" targetFramework="net45" />
<package id="mongocsharpdriver" version="1.8.3" targetFramework="net45" />
<package id="MySql.Data" version="6.8.3" targetFramework="net45" />
<package id="MySql.Data.Entities" version="6.8.3" targetFramework="net45" />
<package id="Npgsql" version="2.0.14.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
<package id="ServiceStack.Text" version="4.0.8" targetFramework="net45" />
</packages>
32 changes: 16 additions & 16 deletions aspnet/src/Benchmarks.AspNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,69 +45,69 @@
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Mvc">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.Mvc.5.1.0\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.Razor.3.1.0\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<Private>True</Private>
<HintPath>..\lib\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
<HintPath>..\lib\Microsoft.AspNet.WebPages.3.1.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure">
<Private>True</Private>
<HintPath>..\lib\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\lib\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\lib\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text">
<HintPath>..\lib\ServiceStack.Text.3.9.56\lib\net35\ServiceStack.Text.dll</HintPath>
<HintPath>..\lib\ServiceStack.Text.4.0.8\lib\net40\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="EntityFramework">
<Private>True</Private>
<HintPath>..\lib\EntityFramework.6.0.0-beta1\lib\net45\EntityFramework.dll</HintPath>
<HintPath>..\lib\EntityFramework.6.0.2\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework">
<Private>True</Private>
<HintPath>..\lib\EntityFramework.6.0.0-beta1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<HintPath>..\lib\EntityFramework.6.0.2\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="MySql">
<Private>True</Private>
<HintPath>..\lib\MySql.Data.Entity.6.7.2-beta-ef6\lib\net45\MySql.Data.dll</HintPath>
<HintPath>..\lib\MySql.Data.6.8.3\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql">
<Private>True</Private>
<HintPath>..\lib\MySql.Data.Entity.6.7.2-beta-ef6\lib\net45\MySql.Data.Entity.dll</HintPath>
<HintPath>..\lib\MySql.Data.Entities.6.8.3\lib\net45\mysql.data.entity.EF6.dll</HintPath>
</Reference>
<Reference Include="Npgsql">
<Private>True</Private>
<HintPath>..\lib\Npgsql.2.0.13-beta1\lib\net45\Npgsql.dll</HintPath>
<HintPath>..\lib\Npgsql.2.0.14.3\lib\net45\Npgsql.dll</HintPath>
</Reference>
<Reference Include="Npgsql">
<Private>True</Private>
<HintPath>..\lib\Npgsql.2.0.13-beta1\lib\net45\Mono.Security.dll</HintPath>
<HintPath>..\lib\Npgsql.2.0.14.3\lib\net45\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="MongoDB">
<Private>True</Private>
<HintPath>..\lib\mongocsharpdriver.1.8.2\lib\net35\MongoDB.Bson.dll</HintPath>
<HintPath>..\lib\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB">
<Private>True</Private>
<HintPath>..\lib\mongocsharpdriver.1.8.2\lib\net35\MongoDB.Driver.dll</HintPath>
<HintPath>..\lib\mongocsharpdriver.1.8.3\lib\net35\MongoDB.Driver.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
27 changes: 5 additions & 22 deletions aspnet/src/Models/EntityFramework.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Configuration;
using System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive;
using System.Data.Entity.ModelConfiguration.Configuration.Types;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Reflection;

namespace Benchmarks.AspNet.Models
{
Expand All @@ -28,27 +23,15 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder)
modelBuilder.Ignore<MongoWorld>();

if (Database.Connection is Npgsql.NpgsqlConnection)
modelBuilder.Conventions.Add<PostgreSqlConfigurationConvention>();
modelBuilder.Conventions.Add(new PostgreSqlConfigurationConvention());
}

private class PostgreSqlConfigurationConvention
: IConfigurationConvention<Type, EntityTypeConfiguration>,
IConfigurationConvention<PropertyInfo, PrimitivePropertyConfiguration>,
IConfigurationConvention<Type, ModelConfiguration>
private class PostgreSqlConfigurationConvention : Convention
{
public void Apply(Type memberInfo, Func<EntityTypeConfiguration> configuration)
public PostgreSqlConfigurationConvention()
{
configuration().ToTable(memberInfo.Name.ToLowerInvariant(), null);
}

public void Apply(PropertyInfo memberInfo, Func<PrimitivePropertyConfiguration> configuration)
{
configuration().ColumnName = memberInfo.Name.ToLowerInvariant();
}

public void Apply(Type memberInfo, Func<ModelConfiguration> configuration)
{
configuration().DefaultSchema = "public";
Properties().Configure(p => p.HasColumnName(p.ClrPropertyInfo.Name.ToLowerInvariant()));
Types().Configure(c => c.ToTable(c.ClrType.Name.ToLowerInvariant(), "public"));
}
}
}
Expand Down
Loading

0 comments on commit 7b078b9

Please sign in to comment.