HNHacker News
TopNewBestAskShowJobs

nhoughto

451 karma · joined October 9, 2014

submissionscomments
nhoughto··on Mortgages are a manufactured product
Interesting insights, my brain always goes to how to reduce inefficiency but there are many more things at play.
nhoughto··on Mortgages are a manufactured product
Surprising, that seems very inefficient. As a bank offering a mortgage I have to set an interest rate for entire period? Naturally I’m going to be conservative to ensure profit.. which hurts the consumer. Variable or short term fixed rates seems much more logical.
nhoughto··on Large-scale, semi-automated Go GC tuning
Still feels like golang or maybe a 3rd party addition (not sure if that’s possible? Assume not) could just make a GC with a few more knobs, and would be a net benefit to the community. Every time I read about golang gc feels like the solutions are fighting the framework a little/a lot.

There is tons of great gc research/experiments/learnings out there that can have real benefits, maybe the JVM with its zillions of knobs is a step too far but find a middle ground seems like it would help people.

nhoughto··on What NPM should do to stop a new colors attack
yeah i don't see it as an attack and was very surprised Github suspended his account, less so that NPM unpublished the package. It is easy to think of these platforms as unbiased repositories, but as soon as something is deemed 'wrong' suddenly you need to think what the criteria is for that decision, who makes the decision and how? Where is the line?

Is an infinite loop is the line? Updating a package to display random text without an infinite loop is crossing the line too? Who decides what _my_ OSS library is allowed to do? Can I update it just to add a banner asking for donations? How is that functionally different to random text other than intent?

nhoughto··on Saving a Third of Our Memory by Re-Ordering Go Struct Fields (2020)
Reminds me of a similar potential gotcha in Postgres

https://www.2ndquadrant.com/en/blog/on-rocks-and-sand/

The linting story for postgres schemas isn't as good as it is in golang tho, so harder to automatically detect/solve for.

nhoughto··on Upwork asking me for a $12.5k refund as the client was using someone else’s card
Since when can you chargeback after 2 years? I thought it was limited to a couple of months?
nhoughto··on AWS Account Takeover via Log4Shell
If you bind ec2 and have any access in docker you likely can GET from ec2 metadata endpoint and get sts creds, don’t need root for that.
nhoughto··on Pgmigrate: Write migrations using plain SQL
Yep, a migration script (if you have data you care about) is very important, it should be reviewed before being excluded. It has the power to blow away your data if done poorly. So having an explicit SQL statement (whether hand crafted or generated and exported) that is visible is super important, it means you are thinking about this important step, so its visible and harder to forget.

The classic problem with letting your ORM manage migration is if you are updating your database entity model as part of a wider change, in your ORM and you rename a column, does it know its a rename? or is it going to DROP COLUMN + ADD COLUMN? and lead to data-loss? To cover these cases and all the infinite other permutation you end up needing to give the ORM more and more state about the past, making it just a more complex migration. Making the migration explicit SQL and decoupled from the ORM forces thought, a human is unlikely to write DROP COLUMN..

nhoughto··on Pgmigrate: Write migrations using plain SQL
very mature at this stage too, lots of good defaults.
nhoughto··on We check our node_modules folder into source control
mostly dev dependencies, i guess you really pay the price for not having a compressed intermediate format like a JAR: - storybook is 420MB (! will look into this one!) - babel is 110MB - sentry sdk is 92MB (?) - aws-sdk is 63MB - typescript 60MB - react-native 51MB

.. on and on, 40MB..30MB..20MB.. hundreds of them just adds up! 147 dependencies over 1M. pretty incredible/wasteful really when you look at it.

nhoughto··on We check our node_modules folder into source control
Tbh haven’t gone deep into it, now you ask maybe I should. It compresses ok, zstd to 240MB. React + react native, we lack etc tons of stuff. My guess/hope is mostly dev dependencies.
nhoughto··on We check our node_modules folder into source control
I like the benefits but our node_modules is 1.9GB, def not checking that in.

A Git bot that parses changes to yarn lock and comments with size/loc/files of all the deps etc, kinda like how coverage bots work. get all the observability benefits without the checkin cost, also wouldn’t have to split npm changed and code changes..

