Skip to content

Commit 7707b03

Browse files
authored
Merge pull request #108 from progaudi/fix/network-performance
Fix/network performance
2 parents 1cf8880 + 7cf8f27 commit 7707b03

31 files changed

+425
-192
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ matrix:
77
dist: trusty
88
env: BUILD_DOCKER=true
99
- os: osx # OSX 10.12
10-
osx_image: xcode8.2
10+
osx_image: xcode8.3
1111

1212
before_install:
1313
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_DOCKER" != true ]]; then sudo ./scripts/ubuntu-prereqs.sh ; fi
@@ -16,8 +16,9 @@ before_install:
1616
install:
1717
- if [[ "$BUILD_DOCKER" != true ]]; then ./scripts/dotnet-install.sh ; fi
1818
- if [[ "$BUILD_DOCKER" != true ]]; then PATH=$PATH:$HOME/.dotnet && export PATH ; fi
19-
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then docker-compose -f docker-compose.yml -f docker-compose.tests.yml up -d tarantool ; fi
19+
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then docker-compose -f docker-compose.yml up -d ; fi
2020
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tarantool tarantool/tarantool.lua ; fi
21+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then redis-server --daemonize yes ; fi
2122

2223
script:
2324
- if [[ "$BUILD_DOCKER" != true ]]; then ./scripts/build-netcore.sh ; fi

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"tasks": [
99
{
1010
"taskName": "build",
11-
"args": [ "src/progaudi.tarantool", "tests/progaudi.tarantool.tests", "samples/docker-compose/dotnet"],
11+
"args": [ "progaudi.tarantool.sln"],
1212
"isBuildCommand": true,
1313
"showOutput": "silent",
1414
"problemMatcher": "$msCompile"

docker-compose.tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
version: '2'
22

33
services:
4+
45
tarantool-client:
56
build: .
67
command: /app/scripts/test-netcore.sh
78
environment:
89
TARANTOOL_REPLICATION_SOURCE: "tarantool:3301"
910
links:
10-
- tarantool
11+
- tarantool
12+
- redis

docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ services:
1111
environment:
1212
TARANTOOL_USER_NAME: admin
1313
TARANTOOL_USER_PASSWORD: adminPassword
14-
TARANTOOL_SLAB_ALLOC_ARENA: 0.1
14+
TARANTOOL_SLAB_ALLOC_ARENA: 0.1
15+
16+
redis:
17+
image: redis:3.0-alpine
18+
command: redis-server
19+
ports:
20+
- 6379:6379

scripts/mac-prereqs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -ev
55
brew update
66
brew install openssl jq
77
brew install tarantool --HEAD
8+
brew install redis
89

910
mkdir -p /usr/local/lib
1011

scripts/test-netcore.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pushd ${BASH_SOURCE%/*}
66

77
cd ..
88

9-
dotnet test -c Release -f netcoreapp1.0 --no-build tests/progaudi.tarantool.tests/progaudi.tarantool.tests.csproj -- -parallel assemblies
10-
dotnet test -c Release -f netcoreapp1.1 --no-build tests/progaudi.tarantool.tests/progaudi.tarantool.tests.csproj -- -parallel assemblies
9+
dotnet test -c Release --no-build tests/progaudi.tarantool.tests/progaudi.tarantool.tests.csproj -- -parallel assemblies
1110

1211
popd

src/progaudi.tarantool/Box.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ public Metrics Metrics
3838
get;
3939
}
4040

41-
public bool IsConnected
42-
{
43-
get
44-
{
45-
return _logicalConnection.IsConnected();
46-
}
47-
}
41+
public bool IsConnected => _logicalConnection.IsConnected();
4842

4943
public static Task<Box> Connect(string host, int port)
5044
{

src/progaudi.tarantool/INetworkStreamPhysicalConnection.cs renamed to src/progaudi.tarantool/IPhysicalConnection.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
namespace ProGaudi.Tarantool.Client
66
{
7-
public interface INetworkStreamPhysicalConnection : IDisposable
7+
public interface IPhysicalConnection : IDisposable
88
{
99
Task Connect(ClientOptions options);
10+
1011
Task Flush();
11-
bool IsConnected();
12+
13+
bool IsConnected { get; }
14+
1215
Task<int> ReadAsync(byte[] buffer, int offset, int count);
16+
1317
void Write(byte[] buffer, int offset, int count);
1418
}
1519
}

src/progaudi.tarantool/IResponseReader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
namespace ProGaudi.Tarantool.Client
88
{
9-
109
public interface IResponseReader : IDisposable
1110
{
1211
void BeginReading();
1312

1413
Task<MemoryStream> GetResponseTask(RequestId requestId);
1514

16-
bool IsConnected();
15+
bool IsConnected { get; }
1716
}
1817
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
namespace ProGaudi.Tarantool.Client
5+
{
6+
internal interface IResponseWriter : IDisposable
7+
{
8+
void BeginWriting();
9+
10+
bool IsConnected { get; }
11+
12+
Task Write(ArraySegment<byte> header, ArraySegment<byte> body);
13+
}
14+
}

0 commit comments

Comments
 (0)