Repost: Not giving is “wrong,” but that’s the wrong word

In “Is It Wrong Not to Help? Part I,” from Psychology Today, Professor Peter Singer has this interesting chain of logic:

  • First premise: Suffering and death from lack of food, shelter, and medical care are bad.
  • Second premise: If it is in your power to prevent something bad from happening, without sacrificing anything nearly as important, it is wrong not to do so.
  • Third premise: By donating to aid agencies, you can prevent suffering and death from lack of food, shelter and medical care, without sacrificing anything nearly as important.
  • Conclusion: Therefore if you do not donate to aid agencies, you are doing something wrong.

He continues the thought in his next entry, “Is It Wrong Not to Help? Part 2,” if you’re interested, but his logic, as presented at the end of the first in the series and as printed in Psychology Today, is what interested me.

My conclusion is that it’s wrong, but not very, and not enough to conclude that it’s “wrong” to not donate to aid agencies. There are simply too many diffusing elements. Consider:

  • Which aid agency? If it’s wrong – as compared to right – to donate, should I not consider it wrong to not donate to the agency through which the most aid is offered?
  • How much? If it’s wrong for me to enjoy largesse when others are doing without, should I not offer as much as I can, until I’m at a satisfactorily subsistence level myself?
  • To whom? If my uncle is hungry, and a child in Africa is hungry, to whom do I offer food? After all, I can give my uncle a sum of money, and he would get all of it; a child in Africa gets a portion of the aid I offer, and that portion may not be enough to satisfy him; further, the administrative costs of the aid through an agency reduce the aid even further.

Whoa, wait – I may have just assigned a relative value to people! That doesn’t mean that the child in Africa is not extraordinarily valuable, but that I value some people over others. Everyone may be equal before the law, but if I’m honest, they’re not equal before me; I’d help my child with a minor problem long before I’d help my idiot neighbor with a major problem. (My other neighbors are great people; it’s the one idiot that can languish until I can, you know, get around to helping her, which will be right after I finish dusting the fans in the house.)

Is assigning a relative value to people wrong? I don’t know. I think it’s pretty natural, though; one cares for one’s children before caring about strangers, and the further the stranger is removed from you geographically, the less he matters to you, especially in comparison to one with much less psychological distance.

If a natural process is wrong, then we’re wired to be wrong; so much for beneficience or, for that matter, survival. I say that it isn’t wrong; it’s how we survive as a freakin’ species.

So back to not donating to aid agencies. Is it wrong? Yes, I can agree that it’s wrong – but it’s not wrong in a way that should assign any individual guilt worth measuring. Vague discomfort, I suppose, because I think one should help if one can – but guilt? No.

Leave that for the people who eat twinkies.

BTW, PT’s tagline is great: “Psychology Today: Health, Help, Happiness + Find a Therapist.” Nice segue, folks.

Author’s note: another repost.

Repost: It’s not about C++ and Java Performance.

Warning: anecdotal conclusions coming.

I think the crucial flaw in every Java v. language is that they always focus on, you know, specific code. “Here’s a fibonacci routine using recursion… in Java, it’s X, and in C++, it’s Y! Wow!”

Every time I see that kind of comparison, I’m left cringing. It’s crap. It’s interesting only if your skill level is pretty much identical to the guy writing the test code — in both languages. If your skill levels differ – if you’re better at Java than he is, or better at C++ than he is, the test might as well be written in Swahili (unless, of course, you read Swahili, in which case you should substitute another language, one you can’t read.)

Here’s what I have seen in the industry: if you have a guy who’s an average Java programmer and an average C++ programmer, the Java will usually have slightly better runtime characteristics… over time. It’ll have fewer bugs, better turnaround time for development, and an easier maintenance cycle. The Java runtime characteristics will be slightly better because Java punishes you for doing stupid things, and C++ does so at more problematic times, so Java will sort of hedge the average programmer in the right direction by default.

