aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-04 17:21:17 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2016-05-09 15:42:32 -0700
commit26cc1427e93e5f65a5a1a07edd275fdf713e7309 (patch)
treea00992027066de180150b7cbfa468d0fd11fe54e /src/csharp/Grpc.Core
parent65ca9dcabc464a1ea9ea74b8891c77c27008dacd (diff)
start server with more than one allowed RPCs
Diffstat (limited to 'src/csharp/Grpc.Core')
-rw-r--r--src/csharp/Grpc.Core/Server.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs
index 9b0895d855..fea76d557a 100644
--- a/src/csharp/Grpc.Core/Server.cs
+++ b/src/csharp/Grpc.Core/Server.cs
@@ -48,6 +48,7 @@ namespace Grpc.Core
/// </summary>
public class Server
{
+ const int InitialAllowRpcTokenCount = 10;
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<Server>();
readonly AtomicCounter activeCallCounter = new AtomicCounter();
@@ -129,7 +130,13 @@ namespace Grpc.Core
startRequested = true;
handle.Start();
- AllowOneRpc();
+
+ // Starting with more than one AllowOneRpc tokens can significantly increase
+ // unary RPC throughput.
+ for (int i = 0; i < InitialAllowRpcTokenCount; i++)
+ {
+ AllowOneRpc();
+ }
}
}