Skip to content
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

Feature/1.0.0 #131

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github
.vs
.vscode
Scripts
tests
**/bin
**/obj
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
FROM progaudi/dotnet:1.0.1-xenial
FROM microsoft/dotnet:2.1-sdk as sdk

WORKDIR /app
ENV PATH $PATH:/root/.dotnet

# copy csproj and restore as distinct layers
COPY . .
RUN /app/scripts/build-netcore.sh
RUN dotnet build -c Release progaudi.tarantool.sln
RUN dotnet msbuild /t:publish /p:NoBuild=True /p:Configuration=Release samples/insert-performance/insert-performance.csproj

FROM microsoft/dotnet:2.1-runtime as runtime

WORKDIR /app

COPY --from=sdk /app/samples/insert-performance/bin/Release/netcoreapp2.1/publish .

CMD ["dotnet", "insert-performance.dll"]
16 changes: 16 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM microsoft/dotnet:2.1-sdk-alpine as sdk

WORKDIR /app

# copy csproj and restore as distinct layers
COPY . .
RUN dotnet build -c Release progaudi.tarantool.sln
RUN dotnet msbuild /t:publish /p:NoBuild=True /p:Configuration=Release samples/insert-performance/insert-performance.csproj

FROM microsoft/dotnet:2.1-runtime-alpine as runtime

WORKDIR /app

COPY --from=sdk /app/samples/insert-performance/bin/Release/netcoreapp2.1/publish .

CMD ["dotnet", "insert-performance.dll"]
16 changes: 16 additions & 0 deletions Scripts/run-insert-benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -evx

