HNHacker News
TopNewBestAskShowJobs

brandur

3,383 karma · joined August 30, 2011

APIs + engineering @ River. Ex-Snowflake. Ex-Stripe. Ex-Heroku.

Twitter: https://twitter.com/brandur

GitHub: https://github.com/brandur

Website: https://brandur.org

Email: brandur@brandur.org

submissionscomments
brandur··on Two years of Rust
> In your opinion what are some of the things wrong with Rust? Genuinely curious as someone who operates at the higher level of the stack (web development) but is interested in learning something lower: C++, Rust, etc.

I think the most classically cited problem is the learning curve. Understanding ownership and lifetimes, and understanding how to satisfy the borrow checker can be quite daunting.

Here are a few that I think about personally and which are probably a little more unusual to see:

* Batteries not included: the standard library's been pretty stripped down in favor of moving things out into external crates. The justification is that packages included in the standard library tend to ossify and become liabilities as they outlive their usefulness [1]. I buy the argument, but am a little worried that it's going to result in a fractured ecosystem where even extremely common functions like HTTP don't have "one true path" so we get a dozen different packages that try to handle it.

* Tunnel vision focus on Tokio: to my eye the community seems a little obsessed with Tokio and zero-cost futures. It's really nice how performant it is, but I'm not crazy about how futures-based concurrency spreads into your code through huge amounts of necessary boilerplate (`.and_then(...).and_then(...).and_then(...)`). I think that for most cases where performance is not an absolute mission critical necessity, a light runtime that manages asynchronous operations for you (say like Go's) is probably the way to go because it unlocks far better productivity. I'm cautiously optimistic about the possible inclusion of something like an `await/async` construct.

[1] https://blog.rust-lang.org/2017/05/05/libz-blitz.html

brandur··on Two years of Rust
> Not being hindered by the compiler telling you what you can and can't do; freeing yourself from the write-compile-debug cycle, reducing it to repl-done; etc.

Yeah, I certainly understand various language trade-offs, but in my experience any of these early wins of interpreted languages come back to haunt you at significant cost.

I saw someone use the analogy of a credit card on here before: purchases are very easy to make, but have to be repaid in full, and without perfect discipline you'll be paying interest on top. Now consider most development teams (who are generally strapped for resources) like middle-class earners who don't make quite enough to pay back that balance every month. It starts to accumulate, and the owed interest compounds.

Compilers can do a lot to ensure high productivity and a good user experience: (1) be fast, (2) have great error messages, and (3) be easy to use (no makefiles or heavy build systems). Rust's compiler has learnt from the mistakes of its predecessors in other languages, and does all these for you.

brandur··on Two years of Rust
I'm consistently blown away by just how good the project management for this language is. It's not just the forward progress that the language is making (which is considerable), but also just how well they package the information up into a form that the rest of us who are not involved day to day can digest, like has been done here.

Another example is the "This Week in Rust" newsletter which takes progress that would've taken you hours to read about yourself, and puts it into a succinct format that you can get through in minutes [1].

The Rust 2017 roadmap which targeted forward movement on all the language's weakest features was admirable in itself, but even moreso is how much progress has already been made. In particular, I'm really excited about incremental compilation, which is showing as much as 5x speedups in early results [2].

I was also very happy to hear that the Rust team acknowledges that regardless of how performant they are, futures are not a particularly ergonomic or maintainable way to write code, and are considering what new constructs might look like over the longer term:

> Over the rest of this year, we expect all of the above libraries to significantly mature; for a middleware ecosystem to sprout up; for the selection of supported protocols and services to grow; and, quite possibly, to tie all this all together with an async/await notation that works natively with Rust’s futures.

I'm still on dabbling in Rust, but I'm fairly convinced that in another few years after this Tokio churn has gotten a chance to settle down and the async patterns are more broadly refined, there won't be many justifiable reasons to not write new projects in it, whether they're as low level as a Postgres extension, or as high level as a DB-backed HTTP application. It seems to have an almost perfect compromise between performance, safety, productivity, and ecosystem.

[1] https://this-week-in-rust.org/

[2] https://blog.rust-lang.org/2017/05/15/rust-at-two-years.html...

brandur··on Spanner: Becoming a SQL System [pdf]
> This is part of a worrying new trend. Increasingly you can't buy software anymore, only rent.

More or less agreed, but you'd probably have to concede that the existence of papers like this one and some of Google's other Spanner publications are admirable; they're being more open about the system's design than they have to be.

Of course Google knows that the system's secret sauce is not the concept itself, but the cost of its implementation, the infrastructural harness to support it, and the resources to reliably operate it. Even with a rough understanding on how Spanner works, it's still going to be difficult to ever migrate off it for practical reasons alone — who else is going to be able to build and run an alternative?

I have huge respect for what the Spanner team is doing, but this is a reason that Citus [1] is also very interesting to me right now. You could conceivably start out with nothing but Postgres and migrate into a Citus cluster when (and if) you need to.

If a point comes where you realize that you need out, you could either (1) see if you can scale back down to simple Postgres, (2) host your own cluster on your own infrastructure with the Citus source code, or (3) migrate onto your own Postgres sharding scheme à la Instagram. At no point do you lock yourself into custom GRPC APIs which are going to be ~impossible to get off of.

GCP and AWS provide hugely useful foundational IaaS, but they're incentivized to move beyond that layer and provide more custom solutions that (1) provide better margins, and (2) lock you into their services. As people and companies building on top of these clouds, we should be looking for whatever opportunities we can to keep our stacks generic so that AWS <-> GCP <-> Azure migrations are possible, even if a last resort.

[1] https://www.citusdata.com/product/cloud

brandur··on The Lockheed Sea Shadow and the Hughes Mining Barge
It's too bad the _Sea Shadow_ is gone, but I was pleasantly surprised by how easy it was to go and see the _HMB-1_.

It's docked at Bay and Ship right next to the ferry terminal on Alameda. Here's a picture I took of it [1].

If you're in the Bay Area, it's probably not worth making the trip out there for just the ship, but it's neat to walk around the old naval base close to there, and I'd recommend a stop off at Rock Wall Wine Company along Monarch St. There's a spacious outdoor area with a very unique perspective of downtown San Francisco.

[1] https://drop.brandur.org/hmb-1.jpg

brandur··on The Lockheed Sea Shadow and the Hughes Mining Barge
To be fair, it doesn't look like this was entirely fiction. Here's what Wiki has to say on the subject [1]:

> Interest in the potential exploitation of polymetallic nodules generated a great deal of activity among prospective mining consortia in the 1960s and 1970s. Almost half a billion dollars was invested in identifying potential deposits and in research and development of technology for mining and processing nodules.

And in a few cases they actually succeeded in extracting some metals:

> In the late-seventies, two of the international joint ventures succeeded in collecting several hundred ton quantities of manganese nodules from the abyssal plains (18,000 feet, 5.5 km + depth) of the eastern equatorial Pacific Ocean. Significant quantities of nickel (the primary target) as well as copper and cobalt were subsequently extracted from this "ore" using both pyrometallurgical and hydrometallurgical methods.

A lot of R&D money was sunk into this before it even had a hope of commercially viable (and it still isn't to this day), but it wasn't a hoax either.

[1] https://en.wikipedia.org/wiki/Manganese_nodule#Proposed_Mini...

brandur··on How J.J. Abrams Created a Reading Experience Unlike Any Other
I've read it. I liked the premise for The House of Leaves and really _wanted_ to like the book, but to be honest, the whole experience felt a little gimmicky to me. I got to parts that were obnoxiously annoying to read (e.g. the shrinking tunnel), and the story didn't really feel worth it.

S. has some of this too (the handwriting in the columns takes time to make out), but because the quality of narrative and the overall refinement of the product were so high, I didn't mind. Given a choice between the two books, I'd certainly start with this one.

brandur··on Dynamo, Citus, and Tradeoffs in Distributed Databases
Hah, thanks for being gentle on my Dynamo versus DynamoDB faux pas — that is some seriously confusing naming.

Very interesting though. Thanks.

brandur··on Dynamo, Citus, and Tradeoffs in Distributed Databases
Hi Pino, you mentioned in the article that Dynamo was built in response to an internal demand. Can you talk at all about the specifics of what sort of information Amazon puts in there?

I've overseen a few big Dynamo installations at this point, but for the most part I wouldn't store any "core" information in there (say like a customer, merchant, or product at Amazon) because after adding data to Dynamo, your ability to query and restructure it is quite limited. We've generally put data in that's append-only, is considerable in volume, and which we only ever need to retrieve in a few particular ways. To go back to the Amazon example, I probably wouldn't put a customer, merchant, or product in it, but I might put in a log entry for a purchase transaction.

What I'm trying to suss out is whether the sweet spot product like Citus is more akin to a Dynamo, or more akin to a traditional RDMS.

brandur··on Spotify to go public as direct listing on NYSE
This article seems to do a much better job of explaining the trade offs of a direct listing:

http://fortune.com/2017/04/07/spotify-ipo-direct-listing/

Apparently the traditional underwritten approach is engineered fairly specifically to aim for that first day "pop" to build excitement about the new stock, and also seems with a lot of publicity which the banks can provide.

According to the article, direct listing does seem to be better for employees though:

* Spotify would likely issue no new shares (less dilution).

* No expensive underwriter necessary.

* Existing shareholders won’t have pre-sell any of their shares to new investors, which could mean that they capture more of the upside given that the stock has been purposely underpriced for the pop (and so the new investors capture more).

* No lock-up periods for shareholders.

brandur··on Ask HN: Do you sign your code at work?
We don't for the most part, but ended up moving to a VPNed GitHub Enterprise installation over the possibility (albeit unlikely one) that GitHub's main cloud could be compromised and used to inject malicious code into a repository that we own.

It doesn't hurt to shore up on security, but given the expense of operating a GHE installation, the fact that there are some GH niceties that don't work quite right there, and that even in just a few months of use GHE already has a poorer availability record than the public GH cloud, broad code signing might have been a better approach.

We do sign in a few places like for our internal deployment tool that gets widely distributed to all engineers, and which checks its code signature before allowing a deploy. It works pretty well, but the fact that GitHub's "merge pull request" button exists (which will create a merge commit on `HEAD` without a valid signature) tends to cause a fair bit of inconvenience.

I'd definitely be curious if others have been making this work.

brandur··on Azure Cosmos DB, a globally distributed database
I'd also be interested in an answer. I'm guessing the answer is "no" based on my reading of the docs, but it'd be nice to confirm that.
brandur··on The Long Road to Mongo's Durability
I haven't run any numbers, but here's how I understand it.

Because of the way its journaling is implemented with sync interval, when you've configured durability with `writeConcern` `j` set to `true`, any write will have to wait for the next sync interval to commit. This wait will be in the range of 0 to the configured interval (~100 ms) and that makes the worst case quite bad.

You can work around it by configuring a lower sync interval and thus less average wait time, but I doubt you ever reach the level of databases that were designed to prefer durability by default, and which have heavily optimized that write path.

brandur··on Show HN: Jolt Alarm – Wake up to a new song every day
That sounds like it might be difficult to sustain, but this kind of hand curation is the surest and easiest way to consistent quality. Thanks for doing it!

You might want to considering billing this as part of the product's description. My biggest question coming in was how the music was selected because I wanted to know if there was some mechanism to avoid genres that I'm sure to hate. I had to come here to find my answer.

I'm looking forward to trying out Jolt tomorrow.

brandur··on The Mac Pro Lives
Fans of the Mac Pro have been waiting four years for this announcement, and are likely to be waiting another one or two for any real movement on the problem.

The Touch Bar seems like a pretty apparent failure in that even most of the "until death" apologists can't or won't defend it, but Apple's not going to give up this quickly. I think you'll get your wish, but not soon.

brandur··on The Mac Pro Lives
Yep. What a silly thing for them to say as long as the Touch Bar exists.

But seriously, Apple has a history much closer to the opposite of that. Never admit fault. If something really isn't working, pretend that it is right up until a replacement is launched. Just like PowerPC to Intel. Just like the Mac Pro until today. Just like the Apple Watch and Touch Bar (admittedly these last two are a little more speculative on my part, but I think it'll happen).

brandur··on Is GraphQL the Next Frontier for Web APIs?
Yes, PostgREST is awesome :)

