HN user

napsterbr

2,563 karma

Howdy!

You can reach out to me at r@ena.to

https://github.com/renatomassaro

Posts60
Comments367
View on HN
www.jefftk.com 1y ago

Does the AGPL Work?

napsterbr
2pts0
norikitech.com 1y ago

Functional Programming Self-Affirmations

napsterbr
118pts113
r.ena.to 1y ago

Avoiding recompilation hell in Elixir with mix xref

napsterbr
40pts0
cedardb.com 1y ago

Optimize the Data Layout

napsterbr
45pts7
brazilian.report 1y ago

Brazil Supreme Court lifts ban on X

napsterbr
1pts0
r.ena.to 1y ago

Optimizing Postgres table layout for maximum efficiency

napsterbr
204pts68
learningmusic.ableton.com 3y ago

Learning Music

napsterbr
2pts0
www.githubstatus.com 6y ago

GitHub Is Down Again

napsterbr
43pts12
news.ycombinator.com 6y ago

Ask HN: A New Decade. Any Predictions?

napsterbr
815pts1096
news.ycombinator.com 6y ago

Ask HN: SendGrid billed a CC I never typed into their app. How is that possible?

napsterbr
8pts6
archive.is 7y ago

Archive.is – DNS Resolution Error

napsterbr
1pts2
news.ycombinator.com 7y ago

Ask HN: Is it just me, or is CSS too damn hard?

napsterbr
499pts340
clips.twitch.tv 7y ago

SpaceX first stage malfunctions during landing

napsterbr
17pts1
cloud.google.com 7y ago

Shielded VMs

napsterbr
2pts0
imgur.com 7y ago

What burnout looks like

napsterbr
5pts0
www.openproject.org 8y ago

OpenProject – Open source project management software

napsterbr
3pts0
www.raphkoster.com 8y ago

The cost of games

napsterbr
137pts76
cloudplatform.googleblog.com 8y ago

GCP arrives in South America with launch of São Paulo region

napsterbr
2pts0
www.gutenberg.org 9y ago

Barkham Burroughs' Encyclopaedia of Astounding Facts and Useful Information

napsterbr
2pts0
jenkins.io 9y ago

Jenkins Security Advisory – SSH Slaves Plugin did not verify host keys

napsterbr
1pts0
www.indiegogo.com 10y ago

Show HN: Hacker Experience 2 – Open source hacking simulation

napsterbr
3pts3
letsbuildagame.org 10y ago

Invite HN: Let's build a game

napsterbr
3pts1
blog.renatomassaro.com 10y ago

The New Microsoft

napsterbr
1pts0
engineering.hackerexperience.com 10y ago

Systems Architecture Review

napsterbr
4pts1
hackerexperience.com 10y ago

Hacker Experience 2 – open source location-based hacking simulator

napsterbr
6pts0
www.nytimes.com 10y ago

Dilma Rousseff Is Impeached by Brazil’s Lower House of Congress

napsterbr
8pts2
blog.mandrill.com 10y ago

Important Changes to Mandrill

napsterbr
2pts1
status.github.com 10y ago

GitHub is down

napsterbr
166pts166
arstechnica.com 10y ago

SpaceX delays historic launch for better weather–to land

napsterbr
2pts0
phabricator.org 10y ago

Phabricator

napsterbr
1pts0
Workers Cache 17 days ago

There is a world of difference between well-written human text and sloppy walls of AI-generated text. There's nothing wrong in using hyphenations or emdashes -- I use them myself! That's not the point of my comment.

Workers Cache 17 days ago

One of the recent AI tells other than em dash is the excessive usage of hyphenated words:

multi-tenant-safe cache keys

on a server-rendered app

byte-for-byte identical (classic)

gets a cache-speed response

cached-file-extensions list

Honestly, this is terrible. I had to add a "use simple words only, don't hyphenate unnecessarily" warning to my Claude config. After a full day of work, having to read these Claudisms all the time make a noticeable difference on how tired you get. It gets even worse when Claude starts to make up its own vocabulary.

Reminds me of Ash (Elixir framework).

