Most active commenters

    ←back to thread

    261 points tosh | 20 comments | | HN request time: 0.875s | source | bottom
    1. gwbas1c ◴[] No.42069673[source]
    Classic story of a startup taking a "good enough" shortcut and then coming back later to optimize.

    ---

    I have a similar story: Where I work, we had a cluster of VMs that were always high CPU and a bit of a problem. We had a lot of fire drills where we'd have to bump up the size of the cluster, abort in-progress operations, or some combination of both.

    Because this cluster of VMs was doing batch processing that the founder believed should be CPU intense, everyone just assumed that increasing load came with increasing customer size; and that this was just an annoyance that we could get to after we made one more feature.

    But, at one point the bean counters pointed out that we spent disproportionately more on cloud than a normal business did. After one round of combining different VM clusters (that really didn't need to be separate servers), I decided that I could take some time to hook up this very CPU intense cluster up to a profiler.

    I thought I was going to be in for a 1-2 week project and would follow a few worms. Instead, the CPU load was because we were constantly loading an entire table, that we never deleted from, into the application's process. The table had transient data that should only last a few hours at most.

    I quickly deleted almost a decade's worth of obsolete data from the table. After about 15 minutes, CPU usage for this cluster dropped to almost nothing. The next day we made the VM cluster a fraction of its size, and in the next release, we got rid of the cluster and merged the functionality into another cluster.

    I also made a pull request that introduced a simple filter to the query to only load 3 days of data; and then introduced a background operation to clean out the table periodically.

    replies(3): >>42070228 #>>42070679 #>>42072931 #
    2. alsetmusic ◴[] No.42070228[source]
    As much as you can say (perhaps not hard numbers, but as a percentage), what was the savings to the bottom line / cloud costs?
    replies(1): >>42070472 #
    3. gwbas1c ◴[] No.42070472[source]
    Probably ~5% of cloud costs. Combined with the prior round of optimizations, it was substantial.

    I was really disappointed when my wife couldn't get the night off from work when the company took everyone out to a fancy steak house.

    replies(1): >>42070695 #
    4. antisthenes ◴[] No.42070679[source]
    99% of the time, it's either a quadratic (or exponential) algorithm or a really bad DB query.
    replies(1): >>42070922 #
    5. chgs ◴[] No.42070695{3}[source]
    So you saved the company $10k a month and got a $200 meal in gratitude? Awesome.
    replies(5): >>42070984 #>>42071178 #>>42071275 #>>42071281 #>>42072406 #
    6. dd82 ◴[] No.42070922[source]
    can also be a linear algorithm that does N+1 queries. ORMs can be very good at hiding this implementation detail
    replies(1): >>42071567 #
    7. Cyphase ◴[] No.42070984{4}[source]
    What should they have gotten?
    replies(1): >>42071319 #
    8. bagels ◴[] No.42071178{4}[source]
    They're presumably already being paid a salary to do this work.
    9. ponty_rick ◴[] No.42071275{4}[source]
    They're more pissed about the 1.2M they spent than about the 10k a month they saved.
    10. _hyn3 ◴[] No.42071281{4}[source]
    > So you saved the company $10k a month and got a $200 meal in gratitude? Awesome.

    You seem to be assuming that a $200 meal was the only compensation the person received, and they weren't just getting a nice meal as a little something extra on top of getting paid for doing their job competently and efficiently.

    But that's the kind of deal I make when I take a job: I do the work (pretty well most of the time), and I get paid. If I stop doing the work, I stop getting paid. If they stop paying, I stop doing the work. (And bonus, literally, if I get a perk once in a while like a free steak dinner that I wasn't expecting)

    It doesn't have to be more complicated than that.

    replies(1): >>42071494 #
    11. tempest_ ◴[] No.42071319{5}[source]
    They are in theory owed nothing more than their salary but it can be very good for moral to reward that type of thing (assuming they are not introducing a perverse incentive)
    12. meiraleal ◴[] No.42071494{5}[source]
    Yeah? Well, proper rewards make those savings and optimizations more common. Otherwise most people will do the work needed just to have work tomorrow.
    replies(2): >>42071927 #>>42072237 #
    13. Quekid5 ◴[] No.42071567{3}[source]
    > a linear algorithm that does N+1 queries.

    That's what quadratic means.

    replies(2): >>42072056 #>>42072666 #
    14. Sohcahtoa82 ◴[] No.42071927{6}[source]
    It creates a perverse incentive to deliberately do things a more expensive way at the beginning and then be a hero 6 months down the line by refactoring it to be less expensive.
    replies(1): >>42072745 #
    15. sgerenser ◴[] No.42072056{4}[source]
    Typically implemented accidentally: https://www.tumblr.com/accidentallyquadratic
    16. groby_b ◴[] No.42072237{6}[source]
    Depends. There are people who put in the absolute minimum work they can get away with, and there are people who have pride in their profession.

    That's independent of pay scale.

    Granted, if you pay way below expectations, you'll lose the professionals over time. But if you pay lavishly no matter what, you get the 2021/2022 big tech hiring cycle instead. Neither one is a great outcome.

    17. ChadNauseam ◴[] No.42072406{4}[source]
    I'm not sure how they feel, but when it happens to me, it's not a big deal because it's my job to do things like that. If I fuck up and cost them $10k/month I'm certainly not going to offer to reimburse them.
    18. jon_richards ◴[] No.42072666{4}[source]
    Not really what they're talking about https://stackoverflow.com/questions/97197/what-is-the-n1-sel...
    19. fn-mote ◴[] No.42072745{7}[source]
    Ha ha, software developers already have this incentive. Viz: "superhero 10x programmer" writing unmaintainable code to provide some desirable features, whose work later turns out to be much less awesome than originally billed.

    Of course the truth is more complicated than the sound bite, but still...

    20. magundu ◴[] No.42072931[source]
    Great.

    It will be great if anyone write a checklist(playbook) to be checked for CPU, Memory, Disk, IO and network issues.