HN user

pgr0ss

675 karma

http://www.pgrs.net/

Posts47
Comments33
View on HN
github.com 7mo ago

Advent of Management

pgr0ss
5pts0
www.pgrs.net 1y ago

Double-Entry Ledgers: The Missing Primitive in Modern Software

pgr0ss
56pts18
www.pgrs.net 1y ago

Double-Entry Ledgers: The Missing Primitive in Modern Software

pgr0ss
3pts0
www.pgrs.net 1y ago

Visualizing Financial Data with DuckDB and Plotly

pgr0ss
1pts0
www.pgrs.net 1y ago

A Ledger in PostgreSQL Is Fast

pgr0ss
4pts0
blog.heroku.com 1y ago

The Next Generation of the Heroku Platform

pgr0ss
3pts0
www.pgrs.net 1y ago

DuckDB over Pandas/Polars

pgr0ss
56pts42
www.pgrs.net 2y ago

The Many Ways to Read Tech News

pgr0ss
1pts0
www.pgrs.net 2y ago

DuckDB as the New jq

pgr0ss
364pts73
www.pgrs.net 2y ago

Lessons Learned from Payments Startups

pgr0ss
2pts0
www.pgrs.net 3y ago

ULID Identifiers and ULID Tools Website

pgr0ss
1pts0
en.wikipedia.org 3y ago

Three Sisters (Agriculture)

pgr0ss
2pts0
medium.com 6y ago

General Availability of Braintree GraphQL API

pgr0ss
8pts0
quan.io 6y ago

Deploying Phoenix to Kubernetes from Scratch

pgr0ss
3pts0
medium.com 7y ago

A Year on TC39: Dispatches from the Future of JavaScript

pgr0ss
8pts1
medium.com 7y ago

Continuous Deployment Isn’t Just for Applications

pgr0ss
3pts0
blog.drewolson.org 8y ago

Dependency Injection in Go

pgr0ss
2pts0
www.braintreepayments.com 8y ago

GraphQL at Braintree

pgr0ss
5pts0
www.pgrs.net 9y ago

Dropwizard Can Be Simple

pgr0ss
2pts0
www.buzzfeed.com 10y ago

Steal a Credit Card – Buy a Hoverboard

pgr0ss
2pts0
www.pgrs.net 10y ago

Java REPL with JShell and Bazel

pgr0ss
1pts0
www.pgrs.net 10y ago

Migrating from Gradle to Bazel

pgr0ss
4pts0
blog.drewolson.org 11y ago

Elixir Streams

pgr0ss
152pts16
techcrunch.com 11y ago

Braintree Now Lets Merchants in Europe Sign Up with an Email, a URL and a Blurb

pgr0ss
1pts0
www.youtube.com 11y ago

Astronomer Seth Shostak: We'll find ET by 2037 [video]

pgr0ss
1pts0
www.braintreepayments.com 12y ago

Safe Operations For High Volume PostgreSQL

pgr0ss
4pts0
www.braintreepayments.com 12y ago

Braintree Ignition - The $50k boost for your business

pgr0ss
23pts3
www.forbes.com 12y ago

In World's Best-Run Economy, House Prices Just Keep Falling

pgr0ss
2pts0
fteproxy.org 12y ago

Fteproxy | protocol misidentification made easy

pgr0ss
2pts0
www.braintreepayments.com 12y ago

Development Hacks to Prevent Mistakes

pgr0ss
8pts0

My idea for for this to add metadata to the transfers, likely with a jsonb column. But I agree that the ledger won't encompass everything. You would still have other database tables and then you'd store domain identifiers in the ledger and/or ledger identifiers in your other tables.

I think that's a fair point. Unnesting arrays in SQL can be annoying. Here is your first example with duckdb:

  duckdb -c \
    "select * from ( \
      select unnest(assets)->>'browser_download_url' as url \
      from read_json('https://api.github.com/repos/go-gitea/gitea/releases/latest') \
    ) \
    where url like '%linux-amd64'"

Hi, I’m the author of the blog post.

And it is bizarre to me that you could run a payments system without high-availability or immutability at its core.

I’m not sure what you’re referring to here as my post didn’t really go into these topics.

Also putting logs in a database alongside your core data is such a bad idea.

I’m not suggesting putting all logs into the database. I’m suggesting that for a certain type of info (that is often logged), I find it more useful to put it in the database instead.

For the first few years, we scaled vertically rather than horizontally. We still went through many rounds of scaling our single server, changing both hardware and software configs.

We were reluctant to do automatic failover as well, since we all hear horror stories about automatic failover causing more problems than it solves. However, we changed our minds this summer for a couple of reasons. One, our traffic continues to grow and people rely on us for payments. If our database server crashes in the middle of the night, we don't want our customers to have to wait for us to do manual failover. Two, we felt a lot more comfortable with Pacemaker and PostgreSQL streaming replication failover than we used to with DRBD. We did extensive testing and tweaking, and we believe we understand the failure scenarios.

One of the best metrics is the log of slow queries. We set our threshold at 250 milliseconds, and we investigate queries that take longer. Sometimes, we'll see INSERT or COMMIT statements show up, which is usually an indication that our write performance isn't what it needs to be. We generate graphs from these logs (using graphite) and track them over time. We also use Munin (including the PostgreSQL plugins) to monitor disk IO and various PostgreSQL stats.

To be safe, we always rebuild the old master after we fail over to a synchronous standby server. We have capistrano tasks to automate it, so it's not too bad. The async servers merely follow the new server after the IP moves, so we don't need to do anything there.

Edit: We also don't increment the timeline on failover. Instead, we stop PostgreSQL, remove the recovery.conf, and restart.

Besides client side (javascript) encryption, Braintree supports Transparent Redirect (https://www.braintreepayments.com/developers/api-overview) which lets you post data directly to Braintree.

The nice part of sending the data to your servers with client side encryption is that you can do validation before sending to the payment gateway. For example, if you want to ensure everyone enters a cardholder name, you can validate the non-encrypted fields before eating the cost of calling a payment gateway.

You can do some of these validations in javascript, but javascript is error-prone (firebug) and not as flexible (have access to a lot more data server side).

We do use the sandbox and production git branches for those environments. If you want to puppet sandbox, you start with a git checkout sandbox. If you try to puppet sandbox from the production or master branch, you get a big warning and a prompt asking if you are really sure.

Is the replica set failover really zero-downtime for you? In our usage, it seems like it takes a few seconds to elect a new primary during which time no writes can occur.

GitHub Flow 15 years ago

Squashing commits can fix up git history, but it does not address the bigger issues: refactoring, lack of builds, and having to deploy multiple branches to test features. The first two make it very hard to do any significant code reworking on a feature branch.

GitHub Flow 15 years ago

I actually just wrote up a blog post as well about why I don't like feature branches: http://www.pgrs.net/2011/08/29/why-i-dont-like-feature-branc...

My main reasons are that git history gets messy, builds don't run on feature branches (although github seems to have a work around here), and refactoring is harder.

My opinions are largely based on working on larger projects (more than 10 devs working in the same codebase).

If you don't version, you can only add to an API. You cannot change anything meaningful (or as simple as renaming a field). You wind up with APIs with multiple ways of getting the same or similar data in order to avoid breaking backwards compatibility, which leads to bloated, confusing APIs.

Here are a few extra tips:

- "select relname, indexrelname, idx_scan from pg_stat_user_indexes" will show how many times an index is used, so you can remove unused indexes

- you can create indexes without locking tables (ie, while your site is up) by using "create index concurrently"

- you should use the autovaccuum daemon instead of manually running vacuum analyze in most cases