Commit 23bc9d45 authored by Marc Gravell's avatar Marc Gravell

use higher send thresholds

parent efb98b8c
using System; using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using Pipelines.Sockets.Unofficial; using Pipelines.Sockets.Unofficial;
namespace StackExchange.Redis namespace StackExchange.Redis
...@@ -76,10 +73,18 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker ...@@ -76,10 +73,18 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker
if (string.IsNullOrWhiteSpace(name)) name = GetType().Name; if (string.IsNullOrWhiteSpace(name)) name = GetType().Name;
Name = name; Name = name;
const long Receive_PauseWriterThreshold = 4L * 1024 * 1024 * 1024; // let's give it up to 4GiB of buffer for now const long Receive_PauseWriterThreshold = 4L * 1024 * 1024 * 1024; // receive: let's give it up to 4GiB of buffer for now
const long Receive_ResumeWriterThreshold = 3L * 1024 * 1024 * 1024; const long Receive_ResumeWriterThreshold = 3L * 1024 * 1024 * 1024; // (large replies get crazy big)
var defaultPipeOptions = PipeOptions.Default; var defaultPipeOptions = PipeOptions.Default;
long Send_PauseWriterThreshold = Math.Max(
512 * 1024,// send: let's give it up to 0.5MiB
defaultPipeOptions.PauseWriterThreshold); // or the default, whichever is bigger
long Send_ResumeWriterThreshold = Math.Max(
Send_PauseWriterThreshold / 2,
defaultPipeOptions.ResumeWriterThreshold);
_schedulerPool = new DedicatedThreadPoolPipeScheduler(name + ":IO", _schedulerPool = new DedicatedThreadPoolPipeScheduler(name + ":IO",
workerCount: workerCount, workerCount: workerCount,
priority: useHighPrioritySocketThreads ? ThreadPriority.AboveNormal : ThreadPriority.Normal); priority: useHighPrioritySocketThreads ? ThreadPriority.AboveNormal : ThreadPriority.Normal);
...@@ -87,8 +92,8 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker ...@@ -87,8 +92,8 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker
pool: defaultPipeOptions.Pool, pool: defaultPipeOptions.Pool,
readerScheduler: _schedulerPool, readerScheduler: _schedulerPool,
writerScheduler: _schedulerPool, writerScheduler: _schedulerPool,
pauseWriterThreshold: defaultPipeOptions.PauseWriterThreshold, pauseWriterThreshold: Send_PauseWriterThreshold,
resumeWriterThreshold: defaultPipeOptions.ResumeWriterThreshold, resumeWriterThreshold: Send_ResumeWriterThreshold,
minimumSegmentSize: Math.Max(defaultPipeOptions.MinimumSegmentSize, MINIMUM_SEGMENT_SIZE), minimumSegmentSize: Math.Max(defaultPipeOptions.MinimumSegmentSize, MINIMUM_SEGMENT_SIZE),
useSynchronizationContext: false); useSynchronizationContext: false);
ReceivePipeOptions = new PipeOptions( ReceivePipeOptions = new PipeOptions(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment