Mikael Lirbank's Avatar

Mikael Lirbank

@lirbank.com

I help companies build reliable software, focusing on AI and web technologies https://www.lirbank.com/ Author of https://www.npmjs.com/package/neon-testing

41
Followers
32
Following
46
Posts
29.10.2024
Joined
Posts Following

Latest posts by Mikael Lirbank @lirbank.com

Preview
Liberate yourself from infrastructure over-planning Challenge conventional wisdom before making hard decisions. Some one-way doors open both ways.

7/ Full benchmark โ€” setup, raw data, summary stats:

www.lirbank.com/liberate-you...

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

6/ The cross-provider penalty is effectively zero when both providers have data centers in the same metro.

Provider boundaries and geographic proximity are not the same constraint.

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

5/ The thing that doesn't matter: provider boundaries.

Near Cloudflare Workers (internet) vs Vercel on AWS (internal network), same region:

node-postgres: 31ms vs 32ms
Postgres.js: 38ms vs 36ms

In some configurations, crossing the internet was faster.

07.03.2026 01:11 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

4/ The thing that actually matters: geographic distance.

Same Cloudflare infrastructure, same database, different regions:

Far (San Jose โ†’ Virginia): 742ms
Near (Ashburn โ†’ Virginia): 31ms

That's 23x. Distance is real.

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

3/ I was working on a Cloudflare Workers deployment with Postgres on AWS. No managed Postgres on Cloudflare โ€” cross-provider was the only option.

So I benchmarked it: 4 Postgres drivers ร— 3 connection strategies ร— 3 deployment targets, 25 iterations each.

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

2/ Conventional wisdom: your database and application need to be on the same cloud provider. Cross-provider means crossing the internet, and crossing the internet means slow.

It's the kind of thing that drives platform choices.

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

1/ Some constraints are real. Some are assumptions that sound plausible and never get tested. It's worth knowing which is which before they shape your decisions.

I had one recently. ๐Ÿงต

07.03.2026 01:11 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
Harnessing Postgres race conditions Synchronization barriers let you test for race conditions with confidence.

6. I wrote the full walkthrough with runnable code examples and a pattern for injecting barriers into our tests without touching production code. If you've ever worried about sneaky race conditions in your code, give it a read.

www.lirbank.com/harnessing-p...

14.02.2026 22:02 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

5b Lock present - test passes. Lock removed - test fails. That's proof.

14.02.2026 22:01 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

5a. Synchronization barriers let us test for this. A barrier is a coordination point - each task runs until it hits the barrier, then waits. When the last task arrives, all are released at once. We get the exact race condition interleaving we need for our tests, manufactured on demand.

14.02.2026 22:01 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

4. What we actually need is a write lock. The second transaction blocks until the first one commits, then reads the updated value. Race condition gone. But now we have a new problem - how do we prove the lock is actually doing its job?

14.02.2026 21:59 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

3. Wrapping it in a transaction doesn't help. Postgres's default isolation level is read committed, which guarantees each statement sees only committed data - that's a read guarantee, not a write guarantee. Both transactions can still read the stale value before either writes.

14.02.2026 21:59 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

2. Here's what that looks like. Two $50 credits hit an account with $100 at the same time. Both operations read the balance as 100. Both write 150. Final balance: $150 instead of $200. One credit vanished. No error. No rollback. Nothing in the logs.

14.02.2026 21:58 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Good test coverage gives us confidence and prevents regressions. But testing for race conditions is hard. Even when tests run concurrently, the timing almost never lines up to trigger the bug. The test passes whether our code handles concurrency correctly or not.

14.02.2026 21:57 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
Release v2.4.0 ยท starmode-base/neon-testing What's Changed Role and database selection by @francesco-carrella in #10 New Contributors @francesco-carrella made their first contribution in #10 Full Changelog: v2.3.1...v2.4.0

Neon Testing v2.4.0 is out! ๐ŸŽ‰

A Vitest utility for integration tests with Neon Postgres, now with:

- Multi-role support for testing row-level security (RLS)
- Multi-database project support

github.com/starmode-bas...

Big thanks to francesco-carrella for the contribution!

18.01.2026 19:32 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 1
Post image

I knew I've been pretty productive this year, but yeah, this is more than I expected... while the stats are kind of exciting, it may be time for a day off...

305 Cursor days this year so far

23.12.2025 02:18 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

I'm using the tab completion in Cursor so much they are sending me a Cursor tab key! ๐Ÿ˜…

16.12.2025 19:44 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

...when test runs crash, stale branches can linger. The new 10-minute TTL safety net ensures automatic cleanup. Profit!

๐Ÿ“ฆ www.npmjs.com/package/neon...
๐Ÿ”– github.com/starmode-bas...

29.11.2025 03:44 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

๐ŸŽ‰ Black Friday special: 100% off Neon Testing - grab your copy today!

Just released v2.3.0 with support for Neon's expiring branches.

Neon Testing tears down branches immediately after tests complete. But...

29.11.2025 03:44 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
Neon Testing: a Vitest Library for Your Integration Tests - Neon Try Neon Testing, an open-source utility for Vitest that turns Neon branches into disposable test environments.

๐Ÿš€ My guest post for the Neon blog just went live!

Want to make Postgres integration testing dead simple? Read on:
neon.com/blog/neon-te...

Big thanks to @andrelandgraf.com, Carlota Soto and Neon for the support!

09.09.2025 18:40 ๐Ÿ‘ 2 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 1
Preview
neon-testing A Vitest utility for seamless integration tests with Neon Postgres. Latest version: 2.1.0, last published: 13 minutes ago. Start using neon-testing in your project by running `npm i neon-testing`. The...

New neon-testing release!

www.npmjs.com/package/neon...

29.08.2025 01:15 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
neon-testing A Vitest utility for seamless integration tests with Neon Postgres. Latest version: 1.1.0, last published: 9 minutes ago. Start using neon-testing in your project by running `npm i neon-testing`. Ther...

Just release neon-testing v1.1.0 with better support for WebSocket drivers, retries with exponential backoff, and more.

A @vitest.dev utility for seamless integration tests with Neon Postgres

www.npmjs.com/package/neon...

github.com/starmode-bas...

25.08.2025 05:55 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
neon-testing A Vitest utility for automated integration tests with Neon. Latest version: 1.0.1, last published: 6 minutes ago. Start using neon-testing in your project by running `npm i neon-testing`. There are no...

I just launched a new NPM package - a @vitest.dev utility for automated integration tests with Neon! It's really sweet. Check it out.

www.npmjs.com/package/neon...

09.06.2025 22:48 ๐Ÿ‘ 3 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

@vercel.com my dashboard looks like this, but www.vercel-status.com say all is dandy

07.02.2025 21:27 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image
06.02.2025 21:32 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

Just started working magically! ๐Ÿค˜

22.01.2025 19:24 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

Hey @leerob.com is Bun 1.2 support something that needs to be done on the Vercel side?

22.01.2025 18:32 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Let's gooo!

17.01.2025 16:13 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

This is pretty exciting!

vercel.fyi/nextjs-spa

bsky.app/profile/lirb...

09.01.2025 05:37 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Let's goooo!

08.01.2025 01:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0