Better HN
topnewbestaskshowjobs
Log inSign up

andersmurphy

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

https://andersmurphy.com
Submissions

comment 1y ago · link · parent

+1 for datastar. It lets you do really dumb push based streaming html stuff where HTMX isnt quite fast enough (great for multiplayer apps).[1]

Super excited about triptych too! Thanks for pushing that.

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

comment 1y ago · link · parent

> Either Ruby Central puts controls in place to ensure the safety and stability of the infrastructure we are responsible for, or lose the funding that we use to keep those things online and going.

Seems pretty clear after reading this. If 1-2 companies pulling funding is enough for them to force you to to what they want, its hard to stay independent.

comment 1y ago · link · parent

You don't need to rollback, because you have already checked the invariants and the system is a single writer.

Ah you're doing request response? sqlite/single writer fits much better with a CQRS still approach, so in my experience you move away from request/response to something push based. That being said even in a request/response model wrapping a request in a transaction is not a great idea. The minute you have anything that takes some time (slow third party) that transaction is going to sit open and cause trouble.

comment 1y ago · link · parent

The batch is still atomic (as it's wrapped in a database transaction). So you batch items will never partially happen (say in the case of a crash).

You do have to write your batch items so that they check their own constraints though. I.e check the accounts have funds etc.

comment 1y ago · link · parent

With a single writer (as it the case with sqlite). You don't need transactions and rollbacks. As all writes happen in sequence.

Each batch item can be a combination of read/write/update that happen in sequence and therefore can give you the same semantics as a traditional transaction/rollback. eg:

- read -> Does the account have enough funds?

- write -> transfer 100$ from this user to another account

This is also much simpler to write than in other databases as you don't have to worry about n+1.

comment 1y ago · link · parent

But for scale you don't want multiple writers. You want a single writer so that you can batch.

comment 1y ago · link · parent

Yeah sqlite runs circles around postgresql when it comes to writes if you know what you are doing. Single writer lets you batch and batching is king for writes.

comment 1y ago · link · parent

You can hit 40000-80000+writes/s with sqlite on a 10$ VPS just by batching transactions (i.e wrapping all inserts/updates in a single transaction every 100ms). This is easy to do at the application level, then you also avoid BUSY/LOCK.

I'd argue writes scale better wtih sqlite than postgresql.

comment 1y ago · link · parent

Yeah if you know the ip of your peer you don't need STUN/TURN from what I remember.

comment 1y ago · link · parent

Not sure why this is getting down votes but I agree. Also building from source doesn't have to be hard (see sqlite).

comment 1y ago · link · parent

Some of us keep htmx around as a momento. Just for old times sake.

comment 1y ago · link · parent

Wow, that's crazy, I was wondering why the numbers I were seeing on AWS were so much worse. I assumed it was the drive modernity. But network makes a lot more sense.

Thanks for the insight!

comment 1y ago · link · parent

May I suggest you could have been holding it wrong?

The out of the box defaults for sqlite are terrible for web apps.

comment 1y ago · link · parent

Hetzner also tends to have more modern SSDs with the latest nvme. Which can make a massive difference for your DB.

comment 1y ago · link · parent

You actually save on labour. A VPS is a lot less work than anything involving AWS console.

comment 1y ago · link · parent

Nice!

Honestly, we need to stop promoting prematurely making everything a network request as a good idea.

comment 1y ago · link · parent

Not sure what you are talking about? In WAL mode (which is what you should be using) writes don't block reads and reads don't block writes. If you are connections pooling (which you should) the cache will stay hot.

Sqlite (properly configured) will outperform "proper databases" often by an order of magnitude in the context of a single box. You want a single writer for high performance as it lets you batch.

> 256 hardware threads...

Have you tried? I have. Others have too. [1]

> Additionally, SQLite lacks a bunch of integrity checks, like data types and various kinds of constraints. And things like materialised views, etc.

Sqlite has blobs so you can use your own custom encoding which is what you want in a high performance context.

Here's sqlite on a 5$ shared VPS that can handle 10000+ checks per second over a billion checkboxes [2]. You're gonna be fine.

- [1] https://use.expensify.com/blog/scaling-sqlite-to-4m-qps-on-a...

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

comment 1y ago · link · parent

Not the biggest fan of Java the language. But the JVM is a beast. Has better virtual threads and much faster FFI than go these days too.

comment 1y ago · link · parent

Sqlite has some sharp edges for sure honestly even basic batching all inserts/updates in a transaction every 100ms will get you to 30000+ updates a second on a 4 core shared CPU VPS (assuming nvme drives).

That's the other thing AWS tends to have really dated SSDs.

Honestly, it's like the industry has jumped the shark. 1k is not a lot of load. It's like when people say single writer means you can't be performant, it's the opposite most of the time single writer lets you batch and batching is where the magic happens.

comment 1y ago · link · parent

Most of those things you listed are work arounds for having a slow server/system.

For example, if you serve your assets from the server you can skip a cors round trip. If you use an embedded database like sqlite you can shave off 50ms, use dedicated CPU (another 50ms), now you don't need to sever anything from the edge. Because your global latency is much better.

Managing a single VPS is trivial compared to AWS.

comment 1y ago · link · parent

100% this add an embedded database like sqlite and optimise writes to batch and you can go really really far with hetzner. It's also why I find the "what about overprovisioning" argument silly (once you look outside of AWS you can get insane cost/perf ratio).

Also in my experience more complex systems tend to have much less reliability/resilience than simple single node systems. Things rarely fail in isolation.

comment 1y ago · link · parent

Most industries are not bursty. Overprovision in not expensive for most businesses. You can handle 30000+ updates a second on a 15$ VPS.

A multi node system tends to be less reliable and more failure points than a single box system. Failures rarely happen in isolation.

You can do zero downtime deployment with a single machine if you need to.

comment 1y ago · link · parent

If you're running on a single machine then you'll get way more performance with something like sqlite (instead of postgres/MySQL) which also makes managing the database quite trivial.

comment 1y ago · link · parent

I guess CPUs are pretty buggy with all their caches. If only the hardware people could fix their buggy systems.

In all seriousness sometimes a cache is what you need. Inline caching is a classic example.

comment 1y ago · link · parent

A single machine can handle much, much more if you use sqlite and batch updates/inserts.

Honestly, unless you're bandwidth/uplink limited (e.g running a CDN) then a single machine will take you really far.

Also simpler systems tend to have better uptime/reliability. Doesn't get much simpler than a single box.

comment 1y ago · link · parent

I find it more concerning that the DoD uses node.

I might be wrong but npm etc feels like a very large attack surface.

comment 1y ago · link · parent

That would have been true pre Mozilla implosion.

comment 1y ago · link · parent

Loading fine for me.

comment 1y ago · link · parent

Yeah, I've mostly adopted hobbit software [1]. I got tired of the endless churn for the churn gods. It does push you more towards building your own products and/or shipping end to end apps to customers (where they are more interested in the what than the how). If anything in that context you care even more about stability and maintenance.

My shire of calm is currently:

Datastar/Clojure/JVM/Sqlite/VPS/caddy

Destroy the ring, break the cycle. It's great to just focus on building stuff and solving actual problems (PHP devs have known this for a long time).

- [1] Hobbit Software

> Now thinking about creating a movement to promote "hobbit software". Pretty chill, keeps to itself, tends to its databases, hangs out with other hobbit software at the pub, broadly unbothered by the scheming of the wizards and the orcs, oblivious to the rise and fall of software empires around them.

> Oh, the Electron empire is going to war with the Reacts? Sounds ghastly, sorry to hear that. Me and the lads are off to the pub to run some cronjobs, wanna come along?

- Dave Andersoon

comment 1y ago · link · parent

"This feels like the end of prompt engineering and the beginning of collaborative cognition"

Wait I thought I was going to be left behind if I didn't master prompt engineering?

1
1314151617