It turns out that most of what is usually expressed in implementation code assuming that you're hitting a dumb backend is just as well-served by SQL functions and schemas. This probably breaks down for larger projects, but it certainly has its place, and I can imagine something very similar be done for GraphQL.

brandur··on Is GraphQL the Next Frontier for Web APIs?
So I think it's a bit of a misconception that GraphQL is going to essentially map to SQL in the backend. Essentially, it's up to the service provider to decide what query paths and mutations are available in GraphQL, and design their schema accordingly.

So for example, if you allowed "comments" to be queried within a "user", you'd make sure that users could be looked up efficiently by their ID, and that comments could be loaded in bulk efficiently based on user ID. You'd also make sure that your implementation for both those operations is secure.

It's not too dissimilar to REST in that you're still very much designing what your API should look like and not exposing anything else.

brandur··on Is GraphQL the Next Frontier for Web APIs?
> I'm a major REST advocate (spoken at conferences, written about it in books, etc) and I've been using GraphQL for a few months now and after an initial learning curve I love the flexibility.

It's good to hear that there are some REST people that are open to potential alternatives :)

> I've been writing my APIs as GraphQL first. Then putting a very light wrapper around GraphQL to expose a REST interface. The REST interface is gold standard (HATEOAS, Json-API, etc) yet it is only a few lines of code. I just have a dictionary of REST -> GraphQL mappings and transform the GraphQL result to Json-API.