Seems great on paper, but quickly turns into a nightmare. Magic is great to get you up to speed, but as soon as you find yourself having to bend the magic, good luck.

This is clearly low quality, non-idiomatic AI-generated Elixir code. So the likely answer is that "you" did not use this at all; AI did.

I review this kind of AI-generated Elixir code on a daily basis. And it makes me want to go back to ~2022, when code in pull requests actually made sense.

Apologies for the rant, this is just a burnt out developer tired of reviewing this kind of code.

PS: companies should definitely highlight "No low-quality AI code" in job listings as a valid perk.

Coincidentally I'm working on FeebDB[0], which is similar but for Elixir instead. It can be seen as a replacement to Ecto (which won't work well when you have thousands of databases).

Mostly as a fun experiment, but also from the realization that every place I worked at in the past (small/medium-sized B2B startups) would greatly benefit from such architecture.

Yes, there are massive trade-offs to this approach, and the concerns raised in the comment section are valid. This doesn't mean the database-per-tenant is never worth it. There's a sweet spot for it, and if it fits your business/application, I personally would consider it a technical advantage over competitors.

My goal with FeebDB is to eliminate or reduce the common pain points of database-per-tenant, including:

- ensure there is a single writer per database.

- improved connection management across all tenants (e.g. only keep open at most 1000 DB connections, similar to an LRU cache).

- on-demand migration (all shards are migrated on application startup, but if a shard that hasn't migrated yet receives a request, it will first perform the migration and then serve the request),

- on-demand backups and replication (e.g. the library knows which shards were updated in the last X minutes, so it can trigger Litestream or similar on demand).

- support for enumeration of databases (performing map/reduce/filter operations across multiple DBs)

- support for clustered deployment with "pinned" tenants (for now I'm assuming the IOPS of a single beefy server should be enough for all use cases, but once that's no longer sufficient you can have "shards of shards")

[0] https://github.com/renatomassaro/FeebDB/

The entire project is open source, so sure! :D

I actually have two projects that use this approach, FeebDB (which is the library I wrote to manage a "one SQLite database per client" approach) and HackerExperience (a game under development that uses FeebDB).

The overall idea is simple:

1. Before tests start running, create a prop of each database.

2. The prop contains the "starting database" for each test. It may contain seed data (optional).

3. For each test, copy the prop and assign it a unique shard identifier (say, cp /props/user.db /test_data/user/874125.db).

4. The test knows the `shard_id` and can do whatever it wants with it; no one else will bother it.

5. Once ExUnit is finished, delete all shards.

Both projects follow a similar approach (I wrote it first in FeebDB and copied into HackerExperience, which has some sections commented out -- I need to clean up this part of the codebase).

For both projects, you will find steps 1/5 in `test/support/db.ex`, step 2 in `test/support/db/prop.ex` and steps 3/4 in `test/support/case/db.ex`.

- FeebDB: https://github.com/renatomassaro/FeebDB/

- HackerExperience: https://github.com/HackerExperience/HackerExperience/

Email is in profile in case you have follow up questions/comments :)

