Live data from Hacker News

We migrated our PostgreSQL database with 11 seconds downtime

gds.blog.gov.uk

171–180 of 210 posts

Re: We migrated our PostgreSQL database with 11 seconds downtime

#171
post #111

Earlier quoted context omitted.

Data scientists... And when you look at the query, it'll be 800 lines of SQL...

Heh, that's not so bad - 2 jobs ago I had to fix a KPI generation process that was 70k lines of dynamic sql, that unwrapped to up to 1m LOC :)

Did you ever run into a hard limit of statement size?

Re: We migrated our PostgreSQL database with 11 seconds downtime

#172

Interesting, though I have no idea why the government is using AWS in the first place. This isn't a startup hacking away trying to find PMF, or dealing with unpredictable marketing-driven traffic spikes. We know we need these services running long term, and can make solid predictions about usage patterns. We could build a public sector cloud and/or adopt a sensible on-prem approach. This requires funding, coordinatio…

Disclaimer: I work in the public sector. If you really think the public sector could build anything closely resembling any cloud, you are dreaming. Imagining that one cloud working for the entire public sector, we are entering delusional territory here. Public sector projects are insanely expensive, take ages to develop and often flat out fail. Not only that, we are starved for engineers even now. If we ran such a cu…

Oh I totally understand that. Public sector IT is littered with failed projects, massive overspends and lasting functional problems. There are numerous examples from the last few years alone - hundreds of millions spent on broken software. I used to work in public affairs and followed a lot of those projects closely.

I don't think this means "government = bad at tech" though. You sometimes see smaller in-house teams do really good work. The biggest issue seems to be with contracting and procurement policy. For example, on the Police Scotland i6 program they hired a bunch of consultancies to write a tender document, and then hired CGI for the final project. That turned out to be a copy of the Spanish system, which turned into a huge and expensive disaster as the requirements differed.

Feels like government has a similar problem to a lot of legacy non-tech companies. They don't have much technical leadership, don't understand the problem, and decide to hand it off to the lowest bidder. Doesn't help that they are often legally obliged to act this way. But the underlying engineering problems aren't unsolvable, and don't need to become a huge mess every time. (Your point about recruitment is fair though)

Re: We migrated our PostgreSQL database with 11 seconds downtime

#174
post #47
post #30

Now all we need is for Amazon to come out with a "government-as-a-service" product for your budding nation state.

FWIW GOV.UK Notify is part of a suite of services offered by GDS to UK public sector bodies (along with GOV.UK Pay and GOV.UK PaaS) that was originally known as "Government As A Platform".

…and the platform is all open source, so people are free to fork / steal. https://github.com/orgs/alphagov/repositories?q=paas

Re: We migrated our PostgreSQL database with 11 seconds downtime

#176

Earlier quoted context omitted.

Database changes are typically one-way. If your new change includes creating or modifying a table, such that there are new additional columns, and you populate those with data, then downgrading would destroy the changed columns and the data in them. Hence you can't downgrade once you upgrade or you'd potentially be breaking things. To downgrade safely you'd need to backup or snapshot the old database, and then restor…

DB schema migration script frameworks (at least in Python, Ruby & Java lands) do typically support both upgrade and downgrade directions. People skip implementing and testing the downgrade side if the development model doesn't need it but the problem of what happens to the data is controlled by what you put in the "down" migration script. I'd guess if you can't throw the data away, you won't do a down migration, you'…

Database migrations are always "fail forward" if there's an error you figure out what it was and fix it.

Re: We migrated our PostgreSQL database with 11 seconds downtime

#177
post #166

Interesting, though I have no idea why the government is using AWS in the first place. This isn't a startup hacking away trying to find PMF, or dealing with unpredictable marketing-driven traffic spikes. We know we need these services running long term, and can make solid predictions about usage patterns. We could build a public sector cloud and/or adopt a sensible on-prem approach. This requires funding, coordinatio…

As a startup, my reason for using "cloud" (PaaS) is not to catch spikes, but because of focus. Every hour that I spend running around with HDDs, screwdrivers (or the cloud version thereof - storage, ansible, etc) is an hour that I'm not spending on stuff my customers need. Why would this be any different for a government? We don't expect our government to build their own cars, but to buy them from Volkswagen or Renau…

Because the government is not a corporation and it's obligations are different from the private market.

Re: We migrated our PostgreSQL database with 11 seconds downtime

#178

Earlier quoted context omitted.

Database changes are typically one-way. If your new change includes creating or modifying a table, such that there are new additional columns, and you populate those with data, then downgrading would destroy the changed columns and the data in them. Hence you can't downgrade once you upgrade or you'd potentially be breaking things. To downgrade safely you'd need to backup or snapshot the old database, and then restor…

DB schema migration script frameworks (at least in Python, Ruby & Java lands) do typically support both upgrade and downgrade directions. People skip implementing and testing the downgrade side if the development model doesn't need it but the problem of what happens to the data is controlled by what you put in the "down" migration script. I'd guess if you can't throw the data away, you won't do a down migration, you'…

> DB schema migration script frameworks (at least in Python, Ruby & Java lands) do typically support both upgrade and downgrade directions.

They do, and in every shop I've ever been in these are considered a trap precisely because they don't consider data loss.

Always roll forward. If you have to change migration history, restore a backup and lament past you's hubris.

Re: We migrated our PostgreSQL database with 11 seconds downtime

#179

Interesting, though I have no idea why the government is using AWS in the first place. This isn't a startup hacking away trying to find PMF, or dealing with unpredictable marketing-driven traffic spikes. We know we need these services running long term, and can make solid predictions about usage patterns. We could build a public sector cloud and/or adopt a sensible on-prem approach. This requires funding, coordinatio…

The government likely hired a consulting firm and AWS was part of the solution proposed and bought.

Re: We migrated our PostgreSQL database with 11 seconds downtime

#180
post #16

Earlier quoted context omitted.

AWS has a G-Cloud for UK just like they have one for US, no?

No. It is only relatively recently (~5/6 years) AWS have had any data centres in the UK. That blocked use of AWS for a lot of UK departments due to data sovereignty concerns.

I see. I don't use AWS much, I saw this [1] and assumed this was like the US g-cloud.

[1] https://aws.amazon.com/government-education/g-cloud-uk/

Post reply on HN