Better HN
topnewbestaskshowjobs
Log inSign up

andersmurphy

1,011 karma · joined Feb 22, 2019 (7y ago) · 496 submissions

https://andersmurphy.com
Submissions

comment 7mo ago · link · parent

For what it's worth blob types and application functions make it pretty straight forward to implement your own datatypes. I often have one for EDN and one for bigdecimal.

comment 7mo ago · link · parent

The bigger change is those that do write by hand have stopped open sourcing their work. The age of sharing innovation for free is quickly coming to an end.

I also expect a bunch of open source/open core projects to go closed source in the next few months.

comment 7mo ago · link · parent

Recommend this series if you want to dabble in assembly/forth:

https://tumbleforth.hardcoded.net/

comment 7mo ago · link · parent

Python from scratch now means writing python without LLMs? It's like wild swimming all over again.

The shark is being jumped.

comment 7mo ago · link · parent

I've been diving into aarch64 assembly recently building a small Forth. It's honestly really refreshing.

If you're prepared to forgo some portability and pick an architecture assembly opens up a lot if options. Things like coroutines, automatic SIMD become easier to implement. It's also got amazing zero cost C FFI (and I'm only half joking). Linux kernel booting into a minimal STC Forth is a lot of fun.

Not to mention you can run your code on android without SDK or NDK over ADB (in the case of aarch64).

comment 7mo ago · link · parent

Coffi [1] built on java 22 (project panama) C FFI. Makes binding to C from Clojure a lot of fun.

- [1] https://github.com/IGJoshua/coffi

comment 7mo ago · link · parent

We don't know what anthropic's true costs are. So pricing that in is at best a guess.

comment 7mo ago · link · parent

Yup. Also regardless of price they need to spend more and more as the project collapses under the inevitable incidental complexity of 30k lines of code a day.

It's similar to how if you know what you're doing you can manage a simple VPS and scale a lot more cost effectively than something like vercel.

In a saturated market margins are everything. You can't necessarily afford to be giving all your margins to anthropic and vercel.

comment 7mo ago · link · parent

> What happens is that weak models hallucinate (sometimes causally hitting a real problem)

So the bigger models hallucinate better causally hitting more real problems?

comment 7mo ago · link · parent

That's a good point. I'll give that a go and do a write up at some point.

The choice to use SQLite for me isn't actually about speed (LMDB is way faster).

I just get tired of people saying switch to Postgres for speed/scale. Postgres is great for many things but speed/scale is not its strength.

The main reason I use SQLite is the affordances and conveniences of an embedded database. Being able to easily have many databases. When databases are "cheap" it opens up loads of options. Of the embedded/file OLTP databases SQLite also has the largest toolbox: litestream, R*Tree indexes, JSONB, FTS, etc.

comment 7mo ago · link · parent

Clearly they didn't use enough hammer. Screws always require the most hammer. Common knowledge to any certified practitioner of Hammer™[1].

- [1] Get 20% off your Hammer Master™ certificate with referral code THUMBPAIN

comment 7mo ago · link · parent

This is a great point! Reminds me of Agentic software development. When it doesn't work out it's only evidence that you could have used more agents.

You can never use enough tokens.

comment 7mo ago · link · parent

Depends how you do your backups. If you do them by replicating. They are both. See litestream [1].

With SQLite this is even more obvious as a database is just a file (or three in the case of WAL). Which means you can replicate to not just another machine (or any file system) but much more resilient object storage like S3 (most cloud provider offer S3 compatible object storage).

- [1] https://litestream.io/how-it-works/

I think you might need to rethink your idée fixe.

comment 7mo ago · link · parent

> How about lisp?

I was wondering why lisp (and forth) were omitted from the initial list of languages named in the post.

I guess Scheme is in the list has ok macros.

comment 7mo ago · link · parent

Right and that window is bigger for RDS by the looks of it.

comment 7mo ago · link · parent

Sqlite supports nested transactions with SAVEPOINT so each client can have their own logical transaction that can be rolled back. The outer transaction just batches the fsync effectively. So an individual client failing a transaction doesn't cause the batch to fail. But, a crash would cause the batch to fail. Because, it's a single writer, there's no rollback/retries from contention/MVCC.

You could try to imitate this in postgresql but the problem is the outer transaction does not eliminate the network hops for each inner/client transaction so you don't gain anything doing it and you still have the contention problem which will cause rollbacks/retries. You could reduce your number of connections to one to eliminate contention. But, then you are just playing sqlite's game.

comment 7mo ago · link · parent

An interactive transaction works like this in pseudo code.

beginTx

  // query to get some data (network hop)
  result = exec(query1)
  
  // application code that needs to run in the application
  safeResult = transformAndValidate(result)
  
  // query to write the data (network hop)
  exec(query2, safeResult)
  
endTx

How would you batch this in postgres and get any value? You can nest them all in a single transaction. But, because they are interactive transactions that doesn't reduce your number of network hops.

The only thing you can batch in postgres to avoid network hops is bulk inserts/updates.

But, the minute you have interactive transactions you cannot batch and gain anything when there is a network.

Your best bet is to not have an interactive transaction and port all of that application code to a stored procedure.

comment 7mo ago · link · parent

Not specific books per say. Though I'd advise starting with some constraints. As that really helps you focus.

Your reading/learning material can spin out of those constraints.

So for me my recent constraints were:

1. Multiplayer/collaborative web apps built by small teams.

2. Single box.

3. I like writing lisp.

So single box pushes me towards a faster language, and something that's easy to deploy. Go would be the natural choice here, but I want a lisp so Clojure is probably the best option here (helps that I already know it). JVM is fast enough and has a pretty good deployment story. Multiplayer web apps, pushed me to explore distributed state vs streaming with centralised state. This became a whole journey which ended with Datastar [1]. Thing is immediate mode streaming HTML needs your database queries to be fast and that's how I ended up on SQLite (I was already a fan, and had used it in production before), but the constraints of streaming HTML forced me to revisit it in anger.

Your constraints could be completely different. They could be:

1. Fast to market.

2. Minimise risk.

3. Mobile + Web

4. Try something new.

Fast to market might mean you go with something like Rails/Django. Minimise risk might mean you go with Rails because you have a load of experience with it. Mobile + web means you read up on Hotwire. Try something new might mean you push more logic into stored procedures and SQL queries so you can get the most out of Postgres and make your Rails app faster. So you read The Art of Postgresql [2] (great book). Or maybe you try hosting rails on a VPS and set up/manage your own postgres instance.

A few companies back mine were:

1. JVM but with a more ruby/rails like development experience.

2. Mobile but not separate iOS/Android projects.

3. Avoid the pain of app store releases.

4. You can't innovate everywhere.

That meant Clojure. React native. Minimal clients with as much driven from the backend as possible. Sticking to postgres and Heroku because it's what we knew and worked well enough.

- [1] https://data-star.dev

- [2] https://theartofpostgresql.com

There's no right answer. Hope that's helpful.

comment 7mo ago · link · parent

Litestream [1] is quick to set up and has point in time backup to the second.

- [1] https://litestream.io

comment 7mo ago · link · parent

> for inserts only into singe table with

Actually, there are no inserts in this example each transaction in 2 updates with a logical transaction that can be rolled back (savepoint). So in raw terms you are talking 200k updates per second and 600k reads per second (as there's a 75%/25% read/write mix in that example). Also worth keeping in mind updates are slower than inserts.

> no indexes.

The tables have an index on the primary key with a billion rows. More indexes would add write amplification which would affect both databases negatively (likely PG more).

> Also, I didn't get why sqlite was allowed to do batching and pgsql was not.

Interactive transactions [1] are very hard to batch over a network. To get the same effect you'd have to limit PG to a single connection (deafeating the point of MVCC).

- [1] An interactive transaction is a transaction where you intermingle database queries and application logic (running on the application).

comment 7mo ago · link · parent

If anything backups are the key to high availability.

Streaming replication lets you spin up new nodes quickly with sub second dataloss in the event of anything happening to your server. It makes having a warm standby/failover trivial (if your dataset is large enough to warrant it).

If your backups are a week old snapshots, you have bigger problems to worry about than HA.

comment 7mo ago · link · parent

That only solves read latency not write latency. Unless you don't care about consistency.

comment 7mo ago · link · parent

Last I checked RDS uploads transaction logs for DB instances to Amazon S3 every five minutes. Litestream by default does it every second (you can go sub second with litestream if you want).

comment 7mo ago · link · parent

Backups, litestream gives you streaming replication to the second.

Deployment, caddy holds open incoming connections whilst your app drains the current request queue and restarts. This is all sub second and imperceptible. You can do fancier things than this with two version of the app running on the same box if that's your thing. In my case I can also hot patch the running app as it's the JVM.

Server hard drive failing etc you have a few options:

1. Spin up a new server/VPS and litestream the backup (the application automatically does this on start).

2. If your data is truly colossal have a warm backup VPS with a snapshot of the data so litestream has to stream less data.

Pretty easy to have 3 to 4 9s of availability this way (which is more than github, anthropic etc).

comment 7mo ago · link · parent

A blog that's 11 years old and uses a minimalist CSS framework https://picocss.com ?

It's a static blog that renders markdown... there's literally nothing to code, let alone vibe code.

comment 7mo ago · link · parent

This. Run an app on the same box as PG and you can easily be plagued by out of memory etc (as there's memory contention between the two processes).

comment 7mo ago · link · parent

> SQLite on the same machine is akin to calling fwrite.

Actually 35% faster than fwrite [1].

> This is also a system constraint as it forces a one-database-per-instance design

You can scale incredibly far on a single node and have much better up time than github or anthropic. At this rate maybe even AWS/cloudflare.

> you need to serve traffic beyond your local region

Postgres still has a single node that can write. So most of the time you end up region sharding anyway. Sharding SQLite is straight forward.

> This is fine if you're putting together a site for your neighborhood's mom and pop shop, but once you need to handle a request baseline beyond a few hundreds TPS

It's actually pretty good for running a real time multiplayer app with a billion datapoints on a 5$ VPS [2]. There's nothing clever going on here, all the state is on the server and the backend is fast.

> but you're now compelled to find "clever" strategies to sync state across nodes.

That's the neat part you don't. Because, for most things that are not uplink limited (being a CDN, Netflix, Dropbox) a single node is all you need.

- [1] https://sqlite.org/fasterthanfs.html

- [2] https://checkboxes.andersmurphy.com

comment 7mo ago · link · parent

Sqlite smokes postgres on the same machine even with domain sockets [1]. This is before you get into using multiple sqlite database.

What features postgres offers over sqlite in the context of running on a single machine with a monolithic app? Application functions [2] means you can extend it however you need with the same language you use to build your application. It also has a much better backup and replication story thanks to litestream [3].

- [1] https://andersmurphy.com/2025/12/02/100000-tps-over-a-billio...

- [2] https://sqlite.org/appfunc.html

- [3] https://litestream.io/

The main problem with sqlite is the defaults are not great and you should really use it with separate read and write connections where the application manages the write queue rather than letting sqlite handle it.

comment 7mo ago · link · parent

True, but a lot of those checks will be against a local snapshots of the data.

> But yes, you don’t always need cool technologies.

That's kinda the irony mainframes are incredibly cool piece's of tech, just not fashionable. They have insane consistency guarantee at the instruction level. Hot swapping features etc. Features you'd struggle to replicate with the dumpster fire that is modern microservice based cloud computing.

comment 7mo ago · link · parent

I mean you can easily do 100K TPS on a M1 with sqlite and a dynamic language. With sub 100ms latency.

People don't do it because it's not fashionable (the cool kids are all on AWS with hundreds of containers, hosting thousands micro services, because that's web scale).

1
456
17