Some Nice Optimization
Adrian Sutton
The upgrade process from Portal 6.0 to 6.1 is really overly complex for a simple little one server deployment like I’m managing. To save myself that pain I’ve manually migrated a bunch of components and written a script to bring over all the content.
Firstly, it’s been a lot of fun playing with Java’s ObjectOutputStream and designing stuff to work well with that. Nothing earth-shatteringly new, but just a few little tricks like when you want to serialize a list of objects:
out.writeBoolean(true);
for (Iterator i = list.iterator; i.hasNext(); ) {
out.writeObject(i);
out.writeBoolean(i.hasNext());
}
Then you can read it back in with:
while (in.readBoolean()) {
list.add(in.readObject());
}
If you don’t write the initial boolean out, the zero-items case breaks things. There are other ways to achieve this, but this way works out really nicely for the structure of serialization I had.
So I got the script all written and ready to test about two weeks ago, and successfully exported all the content in about a minute. The import however was not so nice. Creating content items in IBM WCM is always a bit slow, but creating them on mass with this script got exponentially slower. It took about 48 hours to do the first pass before finding a bug in my import code just before the second pass. The final few saves were taking over three hours to complete.
Thankfully I checked in with IWWCM Guru Pete Raleigh who confirmed it shouldn’t be that slow, so I started to get very suspicious of my portal install. Today I ran up a Portal 6.1 instance on EC2 using the very handy (and well thought-out) pre-built development AMIs.
The import finished, first and second passes, in just 20 minutes. It was even really straight-forward to take snapshots of the portal and roll back to them on demand. Simply stop the portal and DB2, take a snapshot of the elastic block storage instance, then start everything back up. When you want to roll back, stop portal and DB2 again, switch the block storage over to the snapshot (you need to unmount, create a new volume from the snapshot and then mount that), then start back up again. Everything in portal (really seriously everything) is just as it was when you took the snapshot. It’s actually faster to do than with VMWare.