I'd certainly agree there. This could change in a year or two, but right now REST-ish APIs are still indisputably dominant. If you want to maximize your developers' experience, it's still too early to _require_ that they use GraphQL because there are going to be a lot of shops out there that are just not set up for it. Of course there is still the option of providing your own libraries and tooling for your users to go through, and if you go with that then the API's implementation is much less important.

brandur··on Is GraphQL the Next Frontier for Web APIs?
> I find it a particularly odd design choice to not make GraphQL spec match the JSON spec.

I can't speak for the original authors, but I can kind of understand it just by virtue of the fact that JSON is quite an ugly format that's hard to write for humans and comes with plenty of opportunity for error (missing quotes in places and the like). Their language also allows the introduction of some higher level semantics like an `Int!` to indicate that an argument can't be null.

Finally, GraphQL's query language has one major feature that makes it worth alone: you can comment things! This is something that you could never hope to do in JSON :/

brandur··on Is GraphQL the Next Frontier for Web APIs?
> The "single entry point" and "describe what you want, you'll get what you described" mindset makes it powerful, when used with the graphiql trial and error interface. We barely have to document anything anymore.

+1. It seems to me that another big advantage is speed of implementation. No matter how good your web stack is, implementing a whole bunch of separate HTTP endpoints tends to be fairly verbose and slow, and each should probably be tested thoroughly in separate modules. GraphQL mostly involves mapping data available in the GraphQL API to how it should be fetched in the backend. Lots of huge opportunities for sharing and reusing code, which is especially good for internal work where you don't necessarily need all the bells and whistles.

