Technology

Travelocity down due to power outage..

Looks like Travelocity was down early today due to a power outage. Here is a screenshot of the site, right after they came up

According to Pingdom, the site was down for ~1 hour and 29 minutes. If they did come up at an alternate site, I personally think that is a pretty good response time. Running a high transaction web site (and one that is as complicated as Travelocity) is no easy feat and when you throw DR into the mix, it gets pretty nasty. The site is primarily hosted out of the EDS/Sabre/Travelocity datacenter in Tulsa, Okhlahoma.

HOW TO : Pass environment variables when using sudo

Say you need to sudo as a particular user and run a command and at the same time you need to pass an environmental variable to the command, you can do it by passing the command in doublequotes.

For example, I want to start Oracle while I am logged in as another user (vinay), I can start the database using dbstart by issues

"sudo su - oracle -c "dbstart /$ORACLE_HOME"

$ORACLE_HOME is an environmental variable listed under user oracle’s environment.

Needless to say, you need to ensure that you have sudo configured to allow your userID to su to oracle.

HOW TO : Redirect default home page on Jboss

If you want to redirect the default home page on Jboss (which has links to the Jboss site and also the JMX Console), you can do it by editing the index.html file in

$JBOSS_HOME/server/$INSTANCE/deploy/jboss-web.deployer/ROOT.war.

The $INSTANCE is the mode you are running Jboss in (default, all, messaging etc).

Lessons of the Trade : Simple way to deter web scrapers

If your website is a target of web scrapers (http://en.wikipedia.org/wiki/Screen_scraping), here’s a simple way to keep them on their toes..

Every few days (or weeks) make a small change to the web page format. The trick is to make the change in such a way so that your users do not notice it or are not annoyed by the change. Most of the simple scrapers use, screen scraping and this would confuse the hell out of them 🙂 and usually deters the most abusive ones. The smart ones would have approached you in the first place, requesting permission to scrape or get authorized for an interface.

Lessons of the trade : Troubleshooting database perfromance

If you have ever worked in an IT shop, you will know that the one thing you cannot escape from is issues related to Database performance. Now, I am no DBA in any way or fashion, but thought I should record some of the common issues and ways they have been overcome in my career so far. More for self records than trying to teach someone :).

  • Network Related
    • Check if the NIC (network interface) on the DB server has any speed mis match with the network device (most probably a switch) that it is connected to.
    • Check the latency between the application and the DB (pertains to applications connecting to DB over WAN links)
  • System Related
    • Check if a rouge process is using all the system resources.
    • Check if the disk sub system is performing optimally
      • Recommend using RAID 10 for transactional systems.
      • Don’t forget to check those batteries on the RAID controllers 🙂
    • Check if the DB is just running out of gas.
      • Long term capacity trending records come in handy here.
  • Database Related
    • Views are evil.. if created the wrong way. Esp, on data that is accessed frequently. Remember that you are now making two calls to the database. One to read the data, One to create the view.
    • Ensure your logs are not being writted ot (thx Ray for pointing out the typo) written to the same disk subsystem as your data files.
    • Indexes are good.. But only to an extent. If the size of your indexes is twice the size of your data.. you have an issue.
    • Check for invalid objects. You will be surprised how many times, people overlook this.
    • Sometimes, it helps to flush the SGA (Oracle specific). Be aware that it will slow down the response time for a while (until the cache gets populated again).
    • Avoid excessive monitoring. Esp. with tools that query the system tables quite frequently. This has a negative impact on the database performance.

Did you run into any strange situations and figured out a solution? Please feel free to add your comments below…

New Toy : Kindle 2.0

I have been looking at getting an e-book reader for some time now (yes.. even though I don’t have time, I still like to think I can read 🙂 ).. My sister and brother in law surprised me by getting me the newly released Kindle 2.0 (Thx Guys!!).. I think I am one of the first few people to receive it!!. Here are some pictures of the unpacking and the device itself

The Kindle in it’s original packing.. Getting pretty close to being as cool as Apple packaging

The most amazing thing (for me).. the USB/Power Cable.. Look how small the power brick is!!

 

First Thoughts??

Since, I didn’t have a previous e-book or the Kindle 1.0, I don’t have anything to compare it to. I think the styling of the device is very sleek and sexy. I like the alumunium backend (Reminds you of the first gen iPhone). The interface is OK.. Was not very impressed with it. I love the fact that you can browse Wikipedia anytime/anywhere with the built-in wireless connection for free!!

My next task is to figure out a way to get some content onto this baby. There are several books in the public domain (like the ones on Gutenberg.org) that I would like to get onto the Kindle first. Once, I feel comfortable with the unit, I will try some e-books from the Kindle store.

HOW TO : Simple perl script to replace lines in file

Nothing fancy.. but here is a simple perl script to open a file, search for specific content in the a line and replace it with some other content.

open (SOURCE, "< source.xml") or die "Could not open file source.xml: $!\n"; open (DESTINATION, ">modfile.xml")
or die "Could not open file modfile.xml: $!\n";

while (defined($line =)) {
if ($line =~ m/YYYYYYYY/i) {
$line = "XXXXXXXXXXXXXXXXXXX\n";
}
print DESTINATION "$line";
}

close (SOURCE);
close (DESTINATION);

You are opening a file named source.xml, reading every line and if there is some text that matches “YYYYYYYY”, you are replacing the whole line with “XXXXXXXXXXXXXXXXXXX”. I am sure there are more elegant ways to write this :).. but this will do the trick too..

Lessons of the trade : Data purge in databases..

Quick note to myself.. If you have a high volume transactional database and are looking to purge data from a table(s).. make sure you purge the data in small chunks. If you purge the data in larger chunks (rows), other processes trying to access the data on those tables have to go to the redo logs to access the data, since the purge job will put a lock on the table. This obviously adds latency to the queries.. So purge the data in smaller chunks (rows), forcing the database to flush the redo logs.