[Techtalk] Philosophical question: CPU/memory/disk cheaper than
magnio+lc-techtalk at pvv.ntnu.no
Tue Apr 10 07:36:06 UTC 2007
On 2007-04-09 19:51:22 -0700, Kelly Jones said:
> And now, a philosophical question:
> If I have a program that runs slowly (or hogs so much CPU/memory/disk
> that it slows other processes to a crawl), is it cheaper to:
> % Work to re-code the program to be more efficient and use less resources?
> % Increase the amount of CPU/memory/disk I have, or buy another
> machine just to run this program?
> Someone told me this was a no-brainer, and that it was a generally
> accepted fact that computer CPU/memory/disk was much cheaper than
> programmer time. True?
Definitely not automatically true, in my experience.
But it always depends. Some programs will eat whatever resources are
available, and not free them until they are restarted (or worse: until
the server is rebooted), while other will use reasonable amounts of
resources and actually need what they have taken. I have seen a lot of
really poorly coded applications that never free memory, don't close
open files, don't close open connections to the database etc, and for
most of them increasing the resources didn't help.
On the other hand isolating them on a separate (virtual or physical)
machine will avoid damage to the rest of the system, and may be a
cheaper option if person-resources are scarce. But it won't really help
on the resource problem, just make it less serious for the other
programs or applications running. It also may make it harder to scale
the application as its usage increases - adding more hardware to a
poorly written program that will use everything it gets anyway won't be
effective in the long run. On the other hand, I HAVE added several
servers to a solution - it was in production, and we insisted on
code-freeze due to the high demand of the university's website now just
before application deadline (the developers and the client were ok with
releasing new code, but the admins (we) wouldn't let them release it
outside the release cycle) - and we could easily add a couple of extra
servers to run just those tricky and poorly written apps.
But I'd try to avoid adding more hardware unless persoin-resources are
really scarce AND something has to be done immediately. The long-term
solution should be to rewrite the program. I am not a programmer, but as
far as I know MANY rewrites are very easy and don't take long - I am
talking closing file descriptors and database connections, stopping the
worst memory leaks etc now.
> Have there been studies done on this? Articles written?
I don't know any articles about this, but I would expect it to be some.
A field where I know such issues are actual is within high performance
computing and other computational sciences, but I don't have any
pointers (I just know a former office-mate works with ths, and he
usually make the program more effective).
sash is very good for you.
More information about the Techtalk