nhoughto··on Faster Gitlab CI/CD pipelines
Ah ok sounds like a good setup, I could never get past the slow image pull times for systems like that though? Maybe I missed a setting. Containerd especially was quite slow at pulling images. Image of 2GB~ could take a couple of minutes to come down, order of magnitude more than straight s3 download. Once you’ve got your images fine, but if your build nodes are elastic you can easily hit cold/new nodes and pay the penalty.
nhoughto··on Faster Gitlab CI/CD pipelines
Yep Specially crafting a zip file can make it streamable but it’s not the general default. Can GNU unzip read from stdin? Not sure but I don’t think so?
nhoughto··on Faster Gitlab CI/CD pipelines
Yep true, generally baking caches into build images is a bit fragile tho, the more caches and different types of jobs you have the larger the set of combinations of images you need to cover it. Often ends up easier to decouple build image from caches, and ideally calculate a cache key based on a yarn.lock or similar (not supported by gitlab).

Also image pull performance is generally pretty poor from most registries, you will get much higher speeds out of a straight s3 download then pulling an image via docker or containerd, even tho ecr for ex is backed by s3 .

I haven’t actually used ootb gitlab caching in quite a long time because of these limitations, but would be nice for it to work great ootb!

nhoughto··on Faster Gitlab CI/CD pipelines
One improvement that would be nice in gitlab is an extension / similar feature to the FF_USE_FASTZIP flag.

The default way to cache things is zip, which no matter the compression isn't a great fit, you really want a format that is stream-able like tar. When its stream-able you can download the tar and unpack it at the same time, not waiting for the full download before beginning to unpack. Obviously you would compress the tar (normally) with lz4 or zstd or similar, using this approach you should generally see a reduction in total time to get and unpack the cache. node_modules even more so since it generally has zillions of small files, so the unpack time can be quite high.

Be nice if gitlab supported this approach OOTB.

Edit: An even better way if your environment supports it is to use a mountable image (esp for node_modules) for your caches, this basically removes the entire unpack phase of making the cache available, instead of unpacking you just mount the image and off you go.

In macOS this looks like a sparseimage via attached hdituil, or in linux a squashfs image with a writable overlay mount (you need a privileged container for this if in a container). Since the OOTB gitlab.com runners are a root-user linux VM (i think?) this approach should work quite well. SquashFS images are a great fit for node_modules especially as it moves the creation of the zillions of tiny files to cache-creation time rather than cache-use time. If you share the cache images via a hostPath mount or similar for existing images you can effectively make caches available in 0 seconds (just mount an already downloaded image and done).

nhoughto··on Faster Gitlab CI/CD pipelines
yep, we do a scheduled daily build with all caching off, to test that it all works without caching, and a good way to rebuild your caches without old dependencies/files etc. Good backstop.
nhoughto··on Java Virtual Threads Preview
yeah it worked, as in the ecosystem was consistent with a single non-blocking pattern..

and then almost immediately went in 5 different directions around how to program around it.. callback hell, async/await, generators, promises etc..

nhoughto··on Java Virtual Threads Preview
More mental overhead and tough ecosystem, you end up in the coloured functions problem where you choose to write non blocking code so now all your dependencies / libraries must too. Nodejs worked because it was like this from day 1 but java isn’t.

This change would make the base primitives non blocking (really cheap Blocking which is better) by default, so now you can use any~ library and it should just work. Waaay better.

nhoughto··on Debugging memory corruption: who the hell writes “2” into my stack? (2016)
Had the same thought, my experience with unity support is its a blackhole. Good that there are some good examples even if from times past.
nhoughto··on We saved millions in SSD costs by upgrading our filesystem
Lots of interesting nuggets in here, i'm also interested in the ASG driven db node replacement approach, has anyone seen any more info about the nuts and bolts of how this works?

The idea of treating db nodes less like pets seems great, there must be a few tricks to it tho..

nhoughto··on We saved millions in SSD costs by upgrading our filesystem
how important was being able to disable postgres full page writes under zfs? that was almost a throw-away line in the article but could be really important for some pg workloads i'd think? certainly got my attention
nhoughto··on Stop Making Students Use Eclipse (2020)
Interesting problem, I imagine many here grew up on computers not because it was valuable or strategic but because they couldn’t not, such was it’s draw. Learning the concepts by brute force was the norm, the idea of not knowing what a file, file system etc is is foreign because you’ve lived and breathed it for so long before higher education.

