Skip to content

Instantly share code, notes, and snippets.

View danielealbano's full-sized avatar

Daniele Salvatore Albano danielealbano

View GitHub Profile
@danielealbano
danielealbano / benchmark.txt
Created September 24, 2023 15:30
golang - mpmc ringbuffer - spinlock vs mutex
go test -bench=.
goos: linux
goarch: amd64
pkg: pgproxy/internal/helpers
cpu: AMD Ryzen 9 3950X 16-Core Processor
BenchmarkRingBufferEnqueueDequeueMutex-32 5174512 212.9 ns/op 0 B/op 0 allocs/op
BenchmarkRingBufferEnqueueMutex-32 8517314 127.9 ns/op 0 B/op 0 allocs/op
BenchmarkRingBufferDequeueMutex-32 16836531 71.17 ns/op 0 B/op 0 allocs/op
BenchmarkRingBufferEnqueueDequeueSpinlock-32 3977191 303.1 ns/op 0 B/op 0 allocs/op
BenchmarkRingBufferEnqueueSpinlock-32 7919860 146.9 ns/op 0 B/op 0 allocs/op
@danielealbano
danielealbano / mbedtls-server-test.c
Created August 1, 2023 11:18
openssl vs mbedtls handshake performances
// Compile with
// gcc -O3 -o mbedtls-server-test mbedtls-server-test.c -lmbedtls -lmbedx509 -lmbedcrypto
// mbedtls from Ubuntu 22.10
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_PLATFORM_C)
@danielealbano
danielealbano / example.c
Created August 28, 2021 00:54
cachegrand fiber - example
// requires
// https://github.com/danielealbano/cachegrand/blob/41-implement-fibers-support/src/fiber.c
// https://github.com/danielealbano/cachegrand/blob/41-implement-fibers-support/src/fiber.h
// https://github.com/danielealbano/cachegrand/blob/41-implement-fibers-support/src/fiber.s
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "fiber.h"
@danielealbano
danielealbano / run-memtier-benchmark-tests.sh
Created August 7, 2021 16:09
run-memtier-benchmark-tests
memtier_benchmark \
-s cachegrand-server-01 \
-p "6379" \
-c "100" \
-t "48" \
--print-percentiles=50,90,95,99,99.5,99.9,100 \
--command="PING" \
-x 5 \
-x 5 > output-benchmark-ping.txt
@danielealbano
danielealbano / lscpu-epyc-7402.txt
Created July 24, 2021 11:48
lscpu - amd epyc 7402
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 43 bits physical, 48 bits virtual
CPU(s): 48
On-line CPU(s) list: 0-47
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 1
@danielealbano
danielealbano / setup-cachegrand-bench-server-and-client.sh
Last active August 7, 2021 16:03
cachegrand benchmark env server and client setup script
#!/bin/bash
apt update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" upgrade
apt install -y build-essential autoconf automake libpcre3-dev libevent-dev pkg-config zlib1g-dev libssl-dev iftop htop git nload
cd /usr/local/src
git clone https://github.com/RedisLabs/memtier_benchmark.git
cd memtier_benchmark/
autoreconf -ivf
./configure
make
@danielealbano
danielealbano / instructions.txt
Last active February 13, 2021 16:09
cachegrand / redis / keydb benchmark general instructions
# INITIAL SETUP (for both testers and main server)
# Install required packages
sudo apt update && \
sudo apt upgrade -y && \
sudo apt install -y git wget curl build-essential gdb cmake libevent-dev autoconf automake libpcre3-dev libevent-dev pkg-config zlib1g-dev libssl-dev
# UPGRADE UBUNTU KERNEL TO 5.10.15
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh && \
chmod +x ubuntu-mainline-kernel.sh && \
@danielealbano
danielealbano / github-runner-REPO-arm64-rpi4-deployment,yml
Created January 9, 2021 20:09
kubernetes github runner deployment for raspberrypi
# Before applying this k8s deployment is necessary to adjust the labels specified in the
# selctor to match the ones in use in your kubernetes cluster.
# It is in addition necessary to replace the __ACCESS_TOKEN__, __REPO_URL__, __REPO_NAME__
# placeholders, the gitlab runner are per repo or per organization, they can't be assigned
# directly to an user.
apiVersion: apps/v1
kind: Deployment
metadata:
name: github-runner-__REPO_NAME__-arm64-rpi4
@danielealbano
danielealbano / rpi4-ssd1306-status-display.py
Last active April 6, 2022 03:05
rpi4-ssd1306-status-display.py
# RPI4 SSD1306 Status Display - v0.2 - 2020/12/04 - 11.46 PM GMT
# Requires a 128x32 I2C SSD1306 OLED display
#
# Author Daniele Albano <https://github.com/danielealbano>
#
# It displays a number of status information for the RPI4
# - Memory usage
# - Cpu load (per CPU)
# - Temperature
# - Network traffic (no loopback)
@danielealbano
danielealbano / dev-input-reader.c
Last active February 21, 2023 11:29
dev-input-reader - a simple input events reader able to produce a jsonl output
// compile with
// gcc -Wall dev-input-reader.c -o dev-input-reader
//
// run with
// sudo dev-input-reader
//
// example output
// { "source": "/dev/input/event26", "device": { "name": " USB Keyboard", "location": "usb-0000:00:14.0-9/input0" }, "event": null }
// { "source": "/dev/input/event29", "device": { "name": "Logitech MX Master 2S", "location": "usb-0000:00:14.0-10/input2:1" }, "event": null }
// { "source": "/dev/input/event26", "device": null, "event": { "timestamp": 1605658367, "type": "EV_MSC", "type_id": 4, "code": "MSC_SCAN", "code_id": 4, "value": 458792 } }