Now let’s take a master C++ programmer who’s a master Java programmer… and the resultant code will beat the ever-lovin’ crap out of the average programmer’s code. The master’s Java code will fly past the average guy’s Java, and his C++ code will cruise past the Java code. C++ would win here, almost every time, because a master knows how to generate optimal code, and while Java will do well… Java will rely on certain runtime characteristics and C++ will not, and a master can exploit both. The maintainability will probably go down in both (a bad thing), and bug counts will also typically be lower, because the guy is supposed to be a master.

Now let’s look at the next case: a poor C++ programmer who’s also a poor Java programmer. (Poor as in “skill level,” for clarification.) We’ll call him “Alan.” (Or “Kirk.”) Here’s where Java will shine: this guy will have trouble typically generating readable and runnable code in C++, whereas if he’s able to get Java to compile, he’s likely to at least runsomething. Here, because running something wins over not running something, Java will win almost by default… and the runtime speed will typically be atrocious regardless, but a successful run through C++ will still not be TYPICALLY as fast as the Java result. (The nature of the test still factors in, of course.)

So which one’s better?

Well, it depends! If you’re good at one or the other, that’s the one you should be using if nothing else factors in. If you’re a god at C++ and you’ve sort of maybe seen the Java specification once in something other than your native tongue… sheesh, use C++. If you rock at Java but still get dizzy when you see double colons and angle brackets in types – and you’re avoiding Java 1.5 like the plague – hey, Java’s your bag. If you’re Peter van der Linden and dream in C++ and Java at the same time, use what’s appropriate for the platform you’re on.

That’s the bottom line. Is it good enough? Do you know how to use it? Do you know enough about each one to understand the tradeoffs? You have to make your own decision based on your own skill level, not the skill of those ill-informed enough to go out and try to find a catch-all benchmark.

(Reposted from an old blog of mine, from June 2004, because I want the good stuff to be in the same location and because I keep seeing people read this and they’re reading it from the wrong place.)

Repost: Frustrating “points” on homeschooling

My wife and I homeschool, mostly because we have inquisitive kids who were told – and I quote – to “stop asking questions” in their public schools. That was the final straw for us, after noting that their behavior was far, far worse after going to school than not.

Here’re the points:

  • The education of our country’s children is too important to be left in the hands of their parents.
  • The idea that only the parent can teach the child and abandon the public education system is normally the sign of a deeply threatened, controlling personality.
  • There are more kids doing this homeschooling stuff than ever before. How can they ever compete in the modern world when they grow up with strict brainwashing and medieval attitudes?
  • All homeschooling will do is guarantee your kids are as stupid as you are.

Since I’m human, I can’t help but personalize all of these, and some of them were frustrating. I don’t think they were formal assertions, so I’m not going to argue too much about the wording – this was a biased paraphrase, after all.

The education of our country’s children is too important to be left in the hands of their parents.

Holy cow! I’m Jewish, so maybe there’s a cultural thing going on – but WHAT? In Judaism, a child learns first from his parents. He’s instructed to find a teacher (and also a friend, but that’s a secondary thing here) as well, but teaching comes first from the parents. The community education system is ancillary.

What’s more, I’d say that the education of our country’s children – any country, really – is too important to be left in the hands of hired hands! I’m fully in support of education, even public education (although I don’t think it’s right for my children), but the teacher’s unions and the public school structure are bad wrong for today’s world.

Schools teach kids how to follow regimented structures: they’re better armed to work on an assembly line when they come out of public school than they are anything else, based on what the school offers them. (Electives and students who enjoy learning can fix this… but a love of learning usually comes from the parents!)

I can tell you that I learned far more from my family than I ever learned from a formal schooling system, and I don’t think I would have suffered from avoiding public school at all, although I realize that sounds like I’m, um, lacking in humility. Let’s just say I can point back at every formal testing score I’ve ever had and compare extremely well to the average.

The idea that only the parent can teach the child and abandon the public education system is normally the sign of a deeply threatened, controlling personality.

