Skip to content

Instantly share code, notes, and snippets.

@andypost
andypost / snunit-vs-libunit.md
Last active October 21, 2026 21:06
snunit vs libunit: pin 872bf041, master 09c0aeb8, #801 42e2accd

snunit vs libunit: pin 872bf041, master 09c0aeb8, #801 42e2accd

1. Pin

The pin is 872bf041 (.github/freeunit-ref:1, also SNUnitBuild.scala:19).

  • It is tag 1.37.0 plus 19 commits. Master is 213 commits ahead.
  • There is no 1.37.1 tag. version says 1.37.0 at both the pin and master.
  • So snunit is on 1.37.0+ and lacks all 21 libunit commits made since the pin.

2. Struct audit

The mirrored C definitions are identical at the pin, on master and at #801. The diffs add only comments, asserts, port_send_flags and test prototypes. So every mismatch below already exists today.

@andypost
andypost / linux-kernel-logging-fs.md
Created October 16, 2026 05:37
FreeUnit structured logging research (freeunit-exp#69/#70)

Linux kernel practices for log safety, performance, and filesystems

Working note for the structured access log design. Context: FreeUnit's router writes one NDJSON record per request to a file fd opened by the main process (src/nxt_router_access_log.c, nxt_fd_write at the call site). This note summarises what the Linux kernel and common filesystems actually guarantee so the writer contract is not built on wishful thinking.

1. Safety

@andypost
andypost / drupal_boot_cron.php
Created September 12, 2026 12:40
Run Drupal cron and queue jobs in a warm Unit PHP worker ("fork-spawn")
<?php
/**
* drupal_boot_cron.php — real Drupal bootstrap + cron, with timing.
*
* Two ways to run it:
* CLI (cold): php drupal_boot_cron.php -> cold opcache path, JSON on stderr
* In-process: included by fork_spawn.php (warm) -> warm opcache, JSON into the job log
*
* Environment:
* DRUPAL_ROOT Drupal site root (required)
@andypost
andypost / php85-allocator-bench.md
Last active May 27, 2026 14:37
profiling PHP 8.5 with memory allocators on Alpinelinux

Memory allocators on Alpine Linux — PHP & multi-threaded servers

Measured 2026-05-07 to 2026-05-08 on Alpine edge, x86_64, 8 cores, 14 GB RAM. PHP 8.5.6, opcache always on. Drupal 11.x-dev (7 455 vendor .php, 8 499 classes) as the realistic single-threaded workload. A small C harness (8 pthreads × 2 000 000 small mallocs) for the multi-threaded contention scenario.

11 allocators tested:

| Allocator | Version | Source |

@andypost
andypost / gist:3c8bbd4f165c0d774670652cb5e96c69
Created March 7, 2026 11:53
Drupal evolver + Claude code
Results: Drupal core/modules — 10.6.4 → 11.3.4
┌───────────────┬────────┬───────────────┐
│ Metric │ 10.6.4 │ 11.3.4 │
├───────────────┼────────┼───────────────┤
│ Files │ 2,884 │ 3,134 (+250) │
├───────────────┼────────┼───────────────┤
│ Symbols │ 12,542 │ 13,251 (+709) │
├───────────────┼────────┼───────────────┤
│ Total changes │ │ 7,986 │
services:
php:
# image: skilldlabs/php:83-unit-dev
image: skilldlabs/php:84-unit-dev
# command: unitd --no-daemon --user web-user --group web-group --log /dev/stdout
container_name: core
restart: always
working_dir: /var/www/html
volumes:
@andypost
andypost / docker-compose.yaml
Created October 6, 2023 23:52
Drupal 10 core dev
version: "3.4"
services:
php:
# image: drupalci/php-8.2-apache:production
image: skilldlabs/php:82-unit-dev
# image: skilldlabs/php:83-unit-dev
container_name: core
restart: always
@andypost
andypost / gist:bfeb0f21637a0a2463c00151eb429e69
Created September 6, 2023 21:34
Build of unit 1.31.0 using clang16
$ docker run --rm -it -u 0:0 --cap-add=SYS_PTRACE --privileged --platform=linux/aarch64 --network host --pull=always -v /data/nd/aports:/mnt -e APORTSDIR=/mnt -w /mnt --entrypoint='' alpinelinux/alpine-gitlab-ci:latest-aarch64 /bin/ash
latest-aarch64: Pulling from alpinelinux/alpine-gitlab-ci
...
Digest: sha256:b2020e43f7d89e9477823e427ba4b11e48db41b9a2987acf667e1b56d4f767b1
Status: Downloaded newer image for alpinelinux/alpine-gitlab-ci:latest-aarch64
/mnt # cd community/unit
/mnt/community/unit # apk upgrade
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/APKINDEX.tar.gz
(1/2) Upgrading pkgconf (2.0.2-r0 -> 2.0.3-r0)
(2/2) Upgrading nghttp2-libs (1.55.1-r0 -> 1.56.0-r0)
@andypost
andypost / mydate.info.yml
Created December 11, 2021 20:13
Views date fielter plugin alter
name: My date
description: "Overrides core date views filter"
type: module
package: "Views"
core_version_requirement: '>=8.8.0'
@andypost
andypost / Makefile
Created September 1, 2021 13:18
Alpinelinux docker CI images for each arch
.PHONY: run
all: x86_64
IMAGE_ALP=alpinelinux/alpine-gitlab-ci:latest-
builder = docker run --rm -it --network host \
--cap-add=SYS_PTRACE --privileged \
--platform=linux/$(or ${2}, ${1}) \
-v $(shell pwd):/mnt -e APORTSDIR=/mnt -w /mnt \