On Fri, Mar 28, 2008 at 10:27 AM, Joe Campbell <green...@gmail.com> wrote:
> I am a bit worried about Mach-II's framework overhead
Overhead in what sense?
--
Matt Woodward
mpwoo...@gmail.com
http://www.mattwoodward.com
Please do not send me proprietary file formats such as Word,
PowerPoint, etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
Startup and load times are two different things. I'm not sure why
anyone would be concerned about the initial startup time of an app,
but even in huge (and I mean HUGE) Mach-II apps, I rarely hear of
startup times longer than a minute or two. I'm sure there are some
extreme cases out there though. After that all the non-transient
obejcts are cached so everything's lightning fast. In my typical
"medium-sized" Mach-II apps the startup time is a few seconds.
Load time to me indicates the page load times, which is something
altogether different than the startup time.
> Most of my team if not all of them believe doing things the OOP-way
> will increase the response times in our application.
Well, in a very narrow (and therefore very meaningless) sense this is
true. Procedural code can run faster. Is OO "slow" or even
"unreasonably slower" than procedural code? Absolutely not, and
compared to poorly written procedural code, I suspect that a Mach-II
app would actually run faster.
If performance is your #1 concern, then sure, avoid using objects. I'd
argue, however, that if performance is your #1 concern your priorities
are out of whack, or you're writing real-time systems, in which case
CF isn't a good choice anyway. You should be writing for
maintainability, not performance, unless performance becomes an issue.
It's the old "don't optimize prematurely" rule.
I suppose if I'm sounding a bit curt it's because I tire of having the
"procedural vs. OO" argument over and over. That's a dead issue from
my perspective. You should be writing OO applications (regardless of
whether or not you use Mach-II) period, and to make a decision not to
do so using a rather baseless overhead/performance argument simply
doesn't fly.
> I have heard
> there is some overhead when using OOP in CF. I assume there is also
> some overhead when using Mach-II since it uses quite a bit of CFCs.
Again, overhead is such a generic term that it's hard to address. The
non-transient objects, meaning where all your business logic lies, are
cached after their initial creation, therefore no overhead for
creating the objects after the initial startup of the application. The
transient objects obviously have to be created in the application as
they're needed, but it's not as if this brings your app to a crawl. It
sounds like you have people on your team who are OVERLY concerned with
performance. Yes, we all want our apps to run fast. Mach-II is very
fast, and runs some extremely high-load, high-performance
applications. In a pure sense, plain ol' cfml pages will run faster
than an OO application, but again, that shouldn't be the primary
concern, and the speed differences are not enough to warrant choosing
not to do OO.
> According to Sean's blog back in 2006 this overhead is about the same
> as hand-coding a CFC solution, correct me if I'm wrong but this is
> still overhead when compared to a procedural application.
CFC creation in CF 8 is far faster than it was in 2006. Yes, it's
overhead, and I know I'm beating a dead horse at this point, but
overhead should NOT be the #1 concern when building an application.
Worry about overhead and performance when you have to. It's not as if
by choosing OO and Mach-II you're making a bad decision to sacrifice
performance and resigning yourself to a slow-performing application,
and what you gain in the process is a tremendous amount.
> I need to be able to justify this overhead with cost/time savings on
> maintainability, re-usability, etc...
Honestly they should have to justify why a miniscule amount of
additional performance (if it exists at all) is more important than
building a well-architected, easy-to-maintain application. The
argument shouldn't be the other way around.
> I'll be sure to change the CONFIG_MODE before I do any formalized
> testing/comparisons.
And make sure to turn off "report execution times" in the CF
administrator debug section as well.
I'm happy to give you whatever ammo you need to win this (ridiculous
in my mind) fight, but it is frustrating to me (as you could tell by
my tone through much of this) that people will make such hideously
poor decisions based on vague performance/overhead concerns. All
you're going to wind up with is an app that may perform milliseconds
faster if at all, but once that's harder to maintain. Remember too
that hardware is cheap so if you need those extra few milliseconds,
it's easy to throw more hardware at the problem. I'd be willing to
wager that if you take the millisecond clock off of things, from the
standpoint of your users, they won't even notice any speed difference.
--
Matt Woodward
mpwoo...@gmail.com
1. If performance is your number one concern, you're in the wrong language.
Depending on your requirements you might be better with Java or (if
developing massively parallel systems) look into something like Erlang which
isn't fast per see but is incredibly scalable.
2. Consider writing OO code. It'll be much easier to maintain. If
performance is a real issue, look into caching strategies that'll take your
maintainable OO code and either pre-parse a lot of the heavy lifting into
memory or compile down to generated procedural code. I've played
successfully with both approaches, but usually you're better to just design
your apps to cluster and then throw more machines at it.
To put things into context, what kinds of loads are you currently
experiencing, what software do you use for your load testing, and within
your current apps, when you profile them, what are you finding the actual
choke points to be? Often tightening up your SQL will save a lot more time
than trying to optimize the performance of your CF code.
Matt's right. There are reasons not to write OO code (trivially simple
applications or dev teams that simply don't have the skill set to maintain
an OO code base), but performance isn't one of them - especially if you're
in ColdFusion. If you *really* need the performance, ditch CF and write OO
Java code.
Best Wishes,
Peter
Just wanted to follow that there are other places that overhead can
occur at that a lot of developers forget. These include:
* Webserver configuration
I did some optimization for a client this past year and we looked at the
Apache settings. I was able to knock off half of the total time to
serve a page by change eTags, adding in gzip/deflate compress of files
and sending cache until headers. The cache until stuff did require a
change to how we deployed the application (we moved to ANT to automate
the process) because we tell the browser to cache JS files. We ended
using ANT with some regex and renamed all the JS (and CSS) files when we
deploy a new version to point from the generic someJS.js file to
someJS_184.js file and Regex those names our .cfm files.
* JS/CSS optimization / minified
At the same client, we started using JSMin to minify JS files when we
deployed them to production. For example, the version of Prototype we're
using -- un-minified is 45KB after it's minified it's 35KB and after we
use mod_deflate to compression the file when sending it to the browser
it's 8.5KB. That about 1/5th of the original size. Times that by all
the other JS files that are being used and that is a savings that is
very obvious in the terms of speed in the browser.
* CF server configuration
I seen a lot of people complain that OO on CF is so slow. However there
is significant overhead associated with having CF's debugging turned on.
Another thing is that people don't turn on template caching which makes
things run much faster in production on CF (yes, you need that off for
development).
Food for thought,
.pjf
Sometimes my response to this is find a new job where the company
appreciates employees that want to improve things instead of working to
keep the status quo.
> So this is the environment I find myself in and without ammo to fight
> these types of attitudes I might as well not even try.
>
> I do agree overhead is a generic term and shouldn't have blamed it on
> Mach-II but rather using objects in general. My #1 priority is
> usability for our users. Let's face it, the customer comes first. My
> #2 priority is maintainability due in large part to the fact that this
> is usually the longest phase in the software life cycle. Obviously my
> team does not agree with me on these priorities.
>
I'd argue that maintainability of an application should come first
because if you are up to your eye balls in maintenance then you'll never
have time to work on GUI, new features, etc. When you reach this
threshold, it easy to compound problems because new enhancements are
layered on top of poorly written code which never gets the time it needs
to become better. Basically, maintainability contributes to how much
time you have to spend on user functionality and usability. They are
highly linked in my mind.
> To sum it up:
>
> How do you teach a monkey to use a tool ("Mach-II") instead of their
> bare hands ("procedural programming")?
>
Well, we're sounding our own horn here, but you could send them to the
two-day Mach-II workshops before cf.Objective. It happens on April 30 -
May 1 in Saint Paul, MN.
Info here (discounts available for groups of 5 or more from the same
company):
http://www.mach-ii.com/index.cfm/go/training/
There is also a detailed PDF of the workshops:
http://www.mach-ii.com/resources/cfo2008TrainingInformation.pdf
Also a shorter version for Managers:
http://www.mach-ii.com/resources/cfo2008TrainingInformationManagers.pdf
Best,
.pjf
You're totally right to focus on maintainability. If you write your
app well and it's doing its job, it'll be in maintenance for a long
time. If you make bad architectural decisions now, you'll pay for them
every day during the life of the application. It doesn't need to be
that way.
I think there are people who are teachable, meaning it will just take
time and some convincing to get them to jump on the OO bandwagon, and
there are people who are unteachable. If you're in a situation where
the people in charge insist on coding like they did for CF 5, then I'd
consider them unteachable and quite frankly if they're that stubborn
it's not worth wasting your breath trying to convince them, sad as
that is to say.
There are, however, plenty of seemingly stubborn people who will see
the light, but sometimes they just have to reach a point of extreme
pain in the maintenance of an app before they get it. For some people
until they experience the true hell of working on a brittle
application and being afraid to touch it for fear of breaking
everything, they may just be unwilling to change.
About the only thing I can say if you're working with unteachable
people is a) find another job, or b) try to introduce OO and Mach-II
on a small app. Maybe your company needs a new phonebook lookup, or
something small like that. Offer to do it in your spare time if you
have to. Build it right, and then as people say "Oh, that's great, but
I'd like to do this ..." and you can change it in a few minutes
without fear of the entire app coming crashing down around your ears,
people will start to see how good life can be.
Just some ideas--I'm sure others will chime in with their experiences.
To put another fine point on things, NOT doing OO in this day and age
is career suicide, and if you're in a situation where you'll never get
to do OO, I'd seriously start looking for another job. You can only
avoid it so long before you find that you just don't have current
skills anymore. OO's been around since the 1960s and it's high time
CFers stop avoiding it.
Thus endeth the sermon. :-)
--
Matt Woodward
mpwoo...@gmail.com
No zip so you'll have to use an SVN client. I've just reorganized
things in a bit better way in that version, and we're about to start
working in earnest on version 2.0.
--
Matt Woodward
mpwoo...@gmail.com
Yes, that was my first reaction when I saw Joe's comment about his
"lead programmer" - and we wonder why CFers in general have such a bad
rep? :)
Since Joe invoked my name regarding performance, I'll say that bad
architecture is responsible for more bad performance than anything
else. Most of the CF part of adobe.com runs on Mach-II so it can
certainly handle high traffic loads acceptably. Maintainability and
ease of enhancement should be top concerns, along with good
architecture (which Mach-II has in spades). There are lots of ways to
improve the performance of a well-design application - IF it needs it.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
The new official (and permanent) home of MachBlog is:
Trac: http://greatbiztoolsllc-trac.cvsdude.com/machblog/
Svn: http://greatbiztoolsllc-svn.cvsdude.com/machblog/
MachBlog is now an official project of the Mach-II.
Best,
.Peter
"Trunk" is the current development code which includes a partially
revamped admin console. Much of this is half-implemented so beware
errors, etc. This is bleeding edge.
The 1.0 version is in branches/1.0
The stuff in GoogleCode is still there, and it's a post-1.0 revamp of
the code organization but with all the same functionality in 1.0.
Actually I think I'll pull that down and make it 1.1 or something just
to avoid confusion (like there isn't enough already).
We also have a Trac site so you can see tickets, development progress, etc.:
http://greatbiztoolsllc-trac.cvsdude.com/machblog
Finally for MachBlog specific issues, please join the Google Group for MachBlog:
http://groups.google.com/group/machblog
Which apparently I will have to turn moderation on for (at least for
new members) since it's currently clogged with all sorts of nice spam.
--
--
I guess I'm just having a hard time wrapping my head around the
resistance to taking a couple of hours, or heck even a couple of days,
to learn something that will make everyone's lives so much easier. Why
the resistance? Why the micromanagement? (I know, probably questions
you can't really answer. ;-) They'll let you use a bean factory
beacuse why, it's just a couple of files, as opposed to a complete
killer solution like ColdSpring? Boggles the mind. ;-)
Wow--not to harp on another point here but you do develop locally,
right? As in on your own workstation/laptop?
--
Matt Woodward
mpwoo...@gmail.com
Yep, exactly what I was getting at. Another thing I'd strongly,
strongly recommend. I'll leave using a bug tracker and version control
system for another day. ;-)
--
Matt Woodward
mpwoo...@gmail.com