With all due respect: The idea that the parent can not teach the child is a sign of a deeply threatened, controlling organizational mindset.

From what I can see, it’s more about money than anything else, planting kids in seats so that educational money flows to a given school. I understand that, really; schools have to survive, right?

But when my sons were in public school, they used to come home upset that their teacher had admonished them for not riding the bus, because my wife took them to school herself.

First off: my wife and I are the adults who make that choice; admonish my wife or me before berating my kids.

Second… what the heck? While I understand the economic reasons for wanting the students on the bus (the system gets money for each student who rides the bus, just like they get money for every student who attends for N days per year), it’s a good thing that parents are involved and want to be part of things.

I was deeply offended by the whole thing, and that also factored into our choice to homeschool.

There are more kids doing this homeschooling stuff than ever before. How can they ever compete in the modern world when they grow up with strict brainwashing and medieval attitudes?

Okay. It’s a good thing our kids aren’t brainwashed in public schools (“stop asking questions, and start riding the bus”) and they have medieval attitudes… I guess. What’s a medieval attitude here?

An alternative to “medieval attitude” and “competing in the modern world” goes back to socialization. The prevailing theory as expressed to me has been that my sons won’t know how to interact with other kids, and won’t learn unless they’re in public school.

Okay. Except that my second son, an extrovert, tends to be a popular kid in public settings. (Oh wait, we homeschool, there are no public settings, right? Wrong!)

My firstborn and my third son are more introverts; school isn’t going to change that (and shouldn’t), and honestly, given the crap that goes on in most public schools, I don’t want them to learn “how to deal” with malcontents who are taught that they can get away with anything.

School is not the real world. There’s a cliche about nerds who graduate and become very successful, and another one about the high school quarterback who ends up a failure; why do I want my sons to have to endure bullying and enforced stupid social mores when those things aren’t in the real world?

I’d rather they actually learn from the modern world, rather than learn from a secondary source about what the modern world was. It’s called observation and participation. It actually teaches you how to, like, compete in the modern world.

All homeschooling will do is guarantee your kids are as stupid as you are.

Oh man… naturally, I’m the smarterest person evar, so I wants them to be as inteligent as I am.

The statement is false. Most homeschooling parents that know of not only teach their students a curriculum with a syllabus and everything, but they also encourage students to learn on their own and from the real world, from the newspaper, news channels, those things made of paper with words on them (called “buks,” I think?) and the computenmachines – my kids live on How Stuff Works and wikipedia.

So far, in the subjects in which they’re really interested (and thus research) they’re doing really well – my oldest son was more advanced than I in robotics until just recently (he’s been more interested in civil engineering lately – at 14 – and I got a job building robots, so I leapfrogged him.)

Bleah.

Author’s Note: This is another repost, from about five years ago, since my son’s 19 now.

Repost: Some of what I’d wanted to do for TheServerSide

Ah, TSS… so much potential, unused.

I had big plans for TheServerSide. I’d like to let you in on some of them, because I don’t have time to make them happen all by my lonesome, and I hate the idea of letting what could have been a good set of ideas disappear if I were to, say, get hit by a bus.

I’m a big believer in cutting losses.

The way I see TheServerSide (or sites like it): it’s a huge stream of information. Each element in the stream contains a topology, where there are two main categorizations for each element, and a set of (potentially) unrelated tags.

The main categorizations were by element type (article, newspost, cartoon, review, multimedia) and by architectural position (persistence, presentation, development, and architecture). These are used as a subtractive filter, so you could say “I only want to see articles,” or “I only want to see persistence,” or a combination: “I only want to see articles on persistence.”

The additional tags could be whatever was appropriate. They’d be used more for searches than for restriction of content.

A late idea – maybe from 2007 – was that you could add a third layer, for language, so you’d be able to say “show me all the persistence articles that use ruby.” TheServerSide was Java, of course, but I don’t think it’s reasonable to look at every project as being 100% Java. It’s appropriate to think of the right tools for each project; I don’t see why PHP would be horribly offtopic, especially if readers could say “I don’t want to see PHP.”