brandur··on Is GraphQL the Next Frontier for Web APIs?
> Nah, the next frontier is more likely everyone fully consolidating around REST as it stands today. This looks like movement for movement's sake, instead of improving developer ergonomics in an increasingly predictable world.

I certainly agree with the plug idea -- consistency is very good -- but I think that we should really consider what REST is actually buying us at the end of the day.

Most people prefer to integrate through a well-maintained SDK where one is available rather than shelling out to HTTP directly (imagine calling the APIs of something like AWS over raw HTTP), and if that's fairly widespread, it might not be too bad of a thing to start moving the underlying transmission protocol of those SDKs over to something that's more flexible and more efficient (like GraphQL, but also maybe other things).

A comparable analog might be when Google experimented with replacing TCP and TLS with a new protocol called QUIC that operates over UDP [1]. Because QUIC still exposes an HTTP/2 API, providers and server-side infrastructure could potentially move over to it relatively painlessly.

[1] https://ma.ttias.be/googles-quic-protocol-moving-web-tcp-udp...

brandur··on Is GraphQL the Next Frontier for Web APIs?
> GraphQL I think is meeting a similar need but with the added advantage that it was designed for the task at hand, mostly not by a committee.

Right on. I think that its early strength of opinion and design and having a spec available from the get-go is one of GraphQL's big strengths.

There are lots of ideas about how to use REST and HTTP correctly, but for the most part the only things that are universally agreed on are that URLs are _usually_ resources (you can find lots of cases where they're not even in APIs that are popularly thought to be well designed) and that HTTP verbs _should_ map to CRUD (but again, they often don't because ideas like `PATCH` only became widespread quite late in the game).