A hobby project of mine (in Elixir) uses SQLite as primary database. Each test runs in its own fully isolated SQLite database. No mocking (or transaction rolling back) needed. Most of these tests take less than 1ms to run (and when they take longer, it's because of something else).

This kind of setup makes the usual Ecto Sandbox approach feel slow, but I do agree that the way Elixir approaches this is great!

Do I need 2 replicas to avoid the split brain scenario? my brain hurts already.

It will hurt even more.

The recommended way is to set up a witness server. Yet another thing to manage in a properly designed Postgres cluster. Certainly not an easy/trivial thing to do, ops-wise.

From [0]:

By creating a witness server in the same location (data centre) as the primary, if the primary becomes unavailable it's possible for the standby to decide whether it can promote itself without risking a "split brain" scenario: if it can't see either the witness or the primary server, it's likely there's a network-level interruption and it should not promote itself. If it can see the witness but not the primary, this proves there is no network interruption and the primary itself is unavailable, and it can therefore promote itself (and ideally take action to fence the former primary).

An interesting acronym you'll hear is STONITH (in order to fence the former primary).

[0] https://www.repmgr.org/docs/current/repmgrd-witness-server.h...

I wonder if creating jails have gotten easier since v8?

I think iocage was released after v8, so yes, definitely! Not only creating, but managing jails as a whole. In many ways, iocage can be compared to docker when it comes to container management.

Currently, FreeBSD lags behind in key areas such as [...] laptop-specific functionalities like suspend/resume

Many years ago I migrated to FreeBSD and absolutely loved it. I was forced to migrate back to Linux once I started a job and ended up staying with Linux to this day.

A few months back I decided to give FreeBSD another shot. The one thing that was an immediate deal breaker was being unable to suspend/resume on my desktop computer. For my workflow, that's an unnecessary waste of power / energy.

Just wanted to share this testimonial to outline the importance of suspend/resume for non-laptop hardware. Almost every time I see this discussion, it's focused on laptops.

By the way, I'm extremely excited about this initiative to make FreeBSD more attractive to non-server users in general (not only new ones). That will surely be a huge benefit to the entire community. If I can't run FreeBSD on my machine, I won't runt it on my servers.

One interesting thing your team may want to look into (if you haven't already) is compression.

Of course there are a multitude of variables we don't have access from the outside, but Postgres only compresses data that is TOASTed, and based on your description of the table, the data is not being TOASTed (and therefore not being compressed).

Instead, if you could somehow pack your timeseries entries into an array, you would get the benefits of compression automatically.

Given your write performance requirements, using an array may be out-of-question (and you may get too much overhead from dead tuples) -- but who knows? Always a good idea to benchmark.

I actually considered mentioning this at the post but figured it was too long already and could be the material for a future one :)

Hey, author here.

Indexes are, by nature, a tradeoff where you give up space to gain time, so this mindset doesn't really apply there.

I agree that (re)aligning indexes are a different beast entirely, but (as mentioned in my recommendation) ideally the developer should keep this in mind when creating the index initially.

Factors like cardinality and even readability should take precedence over perfect alignment, but all else being equal, aligning your indexes from the very moment they are introduced in the codebase is the ideal scenario IMO.

You can write a confusing unreadable Haskell script, just like you can write a confusing unreadable Python script.

I totally agree (and have seen both scenarios throughout my career).

That said, all else being equal[0], refactoring the purely functional code is, usually, easier, more reliable and less scary.

[0] - among other things, this assumes the person doing the refactoring knows, in this example, both Python and Haskell equally well.

For the voters.

If Bolsonaro had not made fun of covid victims and needlessly spilled hate on every other word that came from his mouth, he'd be the current president of Brazil.

A moderate right wing candidate will likely win for 2026, just like an hypothetical moderate Bolsonaro would have won last year.

One side will claim the trial was unfair or overreaching or political. The other will claim that the judicial system did work as expected and followed the rules it set forth well before the 2022 elections began.

I have my own take, but then again it is heavily influenced by my own bias. It's hard to share an unbiased opinion here.

The idea that Lula is using his political power to take Bolsonaro out of the game is laughable, IMO.

One could say this is actually bad news for Lula, in the sense that Lula and Bolsonaro need each other.

For the next presidential election, any not-too-exteme right wing candidate has great odds of beating Lula, if he were to run for reelection.

From the details page:

This is not a numbered fatal event because the Legacy aircraft, although based on the design of the ERJ135 regional airliner, was not airline passenger flight.

This particular crash is widely known here in Brazil. The two pilots from the small aircraft had turned off the plane transponder. They had a mid-air collision with a 737. Everyone at the 737 died.

The two pilots of the Embraer 190 are Americans. They were sentenced to jail in Brazilian court but were never arrested to this day (not sure why).

Can someone enlighten me on how it's possible for a space telescope to detect far away molecules?

I suppose it's not actually seeing the molecules themselves, but something that proves the molecules are there. The article mentions:

UV rays [...] provided the energy to form the molecules

Is that it? The telescope detected UV rays, which necessarily (according to the scientists) correlates to the creation of methyl cations?