For TechTarget, which has a stable of sites, you could see a SOA site using that one stream of information and only presenting SOA topics; same for .NET or any other similarly focused site. I saw TheServerSide as being more general, so I figured it would use everything the stream had to offer.

Implementation note: JCR would be perfect for this sort of thing, and it’d be really easy to code and it’d run very quickly. (Proof: see InfoQ.)

Now, back to presentation: One of the things I always liked about TSS was that it put its money where its mouth was. TSS used Java to do everything, for better or for worse; recent incarnations used Tapestry plus Jive, which may or may not be an optimal combination… but what if users could do their own interfaces?

Imagine a front end written in Struts 1, using the common backend… and another front end with Struts 2, and another with JSF, and another with Wicket, and another with GWT… and the people who know each technology would have the opportunity to write and maintain their chosen implementation.

It’d be a perfect demonstration of each framework under load; users could select which interface they wanted by using a domain name (struts1.theserverside.com, jsf.theserverside.com, php.theserverside.com) and look at how the system was implemented; a small and trusted group of architects and coders could make sure the interface didn’t violate various restrictions (namely, those restrictions that prevented ad delivery, which is the profit vector for a site like TSS.)

Of course, this would mean that TSS would have to do something readers asked about over and over again… it’d have to make its source available. Horrors, right? After all, it’s a community site that talks about open source all the time, and thus it makes sense to me that the community it serves would be able to contribute back to it.

Another unrelated idea was actually co-opted by DZone; the DZone links page is very close to the sort of thing I wanted TSS to have as a feature. I would, however, like to add that I had a machine learning approach; I wanted readers to not only be able to vote for items, but for the system to learn what people liked, so it could make recommendations even before readers rated content.

I’d have loved to see all of this put in somehow; sadly, the people at TechTarget never had the time to do any of it, or the inclination; if you read what I wrote carefully, you can see that I was trying to give the community the means to do all of it.

Author’s Note: Yet another repost.

Repost: TheServerSide, you suck. TSS readers, you do too.

As editor for TSS, I had a specific audience and specific goals in mind. The audience was the tech industry, primarily enterprise Java developers. The goals were to impart knowledge to the audience that otherwise might involve investments of time that the audience might not want to make — to vet the content before wasting your time on it, you might say.

Now, TSS has a different audience and different goals. The audience is primarily TechTarget, the company that owns the site. The goals are to get hits. A great posting is determined by "how many hits did it get?"

Look at the difference: I was willing to trade hits for signal as long as the signal was strong. An unclear posting that got tons of hits was a loss. A clear posting that told people enough information such that they didn’t need to read further (if they didn’t really have an interest) was a net win.

Now: signal is optional, as long as the hits roll in.

I tried to not troll the audience too often; it happened, because I’m a sarcastic, cynical jerk sometimes, but I also tried to make it fairly clear what my goals were. (I’m probably too subtle to make that work as well as I’d like.)

Now, TSS trolls the audience at will.

The annoying thing, the reason TSS readers suck, is that when <strong>I</strong> did it, you called me on it, regularly and often fiercely. Now: hardly a reaction at all. Nothing of consequence. And the band plays on.

Thanks, guys. Sometimes people wonder why I’m bitter about TheServerSide, and it’s because of stuff like this; even when you try, you get slapped down. That’s not to say that there were not real rewards: I got a lot of friendships out of my time at TSS, and I really enjoyed helping the industry along, but it’s an arena where external rewards are very rare – and worse, attempted public humiliation is more common.

Combine that with the constant pushback on trying to improve TSS from TechTarget and you have why I was thrilled to leave when the time came.

Author’s Note: Another repost. I’d normally not have reposted this, but I felt like it contained enough signal that it was worth retaining.

Repost: On “It’s a Miracle,” a horribly bitter song

