summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Geyer <jensg@apache.org>2022-09-09 13:39:33 +0200
committerJens Geyer <Jens-G@users.noreply.github.com>2022-09-09 23:00:09 +0200
commit60970c4e10b0014005bc68f07f4e5c5987b41e3a (patch)
treeea4c4745e1f7509c58a2c435ff5d9cfe5ec4c0cc /test
parent72d5912424211561adc6f8e7bc502180631d9f8e (diff)
downloadthrift-60970c4e10b0014005bc68f07f4e5c5987b41e3a.tar.gz
THRIFT-5624 suboptimal performance of the c# named pipe server transport in multithread servers
Client: netstd Patch: Jens Geyer
Diffstat (limited to 'test')
-rw-r--r--test/netstd/Server/TestServer.cs17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/netstd/Server/TestServer.cs b/test/netstd/Server/TestServer.cs
index 27577eecb..1eb50306a 100644
--- a/test/netstd/Server/TestServer.cs
+++ b/test/netstd/Server/TestServer.cs
@@ -204,7 +204,6 @@ namespace ThriftTest
{
//public TServer Server { get; set; }
private readonly int handlerID;
- private readonly StringBuilder sb = new();
private readonly TestLogDelegate logger;
public TestHandlerAsync()
@@ -216,11 +215,12 @@ namespace ThriftTest
public void TestConsoleLogger(string msg, params object[] values)
{
- sb.Clear();
+ var sb = new StringBuilder();
sb.AppendFormat("handler{0:D3}:", handlerID);
sb.AppendFormat(msg, values);
sb.AppendLine();
- Console.Write(sb.ToString());
+ lock (typeof(Console))
+ Console.Write(sb.ToString());
}
public Task testVoid(CancellationToken cancellationToken)
@@ -298,7 +298,7 @@ namespace ThriftTest
public Task<Dictionary<int, int>> testMap(Dictionary<int, int>? thing, CancellationToken cancellationToken)
{
- sb.Clear();
+ var sb = new StringBuilder();
sb.Append("testMap({{");
if (thing != null)
{
@@ -323,7 +323,7 @@ namespace ThriftTest
public Task<Dictionary<string, string>> testStringMap(Dictionary<string, string>? thing, CancellationToken cancellationToken)
{
- sb.Clear();
+ var sb = new StringBuilder();
sb.Append("testStringMap({{");
if (thing != null)
{
@@ -348,7 +348,7 @@ namespace ThriftTest
public Task<HashSet<int>> testSet(HashSet<int>? thing, CancellationToken cancellationToken)
{
- sb.Clear();
+ var sb = new StringBuilder();
sb.Append("testSet({{");
if (thing != null)
{
@@ -373,7 +373,7 @@ namespace ThriftTest
public Task<List<int>> testList(List<int>? thing, CancellationToken cancellationToken)
{
- sb.Clear();
+ var sb = new StringBuilder();
sb.Append("testList({{");
if (thing != null)
{
@@ -590,7 +590,8 @@ namespace ThriftTest
{
case TransportChoice.NamedPipe:
Debug.Assert(param.pipe != null);
- trans = new TNamedPipeServerTransport(param.pipe, Configuration, NamedPipeClientFlags.OnlyLocalClients);
+ var numListen = (param.server == ServerChoice.Simple) ? 1 : 16;
+ trans = new TNamedPipeServerTransport(param.pipe, Configuration, NamedPipeServerFlags.OnlyLocalClients, numListen);
break;