-
Notifications
You must be signed in to change notification settings - Fork 2k
appMpower version 1.0 #6614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
appMpower version 1.0 #6614
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# [appMpower](https://github.com/LLT21/)(.Net) Benchmarking Test | ||
This includes tests for plaintext, json, db, queries, updates and fortune. | ||
|
||
[`appMpower`](https://github.com/LLT21/) is a nativily compiled (AOT) .NET implementation. The native compilation is done with reflection disabled; because the most used PostgreSQL .NET library is not reflection free, the PostgreSQL ODBC driver is used instead. | ||
|
||
## Infrastructure Software Versions | ||
|
||
**Language** | ||
|
||
* C# 7.0 | ||
|
||
**Platforms** | ||
|
||
* .NET Core (Windows and Linux) | ||
|
||
**Web Servers** | ||
|
||
* [Kestrel](https://github.com/aspnet/KestrelHttpServer) | ||
|
||
**Web Stack** | ||
|
||
* ASP.NET Core | ||
|
||
## Paths & Source for Tests | ||
|
||
* [Plaintext](Benchmarks/Program.cs): "/plaintext" | ||
* [JSON Serialization](Benchmarks/Program.cs): "/json" | ||
* [Single query](Benchmarks/Program.cs): "/db" | ||
* [Multiple query](Benchmarks/Program.cs): "/queries" | ||
* [Updates](Benchmarks/Program.cs): "/updates" | ||
* [Fortune](Benchmarks/Program.cs): "/fortunes" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build | ||
RUN apt-get update | ||
RUN apt-get -yqq install clang zlib1g-dev libkrb5-dev libtinfo5 | ||
|
||
WORKDIR /app | ||
COPY src . | ||
RUN dotnet publish -c Release -o out -r linux-x64 | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime | ||
LLT21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
RUN apt-get update | ||
RUN apt-get install -y unixodbc odbc-postgresql | ||
|
||
WORKDIR /etc/ | ||
COPY odbcinst.ini . | ||
|
||
WORKDIR /app | ||
COPY --from=build /app/out ./ | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["./appMpower"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"framework": "appmpower", | ||
"tests": [ | ||
{ | ||
"default": { | ||
"plaintext_url": "/plaintext", | ||
"json_url": "/json", | ||
"db_url": "/db", | ||
"query_url": "/queries?c=", | ||
"update_url": "/updates?c=", | ||
"fortune_url": "/fortunes", | ||
"port": 8080, | ||
"approach": "Realistic", | ||
"classification": "Platform", | ||
"database": "Postgres", | ||
"framework": "ASP.NET Core", | ||
"language": "C#", | ||
"orm": "Raw", | ||
"platform": ".NET", | ||
"flavor": "CoreCLR", | ||
"webserver": "Kestrel", | ||
"os": "Linux", | ||
"database_os": "Linux", | ||
"display_name": "appMpower", | ||
"notes": "", | ||
"versus": "aspcore" | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[framework] | ||
name = "appmpower" | ||
|
||
[main] | ||
urls.plaintext = "/plaintext" | ||
urls.json = "/json" | ||
urls.db = "/db" | ||
urls.query = "/queries?c=" | ||
urls.update = "/updates?c=" | ||
urls.fortune = "/fortunes" | ||
approach = "Realistic" | ||
classification = "Platform" | ||
database = "Postgres" | ||
database_os = "Linux" | ||
os = "Linux" | ||
orm = "Raw" | ||
platform = ".NET" | ||
webserver = "kestrel" | ||
versus = "aspcore" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ODBC] | ||
Trace=1 | ||
Debug=1 | ||
Pooling=No | ||
|
||
[ODBC Drivers] | ||
PostgreSQL = Installed | ||
|
||
; | ||
; odbcinst.ini | ||
; | ||
[PostgreSQL] | ||
Description=ODBC for PostgreSQL | ||
; WARNING: The old psql odbc driver psqlodbc.so is now renamed psqlodbcw.so | ||
; in version 08.x. Note that the library can also be installed under an other | ||
; path than /usr/local/lib/ following your installation. | ||
Driver=/usr/lib/x86_64-linux-gnu/odbc/psqlodbcw.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace appMpower | ||
{ | ||
public static class ConnectionStrings | ||
{ | ||
//public const string OdbcConnection = "Driver={PostgreSQL};Server=host.docker.internal;Port=5432;Database=hello_world;Uid=benchmarkdbuser;Pwd=benchmarkdbpass;UseServerSidePrepare=1;Pooling=false"; | ||
public const string OdbcConnection = "Driver={PostgreSQL};Server=tfb-database;Database=hello_world;Uid=benchmarkdbuser;Pwd=benchmarkdbpass;UseServerSidePrepare=1;Pooling=false"; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
using System.Data; | ||
using System.Data.Common; | ||
using System.Data.Odbc; | ||
using System.Threading.Tasks; | ||
|
||
namespace appMpower.Db | ||
{ | ||
public class PooledCommand : IDbCommand | ||
{ | ||
private OdbcCommand _odbcCommand; | ||
private PooledConnection _pooledConnection; | ||
|
||
public PooledCommand(PooledConnection pooledConnection) | ||
{ | ||
_odbcCommand = (OdbcCommand)pooledConnection.CreateCommand(); | ||
_pooledConnection = pooledConnection; | ||
} | ||
|
||
public PooledCommand(string commandText, PooledConnection pooledConnection) | ||
{ | ||
pooledConnection.GetCommand(commandText, this); | ||
} | ||
|
||
internal PooledCommand(OdbcCommand odbcCommand, PooledConnection pooledConnection) | ||
{ | ||
_odbcCommand = odbcCommand; | ||
_pooledConnection = pooledConnection; | ||
} | ||
|
||
internal OdbcCommand OdbcCommand | ||
{ | ||
get | ||
{ | ||
return _odbcCommand; | ||
} | ||
set | ||
{ | ||
_odbcCommand = value; | ||
} | ||
} | ||
|
||
internal PooledConnection PooledConnection | ||
{ | ||
get | ||
{ | ||
return _pooledConnection; | ||
} | ||
set | ||
{ | ||
_pooledConnection = value; | ||
} | ||
} | ||
|
||
public string CommandText | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.CommandText; | ||
} | ||
set | ||
{ | ||
_odbcCommand.CommandText = value; | ||
} | ||
} | ||
|
||
public int CommandTimeout | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.CommandTimeout; | ||
} | ||
set | ||
{ | ||
_odbcCommand.CommandTimeout = value; | ||
} | ||
} | ||
public CommandType CommandType | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.CommandType; | ||
} | ||
set | ||
{ | ||
_odbcCommand.CommandType = value; | ||
} | ||
} | ||
|
||
#nullable enable | ||
public IDbConnection? Connection | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.Connection; | ||
} | ||
set | ||
{ | ||
_odbcCommand.Connection = (OdbcConnection?)value; | ||
} | ||
} | ||
#nullable disable | ||
|
||
|
||
public IDataParameterCollection Parameters | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.Parameters; | ||
} | ||
} | ||
|
||
#nullable enable | ||
public IDbTransaction? Transaction | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.Transaction; | ||
} | ||
set | ||
{ | ||
_odbcCommand.Transaction = (OdbcTransaction?)value; | ||
} | ||
} | ||
#nullable disable | ||
|
||
public UpdateRowSource UpdatedRowSource | ||
{ | ||
get | ||
{ | ||
return _odbcCommand.UpdatedRowSource; | ||
} | ||
set | ||
{ | ||
_odbcCommand.UpdatedRowSource = value; | ||
} | ||
} | ||
public void Cancel() | ||
{ | ||
_odbcCommand.Cancel(); | ||
} | ||
|
||
public IDbDataParameter CreateParameter() | ||
{ | ||
return _odbcCommand.CreateParameter(); | ||
} | ||
|
||
public IDbDataParameter CreateParameter(string name, DbType dbType, object value) | ||
{ | ||
OdbcParameter odbcParameter = null; | ||
|
||
if (this.Parameters.Contains(name)) | ||
{ | ||
odbcParameter = (OdbcParameter)this.Parameters[name]; | ||
odbcParameter.Value = value; | ||
} | ||
else | ||
{ | ||
odbcParameter = _odbcCommand.CreateParameter(); | ||
|
||
odbcParameter.ParameterName = name; | ||
odbcParameter.DbType = dbType; | ||
odbcParameter.Value = value; | ||
this.Parameters.Add(odbcParameter); | ||
} | ||
|
||
return odbcParameter; | ||
} | ||
|
||
public int ExecuteNonQuery() | ||
{ | ||
return _odbcCommand.ExecuteNonQuery(); | ||
} | ||
|
||
public IDataReader ExecuteReader() | ||
{ | ||
return _odbcCommand.ExecuteReader(); | ||
} | ||
|
||
public async Task<int> ExecuteNonQueryAsync() | ||
{ | ||
return await _odbcCommand.ExecuteNonQueryAsync(); | ||
} | ||
|
||
public async Task<DbDataReader> ExecuteReaderAsync(CommandBehavior behavior) | ||
{ | ||
return await _odbcCommand.ExecuteReaderAsync(behavior); | ||
} | ||
|
||
public IDataReader ExecuteReader(CommandBehavior behavior) | ||
{ | ||
return _odbcCommand.ExecuteReader(behavior); | ||
} | ||
|
||
#nullable enable | ||
public object? ExecuteScalar() | ||
{ | ||
return _odbcCommand.ExecuteScalar(); | ||
} | ||
#nullable disable | ||
|
||
public void Prepare() | ||
{ | ||
_odbcCommand.Prepare(); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_pooledConnection.ReleaseCommand(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.