“It’s a Miracle” is a creepy, scary, bitter, sad song in more ways than I think I can count. The last verse is a personal rant by Roger Waters on Andrew Lloyd Webber – and God forbid I ever feel like that about anyone on earth – but the rest of the song is so… sad, because it recounts good things that people can do or might do or might have done… and then says “It’s a miracle,” like someone being kind to someone else is so rare and precious that it’s a miracle that it happens at all.

They had sex in Pennsylvania
A Brazilian grew a tree
A doctor in Manhattan
Saved a dying man for free
It’s a miracle

Holy…

An honest family man
Finally reaped what he had sown
A farmer in Ohio has just repaid a loan
It’s a miracle

I can’t hear that without getting tears in my eyes. I have to be really careful if I’m driving. The thought that those things could be considered miracles – and they would be – is terrifying.

The last verse is the rant, and it’s incredible:

We cower in our shelters
With our hands over our ears
Lloyd-Webber’s awful stuff
Runs for years and years and years
An earthquake hits the theatre
But the operetta lingers
Then the piano lid comes down
And breaks his f**king fingers
It’s a miracle

Nowhere else have I ever heard such a cruel sentiment issued with such drama – cowering, the earthquake offers hope, but the operetta survives, vampirically, until the hand of God sweeps in and smashes the fingers. Incredible.

Roger Waters is one of the few ‘stars’ I’d really like to meet someday, but I have to say I’d be afraid to actually do it.

Author’s Note: Yet another repost!

Repost: The $90 cup of water

True story: I paid $90 USD for a cup of water. This is the explanation, and if you were there, please forgive any lapses of memory, okay?

The setting: TSSJS 2006. It was my first TSSJS, the first one where I was not only present but the organizer. I didn’t go on stage, because I’m an introvert and I don’t like to be noticed much. (Later Symposiums had me on stage, because I felt that it was more important to serve the show than my own reclusiveness.)

My supervisor, Mike W., had made sure we knew we were a for-profit conference, by telling us to make sure we stayed within reason for expenses: $30 per diem was a good target.

One of the conference speakers was getting married while in Vegas on TSS’ dime (good show, mate!), and he and a bunch of other people decided to go hit a nice steakhouse as a sort of pre-wedding meal for him. The attendees were names you’d recognize either as big-time open-source contributors or bloggers from places like Atlassian, Google, IBM, Wal-Mart, and others.

So we’re at this great steakhouse, and the prices reflect the “greatness” of it: anywhere from cheap beef at $60 or so to some… truly stunning hoofage. I’m an ordinary guy, so I picked a decent sirloin, at $71. This is important.

The waiter was going around picking up orders, and asked the bride what kind of wine to serve; I wasn’t paying attention, but what I was told was that she didn’t know what to ask or look for, so she said, “Bring us whatever is good.”

This was a mistake.

Now, here’s the thing: at the time, I was on some medication that carried, uh, strong warnings to avoid alcohol of any sort. I’m not a teetotaller, strictly speaking, but right then I was; the interaction warnings were pretty strong.

But the waiter didn’t ask me what I wanted to drink; he just assumed the wine would suffice… because it was a huge bottle of wine. I thought it was a magnum, except a magnum is only equivalent to two bottles; this thing looked like it was four gallons or something.

I, however, had none. No interest in flowers growing from my ears or anything like that, plus I don’t have a really discriminatory palate; I don’t really appreciate wine properly. So I figured maybe the waiter would come back and I’d be able to order a Coke or something.

munch, munch, graze

After the meal comes the ticket. Except… what a ticket! That bottle of wine was eight hundred and ninety-five dollars. Spread out among each of the attendees, it worked out to $90 per person.

But I didn’t have any — and being the host of the conference in question, I felt like I really shouldn’t decline to pay for my part of the dinner. Etiquette, you know. So it worked out to $71 for my steak and… $90 for my libation, which might have been wine, but was instead my initial cup of water, which was never refilled.

