Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View brantburnett's full-sized avatar
🦄
Making software magic

Brant Burnett brantburnett

🦄
Making software magic
View GitHub Profile
@brantburnett
brantburnett / CouchbaseNetCore.md
Created July 22, 2016 00:32
Discussion regarding different approaches to implementing .Net Core support in the Couchbase .Net Client

Couchbase .Net Core Support

Overview

This document describes various approaches that might be used to add .Net Core support to the Couchbase .Net SDK. It is based upon some preexisting work that has already been completed, detailed in https://issues.couchbase.com/browse/NCBC-915.

Understanding .Net Standard

It is important to understand the basic precepts behind .Net Standard in order to understand this document.

@brantburnett
brantburnett / CouchbaseNetStandardSync.md
Created October 4, 2016 03:11
Proposal for handling synchronous methods in the .Net Standard version of the Couchbase .Net SDK

Couchbase .Net Standard 1.5 Sync Methods

Overview

In .Net Core, .Net Standard, and other related technologies Microsoft has moved away from synchronous method implementations for any method that may involve latency. Instead, they favor only offering async methods. This is especially true for any methods that involve I/O, such as network connections, streams, file access, etc. This forces the consuming developer to recognize the inherently asynchronous nature of the operation and develop their application based on this knowledge. It becomes a syntax-level and compiler recognized way to ensure that developers recognize the delays involved in the operation they are performing.

@brantburnett
brantburnett / userdata.sh
Last active October 8, 2020 16:12
Couchbase EC2 NVMe Userdata Script
#!/bin/bash
# Include as user data during instance startup, or run as root using sudo
# Assumes that you are using an i3 instance type with NVMe instance storage attached
# Set swappiness to zero
sysctl vm.swappiness=0
echo "vm.swappiness = 0" >> /etc/sysctl.conf
# Disable transparent huge pages
cat > /etc/init.d/disable-thp <<- 'EOM'
@brantburnett
brantburnett / docker-compose.override.yml
Created September 30, 2019 20:41
Docker Compose Couchbase Example
version: '3.4'
# This file applies override values that are add to the values in the first file when run in Visual Studio
# The idea is that you might use docker-compose up on the command line for the first file for other testing outside VS
services:
your-service:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "80"
@brantburnett
brantburnett / snappier_metrics.md
Last active October 21, 2020 12:53
Snappier Metrics vs. Snappy.NET

Compression

Method FileName Mean Error StdDev Median Ratio RatioSD Rank
Snappier alice29.txt 4.116 us 0.0170 us 0.0249 us 4.113 us 1.20 0.01 2
PInvoke alice29.txt 3.444 us 0.0186 us 0.0279 us 3.436 us 1.00 0.00 1
Snappier asyoulik.txt 3.002 us 0.0294 us 0.0430 us 2.980 us 1.00 0.01 1
PInvoke asyoulik.txt 2.998 us 0.0132 us 0.0198 us 2.990 us 1.00 0.00 1
@brantburnett
brantburnett / plan.md
Last active January 12, 2021 23:50
Couchbase SDK 3.x CancellationToken Handling

Proposed Approach

This proposal is to clarify how we handle various cancellation scenarios which may cancel an in-flight operation.

Idempotent Operations (i.e. GET, LookupIn, etc)

Note: Should also include operations related to bootstrap like hello, auth, select bucket, etc.

| Phase | External Cancellation | Timeout Cancellation |

@brantburnett
brantburnett / Benchmark.cs
Created September 28, 2021 02:55
Dictionary Comparison for InFlightOperationSet assuming no lock contention
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
namespace Couchbase.LoadTests
{
public class StatesInFlight
{
private readonly Dictionary<uint, object> _dictionary = new Dictionary<uint, object>();
@brantburnett
brantburnett / EventProperties.cs
Last active May 10, 2022 12:07
RabbitMQ message bus OpenTelemetry tracing example
using System;
using System.Collections;
using System.Collections.Generic;
namespace CenterEdge.Common.Events
{
/// <summary>
/// Collection of properties associated with the event, such as tracing headers.
/// </summary>
public class EventProperties : IDictionary<string, string?>
@brantburnett
brantburnett / Log4NetLogger.cs
Created June 21, 2022 20:56
Log4Net to Microsoft Logging Adapter
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using log4net.Core;
using log4net.Repository;
using Microsoft.Extensions.Logging;
using ILogger = log4net.Core.ILogger;