Live data from Hacker News

We decided to go for the big rewrite

tech.channable.com

31–40 of 75 posts

Re: We decided to go for the big rewrite

#31
Rewriting an application can mean different things:

1. "We are going to start over from scratch and rewrite the whole thing!"

Joel Spolksy famously said to "Never do this!"

2. "We are going to slowly refactor the whole codebase."

This can, eventually, lead you to a place where none of the original code is there so it's like a rewrite but much simpler.

3. "We are going to slowly add new places to replace the old system till there is no new system."

This is called the "Strangler App" model as described by Martin Fowler (https://martinfowler.com/bliki/StranglerFigApplication.html)

Granted, for some reason, it seems that "I retired a legacy system and rolled out a brand new one" seems to look better on a resume than "I refactored a legacy system into a better system." so your YMMV.

Re: We decided to go for the big rewrite

#32
This begs the question: in which situations is it appropriate to decide on a full rewrite?

In theory, there is an easy answer to this question: If the cost of the rewrite, in terms of money, time, and opportunity cost, is less than the cost of fixing the issues with the old system, then one should go for the rewrite.

In our case, the answer to all of these questions was yes.

One of our original mistakes (back in 2014) had been that we had tried to “future-proof” our system by trying to predict our future requirements. One of our main reasons for choosing Apache Spark had been its ability to handle very large datasets (larger than what you can fit into memory on a single node) and its ability to distribute computations over a whole cluster of machines4. At the time, we did not have any datasets that were this large. In fact, 5 years later, we still do not. Our datasets have grown by a lot for sure, both in size and quantity, but we can still easily fit each individual dataset into memory on a single node, and this is unlikely to change any time soon5. We cannot fit all of our datasets in memory on one node, but that is also not necessary, since we can trivially shard datasets of different projects over different servers, because they are all independent of one another.

With hindsight, it seems obvious that divining future requirements is a fool’s errand. Prematurely designing systems “for scale” is just another instance of premature optimization, which many development teams seem to run into at one point or another

Re: We decided to go for the big rewrite

#33

Reading this article it seems like yet another example of "you don't have big data". Most of the features that are unique to Spark (or Spark-like setups) were not needed, so in the end it's mostly...just an app talking to Postgres? I'm not sure, but reading other articles[0] on the blog seems like they've been jumping on bandwagons before, so it's probably good to come back on those decisions every now and again. Edi…

There's that, but Spark is also a little bit tricky because it has such a big feature set that it's not just attractive as a big data tool. On paper, it can be attractive as a tool for easy single-node data parallelism, for easy streaming data processing, for easy machine learning on the Java platform, stuff like that. I'm looking at migrating off of Spark, too, and finding that Spark is still the only way to get a decently ergonomic (for developers) data table library on a Java language.

So there's all of that stuff, and then you think, "Oh, and it gives us an easy scaling path if we ever find our data volumes growing at an unexpectedly rapid clip." And at first you think it's just a cherry on top.

It may seem too good to be true at first, but with everyone using it, and with most the alternatives looking like they'll involve at least as much dev effort during the initial analysis, it's pretty easy to miss that.

And it's only a while later, when you're already pretty heavily invested in the ecosystem, that you start to really understand some things that the bloggers and book authors don't talk about in public. Like how Spark makes Big Data and scale-out a self-fulfilling prophecy. You will need to scale out, even if your data should fit in memory, because Spark wastes memory like a 22-year-old football player wastes money.

And maybe you're an appropriately cynical jerk, and can therefore spot that it couldn't possibly live up to the hype from a mile away. Congratulations. Hopefully you're the technical lead. Even if you are, though, too bad, because, nobody else in the meeting room is as jaded about tech as you are. Certainly not the management folks who don't program or have been out of the game for years. And, since you are cynical and jaded, that means there's still a good chance you'll go with Spark anyway. Because that's a hard argument to win - unless you've already been burned by Spark in the past, you aren't going to have enough intimate knowledge to make an argument that's concrete enough to sound convincing. And because this isn't the hill you want to die on. And because, being appropriately cynical, you realize that, at the end of the day, it's not really your problem. Spark will get the job done. It'll be inefficient, sure, but the extra server and development costs aren't coming out of your pocket, they're coming out of the pocket of the person who wants to be using Spark.

Re: We decided to go for the big rewrite

#34

Our company runs on a pile of VBA/Access. At least it talks to a MariadDB server on Linux. The biggest problems are trying to run/develop this code on machines that were made in the last ten years, the other is that it's a horrible, horrible codebase. Code practices from the early 90's. To make things worse, objects are 'evil', all HTML/SQL/XML is built by appending strings, there's no data sanity checks..... I start…

Ah... The fine line between "better the devil you know" and "I don't understand the options so every change is too scary".

Re: We decided to go for the big rewrite

#35
This is a story of one of my first product launches. And inevitable rewrites that ensued. You can read more of it here: https://jeremyaboyd.micro.blog/2016/11/05/my-first-product.h...

Years ago I was building SEO software. One of the products was originally written as an internal tool, and handled our work load without skipping a beat. Then we decided to release it to the public, so I did a small refactor to implement accounts. We launched with it on hosted on a small Dell PC under my desk (where it had been running as our internal tool). Within 2 hours of launch, it was completely overwhelmed and shutting down due to overheating.

It was "rewrite" time.

While doing that, I had to come up with SOME work around. So I opened the case and stuck a box fan on it to try and exhaust some of the heat. That lasted about 8 more hours. Before the server shut down, and I got a call from the boss.

I went in to the office in the middle of the night, and started profiling the application. I found a VPS host, quickly spun up their largest Windows VM they offered, and that helped for a few days while I rewrote large swaths of the application. Even after a ~80% rewrite and splitting the application in two, we had more users that we'd ever anticipated and I was out of my depths with scaling. So we got a few (much larger) physical servers at Softlayer.

This was the setup that this website ran under for the next couple of years with minor tweaks, more space with an iSCSI array, more RAM, migrating to a more CPU, etc, but all staying at Softlayer. Eventually when the hosting bill was getting into the high four figures a month, we reevaluated and decided a rewrite was in order to switch it to Microsoft Azure utilizing Azure SQL, Azure Table Storage, Azure Queue Service, and offloading all of the complicated tasks from the web server onto the Azure infrastructure. For all I know it is still on Azure.

Re: We decided to go for the big rewrite

#36
post #20

Earlier quoted context omitted.

The on-prem is windows-based, we're delivering new version as msi. The goal of the cloud version is be easier to get up and running, since there's no installation steps and (I guess) less configuration to do. The company might want the on-prem to fade, but it won't happen in the short term since we still have clients. The on-prem is 15-20 years old, but not always actively worked on and with ~1M Loc (including sql sc…

Thanks for the info. I am involved with a Windows based product and we've thought now and again about doing something like this. We have a competitor that is browser and cloud based but the product seems to be a lot less featured. It feels like they are quite limited in what locally connected hardware (cameras, modems, card readers, barcode readers, printers and scanners) they can interact as well as seamless bridges…

I'm afraid I wasn't clear, it's installed on Windows server and user access it via Internet Explorer (because of ActiveX, in theory we'll do the switch for Chrome soon). To interact with card readers, cameras and printers, we're using a bunch of extension, including a java applet (!) that we'll have to migrate.