Explaining it to Mike the next day was great: “Remember how you said no more than $30 per diem?…”

Author’s Note: This is yet another ancient repost.

Repost: Jihad for Dummies

Okay, so apparently Hamas fired a Stinger at an Israeli Apache helicopter, unaware that their Stinger was prepped with a friendly-fire protection mechanism that refused to target the Apache.

There’s a perfect comment to the blog post:

In this fallen world, we must inevitably have enemies. By God’s grace, He willed that they be total morons. Praised be His name!

There’s also a link to someone else’s blog post (no trackback, but hey) called “Bwah, hah, hah!!!! Hamas + Stingers = Hilarity” with this amusing image:

The book is interesting. My first thought was: “Is there any other kind of Jihad?”

My second thought was “I wonder how much they worked on the binding process for those books… it’s not like they’ll last long. Or that the Jihadists can read. Maybe it’s a pop-up book.”

Added from “Why Hamas couldn’t shoot Stinger Missiles in Gaza,” the original source blog post from which the My Pet Jawa drew information, originally drawn from the World Tribune:

Another Hamas source said gunners deployed Stinger along with heavy machine guns in attacks on Israeli helicopters during the war in the Gaza Strip. The source said one Stinger surface-to-air missile was launched, but the projectile veered off course and struck a Hamas gunner squad.

Go Allah! The most evil people in the world aren’t Nazis – they’re people who hate others so much that they’d rather die than let their enemies live.

Author’s Note: This is another old repost.

Repost: Half-docs, non-docs, and… docs

I found a reference this morning on OSGi’s “buddy classloading” in reference to Spring, OSGi, and GigaSpaces. In addition to being, like, informative (thanks, Steve), it also had a reference to something Steve called “non-docs”:

To press button B, click the B button.

That’s perfect. It sums up OSGi documentation perfectly. But there’s another level of poor documentation, far more common when it comes to tech: half-docs.

Imagine this sort of thing, if you would:

Half-docs are what you get when something is documented, but not documented cleanly or illustrated well. You might have references. You might have hundreds of pages of references, in fact. But it’s all stuff that assumes you grok everything; just like I mentioned in the “what happened to JDO?” post, it’s a quality of reference that serves you well provided you didn’t use the reference to get started in the first place.

Look at Spring-DM. Let’s be clear here: I love this stuff. (Well, platonically.) Spring and OSGi is a disruptive technology, in the best possible way.

But getting it to work? This requires lots and lots of stab and attack for me, where I try something, get a failure, try to figure out why, try something, get a failure, try to figure out why, rinse and repeat ad nauseum. Eventually something sort of works, and I’m wondering why, still.

When I add a custom Spring schema to an OSGi module, this is what the docs tell me, from section 5.4 of the Spring-DM docs:

All bundles deployed in the OSGi space (whether they are Spring-powered or not) are scanned by Spring-DM for custom Spring namespace declaration (by checking the bundle space for META-INF/spring.handlers and META-INF/spring.schemas). If these are found, Spring-DM will make the schemas and the namespaces available through an OSGi service that will be automatically used by Spring-powered bundles. This mean that if you deploy a bundle that uses a custom schema, all you have to do is deploy the library that provides the namespace parser and the schema.

Well… okay. I don’t know what those files are supposed to contain; are they just supposed to exist? (I mean, hey: checking for META-INF/spring.schemas would yield a hit, right?)

Well… no. According to Appendix B (section 5) of the Spring documentation, it’s a little more involved; these are plain text files that resolve a URL to where the schema or namespace handlers are in the bundle itself.

Okay, fine; but adding this yielded a sequence of classloader issues that stretched for maybe seven packages, so that the NamespaceHandler (which worked beautifully and transparently, BTW, once the XSD was located) could find all of the Spring classes it needed.

I had declared a dependency on the Spring OSGi modules in my module, though, which makes me wonder why I had to specify all those imported bundles… or why the specification of all of those bundles wasn’t made explicit to me when I look at the docs.

