Skip to content

Instantly share code, notes, and snippets.

View ldemailly's full-sized avatar

Laurent Demailly ldemailly

View GitHub Profile
@ldemailly
ldemailly / main.go
Created July 18, 2024 23:58
minimal version that doesn't serve http request with `GOOS=wasip1 GOARCH=wasm go run -exec wasirun main.go`
package main
import (
"log"
"net/http"
"os"
"os/signal"
"github.com/stealthrocket/net/wasip1"
)
@ldemailly
ldemailly / info.md
Last active May 23, 2024 23:36
Import partial directories into another repo

using https://github.com/newren/git-filter-repo

mkdir import_tmp; cd import_tmp
wget https://raw.githubusercontent.com/newren/git-filter-repo/main/git-filter-repo # get the code
git clone https://github.com/fortio/fortio # the source repo
cd fortio/
python3 ../git-filter-repo --path fhttp --path fgrpc --path-rename 'fhttp:legacy/fhttp' --path-rename 'fgrpc:legacy/fgrpc'
ls legacy # works!
@ldemailly
ldemailly / gist:1e46ae1d9f3091f375bf91c6679074ca
Created March 20, 2024 16:54
Kubernetes Namespace cleanup script
#!/bin/bash
#
# NOTE: force deleting a namespace should be absolute last resort,
# you want instead to find which resource is holding up the namespace
# and clean that up (vs leaking resources)
#
# First check what is holding up the ns, if it's for instance:
# custom.metrics.k8s.io/v1beta1: the server is currently
# unable to handle the request
# Then:
#0 0.065 + dpkg --print-architecture
#0 0.092 + [ xppc64el != xs390x ]
#0 0.096 + apt-key add
#0 0.097 + curl -fsSL https://download.docker.com/linux/debian/gpg
#0 1.069 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
#0 7.515 OK
#0 7.640 + dpkg --print-architecture
#0 7.663 + echo deb [arch=ppc64el] https://download.docker.com/linux/debian bullseye stable
#0 7.664 + apt-get -y update
#0 8.027 Hit:1 http://deb.debian.org/debian bookworm InRelease
@ldemailly
ldemailly / fortio.yaml
Last active September 17, 2021 16:23
fortio 3 layer with fan out of 2 both tcp and http
apiVersion: v1
kind: Namespace
metadata:
name: fortio
labels:
istio-injection: enabled
---
# Service "A" definition
apiVersion: v1
kind: Service
function newTable(t)
if not t then
t = {}
end
setmetatable(t, {__index = table})
return t
end
t = newTable({k1="v1", k2="v2", k3="v3",})
grpc_server_handled_total{grpc_code="OK",grpc_method="Check",grpc_service="istio.mixer.v1.Mixer",grpc_type="unary"} 230839
grpc_server_handled_total{grpc_code="OK",grpc_method="Report",grpc_service="istio.mixer.v1.Mixer",grpc_type="unary"} 1708
1000 ing->f2->f1 calls
grpc_server_handled_total{grpc_code="OK",grpc_method="Check",grpc_service="istio.mixer.v1.Mixer",grpc_type="unary"} 232862
grpc_server_handled_total{grpc_code="OK",grpc_method="Report",grpc_service="istio.mixer.v1.Mixer",grpc_type="unary"} 1768
60 reports
2023 checks (?)
$ PROJECT=istio-perf2 tools/setup_perf_cluster.sh
tools/setup_perf_cluster.sh is Executed, (Tools in tools) (can also be sourced interactively)...
In case of errors, retry at the failed step (readyness checks missing)
Obtaining latest ubuntu xenial image name... (takes a few seconds)...
Creating VM_NAME=fortio-vm using VM_IMAGE=https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20171212
### Running: gcloud compute instances create fortio-vm --project istio-perf2 --zone us-east4-b --machine-type n1-highcpu-2 --image https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20171212
Created [https://www.googleapis.com/compute/v1/projects/istio-perf2/zones/us-east4-b/instances/fortio-vm].
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
fortio-vm us-east4-b n1-highcpu-2 10.150.0.2 35.194.72.246 RUNNING
@ldemailly
ldemailly / 2017-12-04-184337_Fortio.json
Created December 5, 2017 02:44
sample JSON result
{
"Labels": "Fortio",
"StartTime": "2017-12-04T18:43:37.69727175-08:00",
"RequestedQPS": "1000",
"RequestedDuration": "3s",
"ActualQPS": 999.4486025402308,
"ActualDuration": 3001655105,
"NumThreads": 8,
"Version": "0.4.2",
"DurationHistogram": {
ldemailly@demo-vm-2:~$ curl "http://istio-pilot:8080/v1/listeners/x/sidecar~10.150.0.12~~"
{
"listeners": [
{
"address": "tcp://0.0.0.0:15001",
"name": "virtual",
"filters": [],
"bind_to_port": true,
"use_original_dst": true
},