[jdev] parsing xml (xmpp) with ruby
Eric Will
rakaur at malkier.net
Fri Oct 3 08:28:03 CDT 2008
On Fri, Oct 3, 2008 at 8:29 AM, Jonathan Dickinson
<jonathan.dickinson at k2.com> wrote:
>> ... Only resort to
>> threads when you *really* have a problem that can only be solved with
>> adding threads.
>
> Amen.
>
>> Otherwise, stay away from it if you want to maintain
>> your sanity.
>
> Amen, again.
>
>> I doubt that the poster's software project is already in
>> that stage where he needs threads to solve his problems.
>
> I beg to differ. It's a daemon, it will be a nightmare to refactor into threads if he takes it any further. It is a choice he has to make, but it won't scale horizontally unless more machines/process instances are added.
So what's the concenus here? I don't really care for threads, never
have. The daemon seems to run fine on my dual core machine and my quad
core machine; I see activity on all of the cores via a system monitor.
SMP has come a long way as well, and may be just as clever without
threads (mere speculation here).
I already had the realization that this project wasn't going to scale
fantastically as soon as I chose Ruby for the language. It's not
something that I expect to be deployed widely, but more of a "hey cool
I want to run a jabber server" kind of thing. I wrote it for me
mostly, with a userbase of less than a few hundred. It'd be cool to
see it running somewhere, but mostly it's for me, to "scratch the
itch" as it were. All of my programs were written "for me" but I
always release my code because someone might find it useful.
That doesn't mean I don't take measures to help performance. Each
connected user only incurs about 5-10 objects. An XMPP::Stream, an
XMPP::Resource, and a handful of REXML element objects (stored stanzas
for things like presence). The performance will also increase
dramatically with Ruby 1.9 as 1.9 moved from interpreted to bytecode,
so the performance gain is a few orders of magnitude. I'm fairly sure
it'll be out before my code is done (Christmas ish).
I tend to agree that if I can stay away from threads I should. I like
to be able to follow my code flow.
Thanks for all the feedback.
-- Eric Will // xmpp:rakaur at malkier.net
More information about the JDev
mailing list