Thus: half-docs. They make sure the information’s available to you, but only if you look hard. Bleah.

This actually sums up my approach to trying to write docs, BTW: “What other resources are needed in addition to this doc, in order for someone to be able to run what I’m showing them?” I’m sure I’m not perfect; in addition to getting things wrong sometimes (as the Terracotta people are fond of pointing out), I have my own assumptions to deal with, where I know something and don’t realise when others don’t.

I try, though.

Author’s Note: This is a repost from maybe 2009 or so.

Repost: Adding high availability in Terracotta DSO

Terracotta DSO is a package for distributing references in a heap across virtual machines. (Thus: Java. I thought it included C#, but Geert Bevin reminded me that I’m an idiot.) That means that if you have a Map, for example, you can set it to be shared, and your application can share it with other VMs without having to be coded for that purpose.

The only real requirement on the part of your code is that it be written correctly. As in, really correctly. (Want help with this? Check out Using Terracotta for Configuration Management, an article I helped write for TheServerSide.com.)

Luckily, DSO helps you do that by pointing out failures when you screw up.

Anyway, the way DSO works topologically is through a hub and spoke architecture. That means that your VMs are clients, tied to a central server. The hub, then, might seem a potential failure point; if your hub goes down, your clients stop working.

That would be bad. Luckily, DSO has availability options to change the nature of what the “hub” looks like.

The DSO client uses a configuration file named by default as “tc-config.xml.” It has a reference to a server instance that looks something like this:

<servers>
  <server host="localhost">
    <data>%(user.home)/terracotta/server-data</data>
    <logs>%(user.home)/terracotta/server-logs</logs>
  </server>
</servers>

Note the server hostname: it’s important, surprisingly enough. Adding high availability to DSO is only a matter of changing this block in your configuration file.

What we’re configuring here is active/passive failover. That means there’s a primary server instance and a passive server instance. The two server instances sync up, so if the primary goes down, the passive has all of its data; the clients are perfectly able to switch from using one server to the other as their active status changes, so from the client perspective, if the primary server dies, nothing happens.

When the former primary instance returns, well, it’s not the primary any more; it becomes the passive server instance. From the client perspective, all of this is under the covers.

This is Very Good.

So: here’s a configuration I used (tested with Vista running one DSO server with ip 192.168.1.106, running the other DSO server under a Windows XP VMWare image with ip 192.168.1.132):

<servers>
  <server host="192.168.1.106" name="m1">
    <data>%(user.home)/terracotta1/server-data</data>
    <logs>%(user.home)/terracotta1/server-logs</logs>
    <dso>
      <persistence>
        <mode>permanent-store</mode>
      </persistence>
    </dso>
  </server>
  <server host="192.168.1.132" name="m2">
    <data>%(user.home)/terracotta2/server-data</data>
    <logs>%(user.home)/terracotta2/server-logs</logs>
    <dso>
      <persistence>
        <mode>permanent-store</mode>
      </persistence>
    </dso>
  </server>
</servers>

When you start the server, you use a command line argument, like this, with the configuration file in $TERRACOTTA/bin:

./start-tc-server.sh -n m1

This tells the server instance to use the configuration “m1” – yes, I know, but I didn’t have hostnames setup and I wasn’t sure how NAT would affect what I was doing – and the two instances will work out between them which is active and which is passive.

The end result is that I was able to run my shared map program while changing the servers around – starting and stopping them in-process, for example – without the client program knowing or caring. (Note that the client program needs the same basic configuration data; it can get this by having its own copy of the configuration file, which is what I did, or it can load it from the servers, too, or any number of variants. It just needs the relevant data. Happy now, Geert?)

A side-benefit of the configuration is that the DSO cache is persistent – you don’t need high availability for persistency, but you do need persistency for high availability.

It’s good stuff.

Continue reading Repost: Adding high availability in Terracotta DSO