I guess there are people today who don’t fit that mold and approachability becomes important, shouldn’t be surprising.

nhoughto··on Never update anything
Few interesting areas:

- JS dependencies are a problem because of the sheer number, which is really because of all the authors of the dependencies and how they update, backwards compat or not etc. if you had 10 big things by 10 authors they would coordinate better than 1500.

- The Lazarus example is interesting but “trusted components” also means walled gardens, who gets to choose? Is there competition? How is that decided in vs out? Logical conclusion to much of this ends up with a central community package manager like maven central..

nhoughto··on Minimum Viable Secure Product
“Minimum” secure product is interesting, I’ve definitely gone down the slippery slope of going too secure, and it doesn’t feel like the wrong thing at the time but looking back it slowed us down. Very hard to craft a minimum.
nhoughto··on MangoDB: An open-source MongoDB alternative
yeah sorry i just made up 'mapped generic columns',

my progression was trying to find a soln for immutable key/values (immutable enabling some different tradeoffs then others might have) where most of my values are bigints so only a couple of bytes to store.

I worked through approaches: 1. obvious skinny table with duplication 2. EAV optimisation to reduce duplication

The problem with both of these is that having 1 key/value per row with a small value (8 bytes~) meant 23-27 byte row overhead, which obviously increases your storage cost dramatically.

So i looked at how to have more values on each row, so maybe 23-27 bytes overhead for 500 values..

3. EAV with values grouped into an array per row, similar to EAV but instead of 1 value per row, map N values onto 1 row using an array column. So N values are all in one array on a row, and accessed by index. This has the lowest storage overhead, because of row compression you can get on average an 8 byte bigint stored for only 6 bytes per value (so no overhead, actual savings on the raw values..), but value access via array index isn't very efficient especially for sparse arrays, or sparse queries across millions of rows. And tom says maybe not: https://marc.info/?l=pgsql-performance&m=131229661705005&w=2

Good thing about 3 is that you can abstract the value -> row array mapping in SQL, so app doesn't need to care about it, but array access is slower than i'd like, so how to avoid that? Maybe map N values onto generic columns instead? No array access penalty, and less framework fighting..

4. So like 3 but instead of N values in an array per row, have values in N generic columns per row (value_1, value_2 etc). It is too hard/bad ergonomics to do this in SQL/pgplsql, so now the app has to be aware of what value is in which generic column name, which was ok for us and it has much better query performance. In terms of storage cost, there is a relationship between number of columns/values per row and how much data is required to be paged in to retrieve a value (performance) and row overhead and compression efficacy. We landed on 100 values per row I think, this meant bigint was 8-10 bytes to store instead of the more efficient for approach 3 is tunable tho upto the column per row limit of ~1600.

Can dig up proper numbers later if useful but thats the general idea.

nhoughto··on MangoDB: An open-source MongoDB alternative
Ah yeah it’s probably jsonb (duh). That’s not efficient, but sometimes you don’t care about that!
nhoughto··on MangoDB: An open-source MongoDB alternative
Recently went deeep on efficient kv storage in postgres, there is an order of magnitude different in storage size between different approaches (naive skinny table, EAV, array values, mapped generic columns etc).

I wonder what approach this project takes, I’ll have to poke around!

nhoughto··on An Interview with the Old Man of Floating-Point (1998)
Is an interesting topic and seems to have an interesting history, is there any good books on the topic? Something less academic and dry than I’d expect a floating point book to be but more all encompassing and accessible?
nhoughto··on EBCDIC is incompatible with GDPR
yep this is fairly common where the original form-factor, a piece of paper/plastic card, was the target. The intent of capturing the name was to put it on the card, and long names can't fit so we have to truncate them or abbreviate etc.

Nevermind that that might not be your name or that in the future having the untruncated name might be useful.

Definitely a big problem for then using that data to form the base of an identity system like trusted ID compliance.

← PreviousPage 5 of 9Next →