Skip to content

Instantly share code, notes, and snippets.

🤓

Alexis Lê-Quôc alq666

🤓
Block or report user

Report or block alq666

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alq666
alq666 / latency.txt
Created Jan 2, 2019 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
View keybase.md

Keybase proof

I hereby claim:

  • I am alq666 on github.
  • I am alq (https://keybase.io/alq) on keybase.
  • I have a public key ASA8hZ_wc05wAyTuPgZEtwob5PP-YjIoR2A79kI0EBA2XAo

To claim this, I am signing this object:

@alq666
alq666 / service-checklist.md
Created Sep 12, 2016 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist
View service-checklist.md

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@alq666
alq666 / tcpext.gawk
Created May 25, 2016
Parse /proc/net/netstat
View tcpext.gawk
/TcpExt:/ {
for (i=2; i <= NF; i++) {
if (match($i, /[[:digit:]]+/)) {
values[i] = $i
} else {
keys[i] = $i
}
}
}
View haproxy-stats
0. pxname [LFBS]: proxy name
1. svname [LFBS]: service name (FRONTEND for frontend, BACKEND for backend,
any name for server/listener)
2. qcur [..BS]: current queued requests. For the backend this reports the
number queued without a server assigned.
3. qmax [..BS]: max value of qcur
4. scur [LFBS]: current sessions
5. smax [LFBS]: max sessions
6. slim [LFBS]: configured session limit
7. stot [LFBS]: cumulative number of connections
@alq666
alq666 / redact.py
Created May 6, 2016
Redact certain patterns in rsyslog
View redact.py
#!/usr/bin/env python
"""A message modification plugin to remove credentials
Copyright (C) 2014 by Adiscon GmbH and Peter Slavov
Copyright (C) 2016 by Datadog
This file is part of rsyslog.
Licensed under the Apache License, Version 2.0 (the "License");
View haproxy-dtrace.patch
From 504504f2f8c13f077f09e0906cd7e7d3ca405acc Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vincent-5wNQGcxKXm8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 7 May 2014 18:18:07 +0200
Subject: [PATCH] MINOR: dtrace: add dtrace support (WIP)
Both dtrace and systemtap are supported. Currently, only one tracepoint
is defined.
---
.gitignore | 1 +
Makefile | 18 +++++++++++++++++-
@alq666
alq666 / dropped.sh
Last active Apr 16, 2016
Find drop packets
View dropped.sh
# Place a probe to record calls and return values of enqueue_to_backlog
sudo perf probe -a 'enqueue_to_backlog%return $retval'
# Record for 60 seconds
sudo perf record -e probe:enqueue_to_backlog -aR sleep 60
# Display calls
sudo perf script
@alq666
alq666 / rto.awk
Last active Mar 14, 2016
Capture RTO, retransmits and lost packets into Datadog
View rto.awk
/rto/ {
# $3 rto:xxx
# $10 unacked:x
# $11 retrans:x/y
# $12 lost:x
split($3, arr, ":");
rto = arr[2];
if (match($0, /rto:([[:digit:]]+)/, arr)) rto = arr[1];
if (match($0, /unacked:([[:digit:]]+)/, arr)) unacked = arr[1];
if (match($0, /retrans:([[:digit:]]+)?\/([[:digit:]]+)/, arr)) retrans = arr[1];
@alq666
alq666 / elb_logs.sql
Last active Jan 19, 2016
Redshift analysis of ELB logs
View elb_logs.sql
CREATE TABLE elb_logs (
RequestTime DateTime encode lzo,
ELBName varchar(30) encode lzo,
RequestIP_Port varchar(50) encode lzo,
BackendIP_Port varchar(50) encode lzo,
RequestProcessingTime FLOAT encode bytedict,
BackendProcessingTime FLOAT encode bytedict,
ClientResponseTime FLOAT encode bytedict,
ELBResponseCode INTEGER encode lzo,
BackendResponseCode INTEGER encode lzo,
You can’t perform that action at this time.