Skip to content

Instantly share code, notes, and snippets.

@JonCole
JonCole / ThreadPool.md
Last active Apr 9, 2021
Intro to CLR ThreadPool Growth
View ThreadPool.md

ThreadPool Growth: Some Important Details

The CLR ThreadPool has two types of threads - "Worker" and "I/O Completion Port" (aka IOCP) threads.

  • Worker threads are used when for things like processing Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods. These threads are also used by various components in the CLR when work needs to happen on a background thread.
  • IOCP threads are used when asynchronous IO happens (e.g. reading from the network).

The thread pool provides new worker threads or I/O completion threads on demand (without any throttling) until it reaches the "Minimum" setting for each type of thread. By default, the minimum number of threads is set to the number of processors on a system.

Once the number of existing (busy) threads hits the "minimum" number of threads, the ThreadPool will throttle the rate at which is injects new threads to one thread per 500 milliseconds. This means that if your system gets a burst of work needing an IOCP thread, it will proces

@JonCole
JonCole / SE.Redis-SetAbortConnectToFalse.md
Last active Mar 25, 2021
StackExchange.Redis - "disconnected multiplexer" error
View SE.Redis-SetAbortConnectToFalse.md

The Symptom

An application is using StackExchange.Redis to connect to their Redis instance and everything is working fine until suddenly exceptions like this start happening.

It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail.
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log)
at MyApp.Web.Redis.StackExchangeClientConnection..ctor(ProviderConfiguration configuration)
at MyApp.Web.Data.GetInventoryData()

The Cause

@JonCole
JonCole / DiagnoseRedisErrors-ServerSide.md
Last active Jun 27, 2019
Diagnosing Redis errors on the server side
View DiagnoseRedisErrors-ServerSide.md
@JonCole
JonCole / DiagnoseRedisErrors-ClientSide.md
Last active Jan 6, 2020
Diagnosing Redis errors caused by issues on the client side
View DiagnoseRedisErrors-ClientSide.md
@JonCole
JonCole / SupportQuestionnaire.md
Last active May 3, 2017
Support Questionnaire
View SupportQuestionnaire.md

When contacting us with questions, please provide the following information to enable us to best help you.

Required Information

  • Cache Name

  • Date&Time when issue started and ended. Note: A 1-2 hour time window is ideal. If the issue is intermittent, please provide exact times for a few of the errors so that we can correlate with our logs.

    Important: Please Specify whether times are in UTC or some other Time Zone. If you do not clarify the time zone, we don't know what time

@JonCole
JonCole / CrashDumpHelper.cs
Last active Sep 25, 2017
Crash Dump instructions and Helper code for doing it programmatically.
View CrashDumpHelper.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Diagnostics
{
public static class CrashDumpHelper
{
/// <summary>
@JonCole
JonCole / AzureRedis-PatchingExplained.md
Last active Oct 22, 2019
AzureRedis-PatchingProces
View AzureRedis-PatchingExplained.md
@JonCole
JonCole / RedisKeyspaceNotificationsExample.cs
Last active Jan 7, 2021
Redis Keyspace Notification Example
View RedisKeyspaceNotificationsExample.cs
using System;
namespace StackExchange.Redis
{
static class RedisKeyspaceNotifications
{
/// <summary>
/// NOTE: For this sample to work, you need to go to the Azure Portal and configure keyspace notifications with "Kxge$" to
/// 1) turn on expiration notifications (x),
/// 2) general command notices (g) and
@JonCole
JonCole / WhatHappenedToMyDataInRedis.md
Last active Oct 28, 2019
What happened to my data in Redis?
View WhatHappenedToMyDataInRedis.md
@JonCole
JonCole / StackExchangeRedisExtensions.cs
Last active Mar 13, 2019
StackExchange.Redis Extension Methods
View StackExchangeRedisExtensions.cs
namespace StackExchange.Redis
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
public static class StackExchangeRedisExtensions
{
public static IEnumerable<IServer> GetMasterServers(this IConnectionMultiplexer connection)