Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
3fef93d2
Commit
3fef93d2
authored
Sep 27, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempting to investigate perf pain
parent
10328be0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
62 deletions
+94
-62
StackExchange.Redis.sln
StackExchange.Redis.sln
+7
-0
BasicTest.csproj
tests/BasicTest/BasicTest.csproj
+1
-1
Program.cs
tests/BasicTest/Program.cs
+14
-10
BasicTestBaseline.csproj
tests/BasicTestBaseline/BasicTestBaseline.csproj
+1
-1
Program.cs
toys/TestConsole/Program.cs
+44
-47
TestConsole.csproj
toys/TestConsole/TestConsole.csproj
+7
-3
TestConsoleBaseline.csproj
toys/TestConsoleBaseline/TestConsoleBaseline.csproj
+20
-0
No files found.
StackExchange.Redis.sln
View file @
3fef93d2
...
...
@@ -112,6 +112,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{153A10E4-E
docs\Transactions.md = docs\Transactions.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestConsoleBaseline", "toys\TestConsoleBaseline\TestConsoleBaseline.csproj", "{D58114AE-4998-4647-AFCA-9353D20495AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -154,6 +156,10 @@ Global
{3DA1EEED-E9FE-43D9-B293-E000CFCCD91A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DA1EEED-E9FE-43D9-B293-E000CFCCD91A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DA1EEED-E9FE-43D9-B293-E000CFCCD91A}.Release|Any CPU.Build.0 = Release|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58114AE-4998-4647-AFCA-9353D20495AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
@@ -173,6 +179,7 @@ Global
{D082703F-1652-4C35-840D-7D377F6B9979} = {96E891CD-2ED7-4293-A7AB-4C6F5D8D2B05}
{8375813E-FBAF-4DA3-A2C7-E4645B39B931} = {E25031D3-5C64-430D-B86F-697B66816FD8}
{3DA1EEED-E9FE-43D9-B293-E000CFCCD91A} = {E25031D3-5C64-430D-B86F-697B66816FD8}
{D58114AE-4998-4647-AFCA-9353D20495AE} = {E25031D3-5C64-430D-B86F-697B66816FD8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {193AA352-6748-47C1-A5FC-C9AA6B5F000B}
...
...
tests/BasicTest/BasicTest.csproj
View file @
3fef93d2
...
...
@@ -2,7 +2,7 @@
<PropertyGroup>
<Description>StackExchange.Redis.BasicTest .NET Core</Description>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;net47</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;net47
2
</TargetFrameworks>
<AssemblyName>BasicTest</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>BasicTest</PackageId>
...
...
tests/BasicTest/Program.cs
View file @
3fef93d2
...
...
@@ -21,7 +21,8 @@ internal class CustomConfig : ManualConfig
{
protected
virtual
Job
Configure
(
Job
j
)
=>
j
.
With
(
new
GcMode
{
Force
=
true
})
.
With
(
InProcessToolchain
.
Instance
);
.
With
(
InProcessToolchain
.
Instance
)
;
public
CustomConfig
()
{
...
...
@@ -54,8 +55,11 @@ public class RedisBenchmarks : IDisposable
/// <summary>
/// Create
/// </summary>
public
RedisBenchmarks
()
[
GlobalSetup
]
public
void
Setup
()
{
// Pipelines.Sockets.Unofficial.SocketConnection.AssertDependencies();
var
options
=
ConfigurationOptions
.
Parse
(
"127.0.0.1:6379"
);
connection
=
ConnectionMultiplexer
.
Connect
(
options
);
db
=
connection
.
GetDatabase
(
3
);
...
...
@@ -80,9 +84,9 @@ void IDisposable.Dispose()
/// Run INCRBY lots of times
/// </summary>
#if TEST_BASELINE
[
Benchmark
(
Description
=
"INCRBY:v1/s"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "INCRBY:v1/s", OperationsPerInvoke = COUNT)]
#else
[
Benchmark
(
Description
=
"INCRBY:v2/s"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "INCRBY:v2/s", OperationsPerInvoke = COUNT)]
#endif
public
int
ExecuteIncrBy
()
{
...
...
@@ -105,9 +109,9 @@ public int ExecuteIncrBy()
/// Run INCRBY lots of times
/// </summary>
#if TEST_BASELINE
[
Benchmark
(
Description
=
"INCRBY:v1/a"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "INCRBY:v1/a", OperationsPerInvoke = COUNT)]
#else
[
Benchmark
(
Description
=
"INCRBY:v2/a"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "INCRBY:v2/a", OperationsPerInvoke = COUNT)]
#endif
public
async
Task
<
int
>
ExecuteIncrByAsync
()
{
...
...
@@ -130,9 +134,9 @@ public async Task<int> ExecuteIncrByAsync()
/// Run GEORADIUS lots of times
/// </summary>
#if TEST_BASELINE
[
Benchmark
(
Description
=
"GEORADIUS:v1/s"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "GEORADIUS:v1/s", OperationsPerInvoke = COUNT)]
#else
[
Benchmark
(
Description
=
"GEORADIUS:v2/s"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "GEORADIUS:v2/s", OperationsPerInvoke = COUNT)]
#endif
public
int
ExecuteGeoRadius
()
{
...
...
@@ -150,9 +154,9 @@ public int ExecuteGeoRadius()
/// Run GEORADIUS lots of times
/// </summary>
#if TEST_BASELINE
[
Benchmark
(
Description
=
"GEORADIUS:v1/a"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "GEORADIUS:v1/a", OperationsPerInvoke = COUNT)]
#else
[
Benchmark
(
Description
=
"GEORADIUS:v2/a"
,
OperationsPerInvoke
=
COUNT
)]
//
[Benchmark(Description = "GEORADIUS:v2/a", OperationsPerInvoke = COUNT)]
#endif
public
async
Task
<
int
>
ExecuteGeoRadiusAsync
()
{
...
...
tests/BasicTestBaseline/BasicTestBaseline.csproj
View file @
3fef93d2
...
...
@@ -2,7 +2,7 @@
<PropertyGroup>
<Description>StackExchange.Redis.BasicTest .NET Core</Description>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;net47</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;net47
2
</TargetFrameworks>
<AssemblyName>BasicTestBaseline</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>BasicTestBaseline</PackageId>
...
...
toys/TestConsole/Program.cs
View file @
3fef93d2
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Threading.Tasks
;
using
StackExchange.Redis
;
namespace
TestConsole
static
class
Program
{
internal
static
class
Program
private
static
int
taskCount
=
10
;
private
static
int
totalRecords
=
100000
;
static
void
Main
()
{
private
static
async
Task
Main
()
#if SEV2
Pipelines
.
Sockets
.
Unofficial
.
SocketConnection
.
AssertDependencies
();
Console
.
WriteLine
(
"We loaded the things..."
);
// Console.ReadLine();
#endif
Stopwatch
stopwatch
=
new
Stopwatch
();
stopwatch
.
Start
();
var
taskList
=
new
List
<
Task
>();
var
connection
=
ConnectionMultiplexer
.
Connect
(
"127.0.0.1"
,
Console
.
Out
);
for
(
int
i
=
0
;
i
<
taskCount
;
i
++)
{
using
(
var
conn
=
Create
())
{
var
sub
=
conn
.
GetSubscriber
();
Console
.
WriteLine
(
"Subscsribe..."
);
sub
.
Subscribe
(
"foo"
,
(
channel
,
value
)
=>
Console
.
WriteLine
(
$"
{
channel
}
:
{
value
}
"
));
Console
.
WriteLine
(
"Ping..."
);
sub
.
Ping
();
Console
.
WriteLine
(
"Run publish..."
);
await
RunPub
().
ConfigureAwait
(
false
);
}
await
Console
.
Out
.
WriteLineAsync
(
"Waiting a minute..."
).
ConfigureAwait
(
false
);
await
Task
.
Delay
(
60
*
1000
).
ConfigureAwait
(
false
);
var
i1
=
i
;
var
task
=
new
Task
(()
=>
Run
(
i1
,
connection
));
task
.
Start
();
taskList
.
Add
(
task
);
}
private
static
ConnectionMultiplexer
Create
()
Task
.
WaitAll
(
taskList
.
ToArray
());
stopwatch
.
Stop
();
Console
.
WriteLine
(
$"Done.
{
stopwatch
.
ElapsedMilliseconds
}
"
);
Console
.
ReadLine
();
}
static
void
Run
(
int
taskId
,
ConnectionMultiplexer
connection
)
{
Console
.
WriteLine
(
$"
{
taskId
}
Started"
);
var
database
=
connection
.
GetDatabase
(
0
);
for
(
int
i
=
0
;
i
<
totalRecords
;
i
++)
{
var
options
=
new
ConfigurationOptions
{
KeepAlive
=
5
,
EndPoints
=
{
"localhost:6379"
},
SyncTimeout
=
int
.
MaxValue
,
// CommandMap = CommandMap.Create(new HashSet<string> { "subscribe", "psubscsribe", "publish" }, false),
};
Console
.
WriteLine
(
"Connecting..."
);
var
muxer
=
ConnectionMultiplexer
.
Connect
(
options
,
Console
.
Out
);
Console
.
WriteLine
(
"Connected"
);
muxer
.
ConnectionFailed
+=
(
_
,
a
)
=>
Console
.
WriteLine
(
$"Failed:
{
a
.
ConnectionType
}
,
{
a
.
EndPoint
}
,
{
a
.
FailureType
}
,
{
a
.
Exception
}
"
);
muxer
.
ConnectionRestored
+=
(
_
,
a
)
=>
Console
.
WriteLine
(
$"Restored:
{
a
.
ConnectionType
}
,
{
a
.
EndPoint
}
,
{
a
.
FailureType
}
,
{
a
.
Exception
}
"
);
Console
.
WriteLine
(
"Ping..."
);
var
time
=
muxer
.
GetDatabase
().
Ping
();
Console
.
WriteLine
(
$"Pinged:
{
time
.
TotalMilliseconds
}
ms"
);
return
muxer
;
database
.
StringSet
(
i
.
ToString
(),
i
.
ToString
());
}
public
static
async
Task
RunPub
()
Console
.
WriteLine
(
$"
{
taskId
}
Insert completed"
);
for
(
int
i
=
0
;
i
<
totalRecords
;
i
++)
{
using
(
var
conn
=
Create
())
{
var
pub
=
conn
.
GetSubscriber
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
await
pub
.
PublishAsync
(
"foo"
,
i
).
ConfigureAwait
(
false
);
}
await
Console
.
Out
.
WriteLineAsync
(
"Waiting a minute..."
).
ConfigureAwait
(
false
);
await
Task
.
Delay
(
60
*
1000
).
ConfigureAwait
(
false
);
}
var
result
=
database
.
StringGet
(
i
.
ToString
());
}
Console
.
WriteLine
(
$"
{
taskId
}
Completed"
);
}
}
toys/TestConsole/TestConsole.csproj
View file @
3fef93d2
...
...
@@ -2,18 +2,22 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net462;net47;net472</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net46
1;net46
2;net47;net472</TargetFrameworks>
<LangVersion>latest</LangVersion>
<DefineConstants>SEV2</DefineConstants>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition="'$(Computername)'=='OCHO' or '$(Computername)'=='SKINK'">
<LocalReference>true</LocalReference>
</PropertyGroup>
<ItemGroup>
<!--<ProjectReference Include="..\..\tests\BasicTest\BasicTest.csproj" />
<ProjectReference Include="..\StackExchange.Redis.Server\StackExchange.Redis.Server.csproj" />
<ProjectReference Include="..\..\tests\StackExchange.Redis.Tests\StackExchange.Redis.Tests.csproj" />-->
<ProjectReference Include="..\..\src\StackExchange.Redis\StackExchange.Redis.csproj" />
<!--<ProjectReference Include="..\..\src\StackExchange.Redis\StackExchange.Redis.csproj" />-->
<PackageReference Include="Pipelines.Sockets.Unofficial" Version="1.0.6" />
<PackageReference Include="StackExchange.Redis" Version="2.0.510" />
</ItemGroup>
</Project>
toys/TestConsoleBaseline/TestConsoleBaseline.csproj
0 → 100644
View file @
3fef93d2
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net461;net462;net47;net472</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Computername)'=='OCHO' or '$(Computername)'=='SKINK'">
<LocalReference>true</LocalReference>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\TestConsole\Program.cs" Link="Program.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="[1.2.7-alpha-00002]" />
</ItemGroup>
</Project>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment