Skip to content

Instantly share code, notes, and snippets.

View bobrik's full-sized avatar

Ivan Babrou bobrik

View GitHub Profile
bobrik /
Last active November 12, 2023 04:07
Amcrest cleanup script

Amcrest cleanup script

Handy if you want to keep the most recent Amcrest recordings around.

Example output:

$ ./ -s $((400 * 1024)) /Volumes/cameras
Checked /Volumes/cameras/amcrest02/2023-11-11/001/dav
Checked /Volumes/cameras/amcrest02/2023-11-07/001/dav
bobrik /
Created October 19, 2023 22:18
unix_gc overload

unix_gc overload

The issue

Linux kernel has a garbage collection mechanism for inflight unix sockets passed to other unix sockets. This mechanism can be used to cause excessive load onto well behaved processes that are using regular unix sockets without any fd passing, because garbage collection is called in the socket write path.

The repro

bobrik /
Last active July 18, 2023 22:27
Calls into skb:kfree_skb
bobrik /
Last active August 11, 2023 21:52
Expensive `memory.stat` + `cpu.stat`

Expensive memory.stat + cpu.stat

We're seeing issues where cadvisor spends a lot of time on CPU.


The following should run on any system with systemd (code is in this gist):

go run main.go
"cards": {
"cardPadding": null,
"cardRound": null
"color": {
"cardColor": "#bf1b00",
"colorScale": "sqrt",
"colorScheme": "interpolateRdYlGn",
"exponent": 0.25,
"annotations": {
"list": [
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"status": "success",
"data": {
"resultType": "matrix",
"result": [
"metric": {
"__name__": "node_cpu",
"colo_id": "28",
"colo_name": "sea01",
bobrik /
Last active March 1, 2018 21:51
KPTI Redis benchmark on bare metal

Redis KPTI benchmark

Other benchmarks make me sad. People run them in the cloud where VMs can migrate between different hosts on reboots and use old kernels. Here we use bare metal with the same recent kernel to remove extra variables and measure KPTI impact and KPTI impact only.


  • Kernel: 4.14.11
bobrik /
Last active May 7, 2024 12:19
CFS hiccups
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.