Large-Scale Systems. Cloud Deployment. Hosts: Shelley and Rob. Cloudadorn Academy. Shelley: About three times what the spare room used to cost her, electricity and internet line included. That's the first bill for the computers my friend Jo now rents from Amazon by the hour, and she rang me on Tuesday before she'd got to the bottom of it. Rob: Three times? What did she think she was going to be paying? Shelley: Less, because everyone told her renting would be cheaper than owning. She runs Studio Hop, a class-booking app for yoga and spin studios, and Jo, the app and her brother Sam are all invented for the show, though you'd never guess it from how much she worries. Last month Sam, who writes all the code, moved the whole thing out of her spare room. Half the lines on the bill she couldn't explain to me or to herself. Rob: Then let's go through the lines with her, because each one is a decision Sam made, mostly without noticing he was making it. Start with what she's renting. In the spare room, Studio Hop was five real computers, a little box that cabled them together, and a router that connected the lot to the internet. Shelley: Sam's cable spaghetti. Jo used to hide it behind a yoga mat when her in-laws came round. He says there's no spaghetti at all now, which I don't quite believe. Where did it go? Rob: Every one of those physical things turned into a setting on a web page. The cables and the router became a private network Sam draws on screen. And each computer became a virtual machine, which is a slice of one of Amazon's enormous computers that behaves exactly like a whole computer of its own, with its own address. Shelley: So it's the same five computers, just rented ones living in somebody else's building. Did Sam have to rewrite Studio Hop to make it fit in there? Rob: He didn't change a single line. Studio Hop is already split into three separate programs, one for bookings, one for payments, and one that sends the reminder emails, and all three moved across exactly as they were. Sam kept the same shape and changed only the ground under it. Shelley: Then I don't see what Jo got for her money, if nothing changed except the address. Rob: Speed, mainly. A new computer used to mean ordering one and waiting weeks for it to turn up. Now it means filling in a form and waiting a few minutes, which is lovely right up until somebody forgets one. Shelley: That speed is the first thing Jo's cross about, actually. On the Friday, Sam made a complete second copy of Studio Hop to try out a change, and then he forgot about it. It sat there doing nothing until Monday. Rob: And it billed all weekend. A rented computer costs the same per hour whether it's booking a thousand classes or sitting idle. In the spare room, a box doing nothing only cost Jo a bit of electricity. In a rented account, a box doing nothing is a line on the bill. Shelley: But the whole pitch was that you only pay for what you use. Everyone says it. Was I just wrong to believe them? Rob: You pay for what you've switched on, whether you meant to or not. The good half of that pitch is real, though. At nine on a Monday, when the popular studios put next week's classes up and everyone piles in, Sam can rent four extra computers for the rush and hand them back an hour later. Shelley: In the spare room he'd have had to buy those four and keep them all year, for one hour a week. So the growing and shrinking is the bit that saves money, as long as somebody remembers to do the shrinking. Is that a Studio Hop problem, or do big companies forget too? Rob: Big ones too. Amazon's own customer page about VPBank, a bank in Vietnam, says it had to build this kind of cost watching during its move. One piece was a schedule for when its rented databases ran, which cut that part of its bill. That's the seller telling the story, so I'd take it as a lesson rather than proof. Shelley: So what do I tell Jo? Check under the bed every Friday night for anything Sam left running? Rob: Let a machine do the checking for her. She can set a monthly budget in the account and get an email when spending looks odd. And Sam can put every test copy on a timer, so it switches itself off each evening. Shelley: The biggest single line is something called a managed database. Sam swears it's worth every penny. Jo wants to know why it costs more than the computer it replaced. Rob: Because she's paying someone else to do Sam's three in the morning jobs. In the spare room, Sam installed the database himself, put the security fixes on, took the backups, and got woken up when it fell over. With a managed database, the provider does the fixes, the backups and the recovering, and Sam only uses it. Shelley: That sounds like an obvious yes to me. Though Sam was defending it a bit too hard, so I suspect there's a downside he didn't mention. Rob: He gives up control. He can't get into the machine underneath and fiddle with it, and upgrades happen when the provider decides, not when he does. Shelley: Sam hates being told when. But he'd put up with it to sleep through the night. Is that all he's giving up? Rob: There's one more. The more Studio Hop leans on pieces only Amazon sells, the more work it is to ever move somewhere else, because leaving means rebuilding each of those pieces. Shelley: Sam's an all-or-nothing person. Now that he's discovered this, I can see him renting every single piece they sell. Rob: I'd slow him down, because you decide one piece at a time. Patching a database is a chore no member ever notices, so renting it is easy to defend. But the parts only Studio Hop has, like how a studio sets its prices or who gets the last spot in a full class, are what members come for, and those Sam should keep. Shelley: Jo would say the thing that makes Studio Hop itself is her answering the phone at seven in the morning. But fine. I'll tell Sam to write one sentence for each rented piece, saying why it's rented and not his. Shelley: The line Jo did understand was the one that annoyed her most. The reminder emails go out twice a day, in the evening for the next day's classes and early morning for that day's. And the reminders program has a computer to itself, running all day and all night, to do it. Rob: That's exactly the job for what's called serverless. Instead of renting a computer that waits, Sam hands Amazon the reminder code and says run this at six in the morning and six in the evening. It runs, Jo pays for the seconds it ran, and the rest of the day she pays nothing for it. Shelley: Then why isn't everything done like that? Put the booking page on it too and the bill drops to almost nothing. Rob: Because when the code hasn't run for a while, nothing is sitting ready, and the first run has to be set up from scratch. Amazon's own documentation calls that wait a cold start, says it lasts from under a tenth of a second to more than a second, and says it happens more to code that runs rarely. Shelley: A second doesn't sound like much. But at nine on a Monday, when someone is trying to grab the last bike in a spin class before her friend does, a second is a very long time. Rob: And there's a second problem. Each run starts with no memory of the last one, so whatever the booking page keeps track of, like who is halfway through paying, would have to live somewhere else. Work that runs all day and has to answer instantly belongs on a computer that stays on. So the reminders are the first thing I'd try moving, and the booking page stays put. Shelley: Then there's a line called a standby database. Sam set that up because he's still scarred from the morning in the spare room when the database box died and nobody could book anything until lunchtime. Rob: The standby is a second copy of the database, already switched on in a separate building, taking every change the moment it happens. If the first one dies, Amazon's own page for that service says it can switch everyone across in as little as a minute. The price is that Jo pays for a second database every quiet day. Shelley: Jo asked me whether there's a cheaper way to be safe. Her words were that she'd rather be down for a morning once a year than pay for a second database every single month. Rob: There is. Every night you take a snapshot of the database and put it in cheap storage, which costs very little to keep. Bringing it back means setting up a new computer and loading the snapshot, and that takes hours. Whether Studio Hop can afford those hours is a business question, so it's Jo's call. Shelley: Except Sam now says they need both, the standby and the snapshots. Which sounds to me like paying twice for the same safety. Rob: They protect against different accidents. The standby helps when a computer dies or a building loses power, but it copies everything, mistakes included. If Sam types a bad command that wipes one studio's timetable, the standby wipes it too, a moment later. Only last night's snapshot still has the classes in it. Shelley: So the standby is for when the building breaks, and the snapshot is for when Sam breaks something. I'm going to tell him it exactly like that, and he's going to hate it. Rob: He'll hate the next question more, which is whether he's ever actually switched over to the standby on purpose, on a quiet afternoon, to see that it works. If he hasn't, nobody knows what happens on the morning it's needed. Shelley: Jo asked one thing I couldn't answer. If Studio Hop lives in Amazon's buildings now, is keeping it secure their problem? Because she'd find that a huge relief. Rob: Partly. Amazon has a page that spells out the split. Amazon looks after the buildings, the computers, and the software that carves them into slices. Sam still has to keep the software on his own virtual machines up to date, decide who's allowed into the account, and look after the members' details. Shelley: So if a door gets left open, it's still Sam's door, even though he's never seen the building. Rob: Yes, and it's easy to leave one open, because in a rented account a door is a checkbox on a web page. That forgotten weekend copy is a good place for him to start, since nobody was looking after it at all. Shelley: Jo feels like she's playing at this, a booking app for a handful of studios on the same rented computers as enormous companies. She half expects to hear that the big ones still run their own buildings. Rob: Plenty have left their buildings. Amazon's customer page about Capital One, the American bank, says it closed eight of its own data centres, the buildings where a company keeps its computers. It says setting up a place for its programmers to test things went from about three months to minutes. It's the seller's page, so trust the direction more than the figures. Shelley: That's Sam's weeks-to-minutes again, just at a bank's size. Does the bank sign up for the same downside Jo just did? Rob: The same one. They can grow and shrink whenever they like, and in return they live with Amazon's prices and Amazon's bad days. If Amazon's building has a bad day, Studio Hop has one too, and if the prices go up, so does Jo's bill. Shelley: Jo has set a budget alert a little above what next month ought to cost, and Sam owes her one sentence for every line on the bill saying why it's switched on. Rob: Then the weekend test copy has about one sentence left to live.