brandur··on Is GraphQL the Next Frontier for Web APIs?
> By Betteridge's Law of Headlines, the answer is "No".

I feel a little bad for phrasing a title like a question, but an alternative working title was "The Future of API Paradigms". I tried to touch on a variety of possible paths beyond GraphQL, including that REST might be the right way forward.

> REST describes the architecture of the web, which most websites already conform to. Developers could design web APIs more like web pages, but standard media types must be adopted first. JSON-LD is a strong contender at that.

Yes, quite possible, but it seems to me that REST and hypermedia aren't actually buying us all that much when it comes to APIs. Theoretically it makes them more discoverable and future proof, but in practice I find that no one really uses these features, and even when they're available, they're often used improperly.

On the other hand, something like GraphQL has some pretty significant advantages in the form of very flexible querying and very efficient message transport (you get everything in one call instead of _N_).

brandur··on Is GraphQL the Next Frontier for Web APIs?
It's probably not super popular to suggest that REST isn't the be-all and end-all when it comes to web APIs, but I'm interested in a future that lets us integrate with APIs more quickly and more safely. I'm interested to hear about what people think about the subject.

(I'm the author.)

brandur··on Modules vs Microservices
Transactions certainly make it easier to maintain global consistency, but one possible contradiction with the above is that if your modules are sharing transactions, then your boundaries are no longer narrow and well defined. By definition, your entire database and all its internal workings are now part of the interface.

This is one problem that I've observed with all the monoliths I've worked on. Because modules are colocated and sharing a database is easy, eventually somebody will do it (even if it wasn't originally intended), and you get lots of ostensibly modular code intertwined with other modules in non-obvious and subtly problematic ways.

brandur··on Google Cloud SQL for Postgres
So this will be far from exhaustive but ...

Both RDS and Heroku are aimed more at more modestly sized database in that you don't really scale beyond the vertical capacity of a single node. The prices are relatively comparable with RDS starts at around $20-30 a month depending on the instance type and Heroku Postgres at $50/month. Both services will get you an HA feature that allows for better uptime through automatic node failover.

Overall Heroku Postgres will probably feel a little like the Heroku platform: a little more polished and a little more "managed", but with fewer knobs to tweak, which can be both good and bad depending on your situation.

It's too early to say how Google's offering will shape up, but it'll likely be in the same vein as these first two. Lack of HA probably means that you should limit your production use of it, although it seems that the team intends to implement that eventually based off the service's documentation and other comments here.

Citus and Aurora come into play when you're looking to scale beyond a single node. Citus Cloud starts at $990 a month so you're not likely to come into it without some non-trivial requirements. Aurora is similar idea.

Citus' killer feature over something like Aurora is that instead of going ahead and forking Postgres wholesale, the product runs as an extension, which means that you're likely to get better compatibility going forward with new Postgres features.

Aurora is "compatible" which means that you'll be able to use psql and get access to common functionality, but are likely to see a divergence in support features. A similar situation is Redshift, which deviated around Postgres 8.0.2 [1], and at this point it's safe to say that it will never catch up.

[1] http://docs.aws.amazon.com/redshift/latest/dg/c_redshift-and...

brandur··on Plex Media Server on Cloud
> Google Drive and Dropbox have shown in the past that they're fine with you storing copyrighted content, you just can't share copyrighted content through their platform.

Is there some kind of reference you can point at to support this pretty wild claim?

Even if true, this seems the kind of informal policy that could change on a whim.

brandur··on Airbnb raises $1B at $31B valuation, became profitable in 2016
The company isn't compelled in any way to allow this though, and is actually disincentivized from doing so because it increases the probability of key departures as those people are able to extract some value.

If you're in such a position, you better hope that your founders _really_ like you.

brandur··on Learning from Terminals to Design the Future of User Interfaces
Yeah, I think there's some truth to this.

When I look at games in particular, I'm amazed that you can have AAA titles that get hotfixes for bad bugs on pretty much the day they're released. This is made possible by sophisticated content distribution networks like Playstation's.

Twenty years ago your pressed a master disk, crossed your fingers, and tossed it to the wolves. If there was ever a serious problem discovered after release, it would be a huge hit to your bottom line to ever have to try and recall everything that went out.

Testing must have been much more comprehensive before to make the old system workable.

← PreviousPage 6 of 11Next →