Commit 08ad6eb5 authored by Marc Gravell's avatar Marc Gravell

use higher send thresholds

parent ad0eb82c
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipelines;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Pipelines.Sockets.Unofficial;
namespace StackExchange.Redis
......@@ -76,10 +73,18 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker
if (string.IsNullOrWhiteSpace(name)) name = GetType().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_ResumeWriterThreshold = 3L * 1024 * 1024 * 1024;
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; // (large replies get crazy big)
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",
workerCount: workerCount,
priority: useHighPrioritySocketThreads ? ThreadPriority.AboveNormal : ThreadPriority.Normal);
......@@ -87,8 +92,8 @@ private SocketManager(string name, bool useHighPrioritySocketThreads, int worker
pool: defaultPipeOptions.Pool,
readerScheduler: _schedulerPool,
writerScheduler: _schedulerPool,
pauseWriterThreshold: defaultPipeOptions.PauseWriterThreshold,
resumeWriterThreshold: defaultPipeOptions.ResumeWriterThreshold,
pauseWriterThreshold: Send_PauseWriterThreshold,
resumeWriterThreshold: Send_ResumeWriterThreshold,
minimumSegmentSize: Math.Max(defaultPipeOptions.MinimumSegmentSize, MINIMUM_SEGMENT_SIZE),
useSynchronizationContext: false);
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