Re: We decided to go for the big rewrite

#37
post #10
post #3

Earlier quoted context omitted.

I'd like to see some idea of what they mean by big. An order of magnitude in terms of lines of code and the number of engineers they had for the job and how long it all took versus how long the original took to write etc. One of the things that scares me about something like this are all the seemingly illogical bits of code that were added over time and are actually that way for a reason because they fix some edge ca…

>I'd like to see some idea of what they mean by big. An order of magnitude in terms of lines of code and the number of engineers they had for the job and how long it all took versus how long the original took to write etc. Yeah, at my last place before I left, they were looking to do a rewrite of their main project that had been the result of years of hundreds of developers working on it. The time-scale was wooly, bu…

What prompted everyone to want to rewrite so much code?

Re: We decided to go for the big rewrite

#38
post #37
post #10

Earlier quoted context omitted.

>I'd like to see some idea of what they mean by big. An order of magnitude in terms of lines of code and the number of engineers they had for the job and how long it all took versus how long the original took to write etc. Yeah, at my last place before I left, they were looking to do a rewrite of their main project that had been the result of years of hundreds of developers working on it. The time-scale was wooly, bu…

What prompted everyone to want to rewrite so much code?

They were on a system where if bugs existed past a certain date of them being logged, their was financial penalties that had to be paid.

Also adding new features was incredibly slow, painful and dangerous. Even a minor change resulted in so much manual regression needing to be done. It was absurd.

Re: We decided to go for the big rewrite

#39

Reading this article it seems like yet another example of "you don't have big data". Most of the features that are unique to Spark (or Spark-like setups) were not needed, so in the end it's mostly...just an app talking to Postgres? I'm not sure, but reading other articles[0] on the blog seems like they've been jumping on bandwagons before, so it's probably good to come back on those decisions every now and again. Edi…

There's that, but Spark is also a little bit tricky because it has such a big feature set that it's not just attractive as a big data tool. On paper, it can be attractive as a tool for easy single-node data parallelism, for easy streaming data processing, for easy machine learning on the Java platform, stuff like that. I'm looking at migrating off of Spark, too, and finding that Spark is still the only way to get a d…

Curious what you recommend instead of Spark.

Re: We decided to go for the big rewrite

#40

Reading this article it seems like yet another example of "you don't have big data". Most of the features that are unique to Spark (or Spark-like setups) were not needed, so in the end it's mostly...just an app talking to Postgres? I'm not sure, but reading other articles[0] on the blog seems like they've been jumping on bandwagons before, so it's probably good to come back on those decisions every now and again. Edi…

> "Sure, Scala will work great! It's future-proof and everyone will love it!"

Scala is still the least-bad option for a JVM language.

Anyone who can't be productive in Scala (not "better java", not "worse haskell", Scala) isn't someone you want on your team anyway.

Post reply on HN