pushd ${BASH_SOURCE%/*}/..

docker-compose down && docker-compose up -d

./Scripts/build-netcore.sh

pushd samples/insert-performance/bin/Release/netcoreapp2.0/

dotnet insert-performance.dll

popd
popd
68 changes: 44 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,60 @@
version: '3.2'

services:
tarantool_1_7:
image: progaudi/tarantool:1.7.5-184-g5be3a82be # same version as tarantool in homebrew on mac os
command: tarantool /usr/local/share/tarantool/tarantool.docker.lua
volumes:
- $PWD/tarantool:/usr/local/share/tarantool
ports:
- "3301:3301"
environment:
TARANTOOL_USER_NAME: admin
TARANTOOL_USER_PASSWORD: adminPassword
TARANTOOL_SLAB_ALLOC_ARENA: 0.1
# tarantool_1_7:
# image: progaudi/tarantool:1.7.5-184-g5be3a82be # same version as tarantool in homebrew on mac os
# command: tarantool /usr/local/share/tarantool/tarantool.docker.lua
# volumes:
# - $PWD/tarantool:/usr/local/share/tarantool
# ports:
# - "3301:3301"
# environment:
# TARANTOOL_USER_NAME: admin
# TARANTOOL_USER_PASSWORD: adminPassword
# TARANTOOL_SLAB_ALLOC_ARENA: 2

tarantool_1_8:
image: progaudi/tarantool:1.8.2-288-g99128d7d3
image: progaudi/tarantool:1.9.0-47-gfabbcfa68
command: tarantool /usr/local/share/tarantool/tarantool.docker.lua
volumes:
- $PWD/tarantool:/usr/local/share/tarantool
ports:
- "3302:3301"
- "3301:3301"
environment:
TARANTOOL_USER_NAME: admin
TARANTOOL_USER_PASSWORD: adminPassword
TARANTOOL_SLAB_ALLOC_ARENA: 0.1
TARANTOOL_SLAB_ALLOC_ARENA: 2

redis:
image: redis:3.0-alpine
command: redis-server
ports:
- 6379:6379
# redis:
# image: redis:3.0-alpine
# command: redis-server
# ports:
# - 6379:6379

admin:
image: quay.io/basis-company/tarantool-admin
ports:
- 8888:80
# admin:
# image: quay.io/basis-company/tarantool-admin
# ports:
# - 8888:80
# depends_on:
# - tarantool_1_7
# - tarantool_1_8

go:
build:
context: samples/go-insert
depends_on:
- tarantool_1_8

net-alpine:
build:
context: .
dockerfile: Dockerfile.alpine
depends_on:
- tarantool_1_8

net:
build:
context: .
dockerfile: Dockerfile
depends_on:
- tarantool_1_7
- tarantool_1_8
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.0.0"
"version": "2.1.300"
}
}
}
54 changes: 27 additions & 27 deletions progaudi.tarantool.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "progaudi.tarantool", "src\progaudi.tarantool\progaudi.tarantool.csproj", "{DD007E9F-FB2D-4351-AAB7-F2D367B295C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "progaudi.tarantool.tests", "tests\progaudi.tarantool.tests\progaudi.tarantool.tests.csproj", "{4C681801-9A6B-4CE9-8EAA-23F80917F046}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14BAEDF1-BEFC-4FB2-AAC9-08D397191216}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "progaudi.tarantool.benchmark", "src\progaudi.tarantool.benchmark\progaudi.tarantool.benchmark.csproj", "{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "insert-performance", "samples\insert-performance\insert-performance.csproj", "{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tests", "src\tests\tests.csproj", "{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -36,30 +36,30 @@ Global
{DD007E9F-FB2D-4351-AAB7-F2D367B295C4}.Release|x64.Build.0 = Release|Any CPU
{DD007E9F-FB2D-4351-AAB7-F2D367B295C4}.Release|x86.ActiveCfg = Release|Any CPU
{DD007E9F-FB2D-4351-AAB7-F2D367B295C4}.Release|x86.Build.0 = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|x64.ActiveCfg = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|x64.Build.0 = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|x86.ActiveCfg = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Debug|x86.Build.0 = Debug|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|Any CPU.Build.0 = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|x64.ActiveCfg = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|x64.Build.0 = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|x86.ActiveCfg = Release|Any CPU
{4C681801-9A6B-4CE9-8EAA-23F80917F046}.Release|x86.Build.0 = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|x64.ActiveCfg = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|x64.Build.0 = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|x86.ActiveCfg = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Debug|x86.Build.0 = Debug|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|Any CPU.Build.0 = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|x64.ActiveCfg = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|x64.Build.0 = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|x86.ActiveCfg = Release|Any CPU
{CD96AC2D-505F-4FDF-82FB-76F51CC28FF4}.Release|x86.Build.0 = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|x64.ActiveCfg = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|x64.Build.0 = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|x86.ActiveCfg = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Debug|x86.Build.0 = Debug|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|Any CPU.Build.0 = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|x64.ActiveCfg = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|x64.Build.0 = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|x86.ActiveCfg = Release|Any CPU
{9A42ABC2-AA01-4A89-9DBF-ACBBC7E0F461}.Release|x86.Build.0 = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|x64.ActiveCfg = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|x64.Build.0 = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|x86.ActiveCfg = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Debug|x86.Build.0 = Debug|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|Any CPU.Build.0 = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|x64.ActiveCfg = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|x64.Build.0 = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|x86.ActiveCfg = Release|Any CPU
{1B3E430D-A1DE-4650-8E4A-1D8B62ECE584}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 9 additions & 0 deletions samples/go-insert/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang

WORKDIR /go/src/app
COPY . .

RUN go get -d -v ./...
RUN go install -v ./...

CMD ["app"]
33 changes: 33 additions & 0 deletions samples/go-insert/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"fmt"
"log"
"time"

"github.com/tarantool/go-tarantool"
)

func main() {
opts := tarantool.Opts{}
conn, err := tarantool.Connect("tarantool_1_8:3301", opts)

// conn, err := tarantool.Connect("/path/to/tarantool.socket", opts)
if err != nil {
fmt.Println("Connection refused: %s", err.Error())
}
start := time.Now()
f := make([]*tarantool.Future, 0)
for i := 0; i < 1000000; i++ {
fut := conn.InsertAsync("pivot", []interface{}{i, []int{i, i}, i})
f = append(f, fut)
}
for _, element := range f {
_, err := element.Get()
if err != nil {
fmt.Println("Insert failed: %s", err.Error())
}
}
elapsed := time.Since(start)
log.Printf("Insert took %s", elapsed)
}
60 changes: 60 additions & 0 deletions samples/insert-performance/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ProGaudi.Tarantool.Client;
using ProGaudi.Tarantool.Client.Model;

namespace Tarantool.Test
{
class Program
{
static void Main()
{
var log = new TextWriterLog(Console.Out);
var options = new ClientOptions(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "localhost:3301" : "tarantool_1_8:3301");
//var options = new ClientOptions(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "localhost:3301" : "tarantool_1_8:3301", log);
var sw = new Stopwatch();
try
{
using (var box = new Box(options))
{
box.Connect().GetAwaiter().GetResult();
box.Schema.TryGetSpace<(int, (int, int), int)>("pivot", out var space);
var lst = new Task[1000];
sw.Start();
for (var i = 0; i < 1_000_000; i++)
{
lst[i % 1000] = space.Insert((i, (i, i), i));

if (i % 1000 == 999)
{
Task.WaitAll(lst);
//return;
}

if (i % 10000 == 9999)
{
Console.Write("*");
if (i % 100000 == 99999)
{
Console.WriteLine();
}
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
sw.Stop();

Console.WriteLine();
Console.WriteLine(sw.ElapsedMilliseconds);
}
}
}
}
19 changes: 19 additions & 0 deletions samples/insert-performance/insert-performance.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>7.2</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>7.2</LangVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\progaudi.tarantool\progaudi.tarantool.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/progaudi.tarantool.benchmark/IncrementBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public IncrementBenchmark()
public async Task<long> Redis() => await _redis.StringIncrementAsync("test_for_benchmarking");

[Benchmark]
public async Task<DataResponse<int[]>> Tarantool() => await _box.Call<int>("test_for_benchmarking");
public async Task<DataResponse<int[]>> Tarantool() => await _box.Call<int, int>("test_for_benchmarking", 0);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<!-- default to allowing all language features -->
<WarningLevel>4</WarningLevel>
<WarningsAsErrors>true</WarningsAsErrors>

<AssemblyName>progaudi.tarantool</AssemblyName>
<RootNamespace>ProGaudi.Tarantool.Client</RootNamespace>
<Product>progaudi.tarantool</Product>
<Copyright>Copyright © 2016-2018</Copyright>

<AssemblyName>progaudi.tarantool.benchmark</AssemblyName>
<RootNamespace>ProGaudi.Tarantool.Benchmark</RootNamespace>
</PropertyGroup>
Expand Down
Loading