Skip to content

Instantly share code, notes, and snippets.

View edalzell's full-sized avatar

Erin Dalzell edalzell

View GitHub Profile
@edalzell
edalzell / bench-comb-reindex-real.php
Created October 25, 2026 23:33
Benchmark: Comb local search index rewrite cost during a full reindex (statamic/cms)
<?php
// Benchmark: how much of a full `search:update` on the local driver is the
// per-chunk index file rewrite.
//
// Run from the root of a Statamic app with a sync queue:
// php bench-comb-reindex-real.php [index=default] [runs=3]
//
// (a) times Index::update() end to end (load searchables, transform, chunked jobs);
// (b) replays only what the chunk jobs do with the file: insertDocuments() per
@edalzell
edalzell / repro-comb-concurrent-writes.sh
Created October 25, 2026 23:26
Reproduction: Comb local search index loses documents when several queue workers reindex (statamic/cms)
#!/usr/bin/env bash
# Reproduces lost writes in the Comb (local) search index when more than one
# queue worker processes the reindex jobs. Run from the root of a Statamic app
# whose `default` index uses the local driver, with Redis available for the queue
# (the SQLite database queue fails with "database is locked" under several workers,
# which would confuse the count) and the failed_jobs table migrated.
#
# ./repro-comb-concurrent-writes.sh [iterations] [workers]
#
# Workers are started before the jobs are dispatched so they genuinely compete.
@edalzell
edalzell / bench-comb-paginate.php
Created October 25, 2026 23:05
Benchmark: Comb local search driver lookup cost when paginating (statamic/cms)
<?php
// Benchmark: Comb (local search driver) lookup cost when paginating.
//
// Run from the root of a Statamic app: php bench-comb-paginate.php [docs,docs,...] [runs]
// Builds a synthetic local index (no entries involved), then times
// paginate(10) and get() for a common word and a rare word.
// Numbers are wall-clock milliseconds, median and p95 over the runs.
require getcwd().'/vendor/autoload.php';
@edalzell
edalzell / server-migration.md
Created June 28, 2021 18:57
Migrate Servers

Preparation

The preparation of the migration should take place a few days in advance, based off the current TTL of the A record for the domain. To make sure everything runs smoothly I recommend doing this at least two days in advance.

  • Decrease the TTL of the DNS record to 300 in a few days in advance.
  • Create a new server with the server provisioner (i.e. Forge, Ploi)
    • Make sure to set up the timezone correctly on the server
  • Create a new site on the new server
  • Create a new database + corresponding database user
  • Make sure you can connect to the database from your local machine over SSH

Keybase proof

I hereby claim:

  • I am edalzell on github.
  • I am emd (https://keybase.io/emd) on keybase.
  • I have a public key whose fingerprint is 97F3 FAA9 C4C9 FEFF 02DE 5423 7D21 33B1 FA6D 3124

To claim this, I am signing this object: