Ahoy there! This is my blog in which I jot down some of my experiences in IT (stuff related to my job and other random IT stuff). Hope you find something useful. My primary fields of interest in IT are Korn/Bash Shell Scripting, web/middleware/database technologies (ZXTM, Apache, WebLogic Server, Oracle, etc.), ICT Operations Management, ITIL and UNIX (any flavour/distribution).

Tutorials Archives

How to encrypt passwords for WebLogic 9.x+?

In WebLogic versions prior to 9, JSAFE decryption exceptions and password encryption could be resolved/performed by simply setting plain-text passwords in config.xml as described here.

However, in WebLogic versions later than 9.0, setting plain-text passwords in config.xml (Production mode environments) will throw the following error:

<Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: [Management:141266]Parsing Failure in config.xml: java.lang.IllegalArgumentException: In production mode, it’s not allowed to set a clear text value to the property: PasswordEncrypted of ServerStartMBean>

So, for WebLogic 9.x+ versions, if you doubt passwords in config.xml, you will need to encrypt plain-text passwords and configure them in config.xml as follows:

STEP 1: Encrypt the password you wish to change in config.xml.

Example: You experience JSAFE exceptions with the password of one of your connection pools and you doubt the encrypted password in config.xml.

  • Source the WebLogic environment (to set CLASSPATH and other variables) as follows:
cd <domain-dir>/bin
. ./setDomainEnv.sh

  • Encrypt the plain-text password as follows:
cd <domain-dir>
java weblogic.security.Encrypt <password>

STEP 2: Update the config files (config.xml, jdbc, etc.) with the encrypted password obtained above.

NOTE: The above encryption procedure will work even with earlier versions of WebLogic (e.g. 8.1).

VN:F [1.6.5_908]
Rating: +3 (from 3 votes)

First and foremost, if feasible, please consider a Hotspot JVM upgrade. The 1.4.2 JVM is outdated and there have been several significant improvements to GC ergonomics in later Hotspot JVMs. The JDK 1.4.2 Standard edition reached its EOL in late 2008. However, you can purchase support for later updates of JDK 1.4.2 (later than 1.4.2_19) that are branded under Java For Business (JFB) v1.4.2, to receive security updates and critical fixes until 2013. With regards to CMS, Sun engineers were finding their feet with CMS in JVM 1.4.2, enhanced CMS and made it the default collector in JVMs 5 and 6 and are about to replace CMS with G1 (Generation First) in JVM 7.

For those of you still using the Concurrent Mark Sweep (CMS) garbage collector with Hotspot JVM 1.4.2, here’s some information which I hope you will find useful.

What is CMS garbage collector?

The Concurrent (actually mostly concurrent) Mark Sweep (CMS) garbage collector is a non-default old (tenured) generation garbage collector introduced in JVM 1.4 that manages a JVM’s heap by collecting garbage in the old (tenured) generation in a few phases, some of which are concurrent and the others which are stop-the-world. As a consequence of the concurrent phases, this collector minimizes GC pauses and hence is also referred to as the low pause collector.

When would you use the CMS Collector?

When you want to minimize GC pauses (frequent requirement for websites and interactive applications)

Does CMS require more cpu and memory than the default collectors?

Yes. You need adequate CPU resources (multiple processors) as CMS adds CPU overhead by using a background thread for the concurrent phases. You need adequate memory to allocate slightly larger heaps than you would for the default collectors, as objects will continue to enter the old generation during the mostly concurrent phases.

How do you enable the CMS Collector?

Use the JVM flag -XX:+UseConcMarkSweepGC. When you do this, -XX:+UseParNewGC is implicitly used. However, you may explicitly specify -XX:+UseParNewGC if you wish (but it’s just redundant).

Note: You cannot use the default collector or the parallel scavenge collector (-XX:+UseParallelGC) in the Young Generation when using CMS in the old generation. CMS is tightly coupled with ParNewGC in the young generation. ParNewGC is an enhanced version of the parallel scavenge collector that enables GC to be done in the young generation while CMS is in progress in the old generation.

 Does the CMS Collector require tuning?

You’re lucky if the CMS collector gives you optimal performance by just enabling it with -XX:+UseConcMarkSweepGC. Every Hotspot 1.4.2 JVM I’ve come across (enterprise systems), has required some CMS tuning for optimal performance. Of course, this requirement entirely depends on your application’s object profile. But, if tuning your Hotspot 1.4.2 is required, then tuning CMS requires more effort than tuning the default collectors and CMS has a bunch of JVM flags to play around with. Some important JVM flags to consider when tuning CMS are given below:

What do you need to watch out for when using CMS (problems/gotchas)?

  • The dreaded concurrent mode failure – a failure which occurs when CMS’ concurrent GC phases are interrupted for certain reasons and a Serial, Mark-Sweep-Compact GC is required.
  • Default SurvivorRatio=1024 and Default MaxTenuringThreshold=0. Note that these are default values only when using CMS with JVM 1.4.2 and can trouble you if you’re tuning your JVM for short-lived objects. If your application creates mostly short-lived objects and you wish to use the Young Generation as a filter to retain these objects as long as possible and clean them up with minor GCs (parallel scavenges) to reduce the pressure on the CMS collector, then you must change these default values as these default values ensure that the survivor spaces are not used. Refer this article to understand the peculiarities of MaxTenuringThreshold.
  • The value set by –XX:CMSInitiatingOccupancyFraction is used as same threshold for both old and permanent generation occupancies. i.e. CMS GC will be initiated in the old and permanent generations when either one of or both the old and permanent generation occupancy exceeds the value of CMSInitiatingOccupancyFraction. This is inconvenient and it implies that you must pay close attention to permanent generation occupancy also and size the permanent generation appropriately.
  • The -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled JVM flags could increase remark pauses, but can contain permanent generation growth (prevent OutOfMemory errors caused by a full permanent generation) and protect against poor GC in old generation (objects in the old generation that are referenced by classes in the permanent generation will not be collected until the classes in the permanent generation are collected).

What tools are available to assist you with JVM tuning?

First and foremost, before tuning your 1.4.2 JVM, ensure you profile your application and resolve application issues (e.g. memory leak). To tune your JVM, you have tools which broadly fall under two categories:

Runtime Monitoring: These tools attach to your JVM to provide loads of runtime data. These tools are useful, when you’re monitoring your JVM in runtime and using these tools interactively. An excellent tool is VisualVM and its VisualGC plugin. A screenshot of the VisualGC plugin is given below:

VisualVM_VisualGC

GC Log File Analysis: These tools enable you to do offline analysis of GC log files and prepare reports for trend analysis. If you wish to run a load test for a couple of hours and measure performance after the test, then you will need to capture GC logfiles and analyze them with such tools. Now, in this area, Sun has been lacking good tools. HP chose a wise strategy of defining a specific format for GC logfiles generated by HP JDKs and developing the excellent HPjmeter to parse the logfiles and create fancy charts along with several metrics. Well, the Sun forums indicate that a GCHisto plugin is being developed to analyze Hotspot GC log files. I have tried out this plugin (beta) and found it to be nowhere as comprehensive and sophisticated as HPjmeter. Well, will wait for GCHisto to be completed and plugged into VisualVM before trying it out again.

In order to assist my colleagues and me with Hotspot JVM 1.4.2 GC log file analysis when using CMS, I’ve developed a quick-and-dirty korn shell script to provide a summary of some key GC metrics for a specific GC logfile. You may download the script CMSGCStats.ksh and execute it without arguments (ksh CMSGCStats.ksh) for usage tips. Refer a sample screenshot of the script’s output below:

 

CMSGCStats

References:

(1) JVM 1.4.2 Garbage Collectors

 

COLLECTOR GENERATION JVM FLAGS TO TURN ON DESCRIPTION
Serial Young None. Default. Single-threaded, stop-the-world, copying collector
Parallel Scavenge Young -XX:+UseParallelGC Multi-threaded, stop-the-world, copying collector (not to be used with CMS)
ParNew Young -XX:+UseParNewGC

Multi-threaded, stop-the-world, copying collector to be used along with CMS. This option is automatically turned on when using CMS and doesn’t have to be explicitly specified.

Serial Old Old None. Default.

Single-threaded, stop-the-world, mark-sweep-compact collector

CMS Old -XX:+UseConcMarkSweepGC

Mostly concurrent low-pause collector that uses a background thread for the concurrent phases.

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

How to join Xvid files (Microsoft Windows)?

Some movies may be distributed in more than one file (e.g. more than one CD). Recently, I purchased a movie in Xvid format which consisted of two parts (two Xvid files). So, here’s how I joined the files to generate one Xvid file and viewed the entire movie in one go:

STEP 1: Download and install an Xvid codec

Xvid is a video codec library for the MPEG-4 standard. I downloaded an Xvid codec here.

 

STEP 2: Download and install (extract) VirtualDub

VirtualDub is a free video capture/processing software for Microsoft Windows. You may download VirtualDub here.

 

STEP 3: Start VirtualDub and load the video files

Start VirtualDub ( VirtualDub  ) and load the video files as follows:

To load the first video file, click File –> Open video file on the Menu bar or type CTRL + O.

To load the remaining files, add them one at a time by clicking File –> Append AVI segment on the Menu bar.

 

STEP 4: Configure Audio and Video settings

For video, click Video –> Direct stream copy on the Menu bar.

For audio, click Audio –> Direct stream copy on the Menu bar.

 

STEP 5: Save the joined video file

To save all video files as one joined file, click File –> Save as AVI on the Menu bar, choose a filename and save.

VN:F [1.6.5_908]
Rating: +4 (from 4 votes)

The MaxTenuringThreshold for a Hotspot JVM

What is MaxTenuringThreshold?:

In a Sun Hotspot JVM, objects that survive Garbage Collection in the Young Generation are copied multiple times between Survivor Spaces before being moved into the Tenured (Old) Generation. The JVM flag that governs how many times the objects are copied between the Survivor Spaces is MaxTenuringThreshold (MTT) and is passed to a JVM as –XX:MaxTenuringThreshold=n , where n is the number of times the objects are copied. The default value of ‘n’ is (or actually was) 31.

Setting the MaxTenuringThreshold:

A few years ago, while my colleagues and I were tuning a 1.4.2_11 Hotspot JVM using flags like PrintTenuringDistribution and tools like  visualgc, we found that setting MTT=10 along with other flags gave us the best results (JVM throughput, pause time, footprint). However, recently when tuning a 1.4.2_11 Hotspot JVM for another application that had mostly short-lived objects, I suggested testing a value of MTT=80 (I still have no idea how the value 80 came to my mind) which is ridiculous as you’ll soon know. My objective was to retain the short-lived objects for as long as possible in the Young Generation to allow them to be collected by Minor GCs as opposed to the Full GCs in the tenured generation. Anyway, all our performance tests of the application on JVM 1.4.2_11 with MTT=80 and other JVM flags showed significant improvement in JVM performance than before (when it was untuned).

Last week, I came across some interesting proposals discussed among Sun engineers last year, regarding modifying the way MTT is handled by the JVM. I don’t know whether the proposals have been implemented, but they give some good insight into how MTT works. To quote those discussions,

Each object has an "age" field in its header which is incremented every time an object is copied within the young generation. When the age field reaches the value of MTT, the object is promoted to the old generation (I’ve left out some detail here…). The parameter -XX:+NeverTenure tells the GC never to tenure objects willingly (they will be promoted only when the target survivor space is full). (out of curiosity: does anyone actually use -XX:+NeverTenure?) Originally, in the HotSpot JVM, we had 5 bits per object for the age field (for a max value of 31, so values of MTT would make sense if they were <= 31). A couple of years ago (since 5u6 IIRC), the age field "lost" one bit and it now only has 4 (for a max value of 15).

Refer http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2008-May/000309.html for more details. So, basically , when I set MTT=80, the JVM would have actually “never tenured” the objects in the Young Generation until the Survivor Spaces were full. Hope Sun have fixed that problem as per the proposal or at least provide proper documentation (similar to the referenced article) for their JVMs which explains how MTT works. Well, MTT=80 did not have an adverse impact on our application, but we eventually switched to MTT=8 (the value 8 was a guess and didn’t provide very different results). I suggest that MTT is not set at first and be used only if your analysis of GC logs and your requirements indicate that you need to retain short-lived objects in the Young Generation for longer. As a matter of fact, when tuning a JVM, always start with basic flags for Heap Size and nothing else. Then, based on load tests, customer experience metrics (e.g. response time, response errors) and analysis of GC logs, set JVM flags and retest. Tuning is iterative and apart from all the tools available, a must-have quality (especially for complex applications) is patience.

VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

Last weekend, I upgraded Windows Vista Ultimate to Windows 7 Ultimate on my Dell Studio xps laptop. I chose to upgrade, rather than perform a complete installation because I have too many programs and a lot of data on my laptop and I didn’t want any overhead in dealing with them. It’s just around seven months since I purchased my laptop and already my DVD drive isn’t working (will need to contact Dell Support and use the warranty). This is 2nd time I’m using the warranty on a Dell laptop to replace a DVD drive (the first time was with my Dell Inspiron 8500), but I still chose to buy Dell, only because Dell provided the most customization options when purchasing the laptop (now running out of patience with Dell).

So, with my DVD drive bust, I needed to perform the upgrade from a USB flash drive. I’ve been using USB flash drives for a few years and since the last couple of years, I’ve stuck with the retractable SanDisk Cruzer Titanium USB flash drives. I like the retractability and the solid build of these drives. I have the 2 GB and 8 GB capacities of the SanDisk flash drive and had to use the 8 GB  flash drive for the upgrade. The upgrade steps I performed are given below:

STEP 1: Choose the correct upgrade edition of Windows 7 Ultimate.

I first obtained the Windows 7 Ultimate N edition and then during installation, a window popped up telling me that I cannot upgrade from Windows Vista Ultimate to Windows 7 Ultimate N and need to do a complete install.

Refer to the Windows 7 upgrade paths to ensure you obtain the correct Windows 7 edition for your upgrade.

STEP 2: Download/Copy the Windows 7 Ultimate ISO image to your hard drive (use SSD if you have one for faster copying).

I downloaded the Windows 7 Ultimate ISO image (en_windows_7_ultimate_x64_dvd_x15-65922.iso – around 3 GB) to my laptop’s HDD.

If you’re downloading the ISO image, ensure that you have sufficient free space in your download location and you turn off your computer’s power saving feature so that your computer does not sleep.

Downloading the ISO frustrated me – my first attempt failed because Google Chrome simply balked after downloading 2.8 GB, my second attempt (using Mozilla Firefox) failed because my laptop went to sleep and I finally downloaded the entire ISO image successfully on my third attempt.

STEP 3: Create a Windows 7 Ultimate bootable USB flash drive

You cannot install/upgrade Windows 7 directly from the ISO. You first need to create Windows 7 bootable media. Popular media are DVDs and USB flash drives (USB 2.0 flash drives are faster than current DVDs for data reading/writing operations and this advantage will significantly increase with USB 3.0). Microsoft provides a free Windows 7 USB/DVD Download tool. If Microsoft removes this tool from their website (I believe there was an issue with using some open source code in the software), then you can get it from other websites or let me know and I can provide you with the tool. Screenshots of the tool are given below:

windows7 USB/DVD Download Tool - STEP 1

Windows 7 USB/DVD Download Tool - STEP 2

Windows 7 USB/DVD Download Tool - STEP 3 

Windows 7 USB/DVD Download Tool - STEP 4 

STEP 4: Prepare for Upgrade

Use the Windows 7 Upgrade Advisor to ensure you meet all the requirements for the upgrade. I had to install Windows Vista Ultimate updates and SP1 to meet the requirements.

 

STEP 5: Upgrade

Click the “setup” file on your Windows 7 Ultimate bootable flash drive and proceed with the upgrade. You will be required to reboot your computer a few times. I don’t remember how long this process took as I was doing it while half asleep at night. All I know, come dawn, I woke up to Windows 7 Ultimate on my laptop.

My first impressions of Windows 7 Ultimate:

So, I’ve used Windows 7 Ultimate only for a week and haven’t really explored much, but some of the good features that impressed me straight away:

(1) Very fast: Windows 7 Ultimate is the fastest Windows OS I have ever used. Perhaps, running the 64-bit version on a dual-core chip with 4 GB plays a major role, but I can perform routine operations quickly.

(2) Jump Lists: No more looking for “Recent Documents” and thinking about where you stored a specific resource. Just use the “jump list” on the appropriate program and you can jump right away to what you want. Given below is a screenshot of my Adobe Reader jump list displaying the recent pdf files I used.

AcrobatReader_JumpList

(3) Snap: Drag windows to screen edges and they resize appropriately. I found this especially useful when using programs that required me to “drag and drop” files from an explorer window into the program’s window (an example of such a program is the Samurai Thread Dump Analyzer).

Well, there is a lot more for me to explore in Windows 7 and I’m specifically interested in Windows 7 Ultimate features like SUA.

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

UNIX shell commands return exit statuses or exit codes upon completion, irrespective of whether successful or not. In UNIX, an exit status of 0 indicates successful execution of a command and a non-zero exit status indicates a failure. Some shells (e.g. ksh93) document the various exit statuses and their meanings. So, checking exit statuses of commands is typically done in programs like shell scripts to decide further action to be taken by the script.

However, piped commands or a pipeline (cmd A | cmd B), add a twist to checking exit statuses as by default, most UNIX shells adhere to the POSIX requirement of returning the exit status of the last command in the pipe. Refer the example below:

 

#
# Two commands piped and both commands are successful.
#
$ grep MemTotal /proc/meminfo | awk '{print $2}'; echo "EXIT STATUS = $?"                                                                      
1056836
EXIT STATUS = 0
#
# Two commands piped and first command throws an error.
# Note that the EXIT STATUS is still 0
#
$ grep MemTotal /proc/meminf | awk '{print $2}'; echo "EXIT STATUS = $?"
grep: /proc/meminf: No such file or directory
EXIT STATUS = 0

 

So, checking the exit status of a pipeline as in the above example will cause problems for your script if any of the piped commands other than the last command throw an error. Given below are two solutions (using ksh93 and bash) to solve this problem and ensure a valid exit status check for a pipeline:

SOLUTION 1: Using ksh93 and the pipefail option

The Korn Shell 1993 version ‘g’ point release (ksh93g) introduced a pipefail option which ensures that the exit status of a pipeline will be that of the first command in the pipe that has failed (of course, the exit status of the pipeline will be 0 if all commands in the pipe succeed). Unfortunately, ksh88 is distributed as the default Korn Shell with most UNIX systems (with all Solaris versions I believe) because ksh93 is owned by Lucent and AT&T and there were licensing restrictions. Refer I (Q.14) and III (Q.8) of the Korn shell FAQs at http://kornshell.com/doc/faq.html

An example of how the pipefail option is used is shown below:

 

#
# Check ksh version
#
$ ksh --version
  version         sh (AT&T Research) 93s+ 2008-01-31
#
# Set pipefail option on (it's off by default)
#
$ set -o pipefail
#
# Now, notice the non-zero exit status due to the error in the first command
#
$ grep MemTotal /proc/meminf | awk '{print $2}'; echo "EXIT STATUS = $?"
grep: /proc/meminf: No such file or directory
EXIT STATUS = 2

 

Note: There are other solutions using ksh88 with co-processes and file descriptor manipulation, but those solutions are not script-friendly.

 

SOLUTION 2: Using bash and the PIPESTATUS array

The bash shell uses an array called PIPESTATUS to store the exit statuses of commands in a pipeline.

 

#
# Using the PIPESTATUS array to display exit statuses of both commands in the pipe
#
mrkips@mrkips-laptop:~$ grep MemTotal /proc/meminf | awk '{print $2}'; echo "EXIT STATUS = ${PIPESTATUS[0]}"
 
grep: /proc/meminf: No such file or directory
 
EXIT STATUS = 2
 
 
mrkips@mrkips-laptop:~$ grep MemTotal /proc/meminf | awk '{print $2}'; echo "EXIT STATUS = ${PIPESTATUS[1]}"
 
grep: /proc/meminf: No such file or directory
 
EXIT STATUS = 0

 

Be aware of SIGPIPE

SIGPIPE is a signal sent to a process (that causes the process to terminate) that writes to a pipe when there is nothing to read from the pipe. If you use any of the above mthods to check the exit status of a pipeline and a SIGPIPE is received by one of the commands in the pipeline, then your exit status may not correlate with the success/failure of the pipeline.

For example, in the command,

ls -lrt | head -1

“ls -lrt” writes to a pipe and “head -1″ reads from that pipe. Now, “head -1″ only requires the first line from the pipe and as soon as it gets it, it terminates and sends a SIGPIPE (signal 13) to “ls -lrt” causing “ls -lrt” to terminate with a non-zero exit code.

 

NOTE:

(1) The how-to above describes how I implemented something and may not be the only method of implementation.

(2) Your rating of this post will be much appreciated. Also, feel free to leave comments.

VN:F [1.6.5_908]
Rating: +2 (from 2 votes)

How to determine UNIX process elapsed time

At times, you may want to determine the elapsed wall-clock time or uptime for a running process. While you can determine the process’ elapsed time using certain versions of the ps utility, it can also be determined using a simple shell script with a bit of perl. Both these methods are described below with the init process (PID = 1):

SOLUTION 1: The ps utility on some variants of UNIX (e.g. Linux, but not Solaris)

ps -oetime 1
    ELAPSED
      39:45

 

SOLUTION 2: A shell script with a bit of perl (should work on all variants of UNIX)

Download the shell script (puptime.ksh) or copy and paste from below:

#!/bin/ksh
# puptime.ksh - Gavin Satur - http://it.cybergav.in/2009/11/09/puptime
# Simple script to calculate the uptime (elapsed wall clock time) of a process
##############################################################################
#
# Accept PID and do some basic validation
#
proc_pid=$1
if [ -z "$proc_pid" ]; then
   print "\nERROR : Missing input argument. SYNTAX: ksh puptime.ksh <pid>\n"
   exit 999
fi
if [ ! -d /proc/$proc_pid ]; then
   print "\nERROR : No directory for PID $proc_pid in /proc. Check if process is running!\n"
   exit 999
fi
#
# Calculate start time of process and current time in epoch time using a bit of perl
#
proc_stime=`perl -e 'use File::stat;  my $filename = "$ARGV[0]"; $sb = stat($filename); printf "%s", $sb->mtime;' /proc/$proc_pid`
currtime=`perl -e 'print time;'`
#
# Calculate process uptime in seconds and then slice'n'dice for human-friendly output
#
proc_time=$(( currtime - proc_stime ))
proc_time_days=$(( proc_time / 86400 ))
proc_time_secs=$(( proc_time % 86400 ))
proc_time_hours=$(( proc_time_secs / 3600 ))
proc_time_secs=$(( proc_time_secs % 3600 ))
proc_time_minutes=$((proc_time_secs / 60 ))
proc_time_secs=$(( proc_time_secs % 60 ))
print "\nUPTIME FOR PROCESS WITH PID $proc_pid = $proc_time_days day(s) $proc_time_hours hour(s) $proc_time_minutes minute(s) $proc_time_secs second(s) \n"
./puptime.ksh 1
UPTIME FOR PROCESS WITH PID 1 = 0 day(s) 0 hour(s) 39 minute(s) 37 second(s)
VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

Switching domains for a Wordpress blog

My blogs are hosted on hostmonster and run on the Wordpress platform. About 8 months ago, before I started blogging (finally!), I researched the pros and cons of various blogging platforms and tried out a few before selecting Wordpress. So far, it’s been a great experience blogging using Wordpress.

When I first started blogging, I registered the domain www.mrkips.com for my blogs. A few days ago, I registered another domain www.cybergav.in (a domain name which relates more to  me and my ethnic roots). Yesterday, I finally switched my blogs from mrkips.com to cybergav.in and although the Wordpress forums provide adequate information on how to do this task, I’m describing the process below which worked for me.

Let’s say you host your Wordpress blog on hostmonster (process should be applicable to most hosting platforms) and wish to switch its domain from www.abc.com to www.xyz.com.

 

STEP 1: Register your domain and specify DNS servers

Register your new domain xyz.com after doing a bit of research and choosing an appropriate registrar (typical factors in choosing a registrar are cost, DNS management facility, Domain privacy (not available for all ccTLDs) and customer service – there are other goodies usually provided such as web forwarding, domain cloaking, etc.). When you select your registrar and register your domain, you must ensure that you use the registrar’s DNS management facility to configure the DNS servers belonging to your hosting platform. For example, for my domain, I configured my DNS servers as ns1.hostmonster.com and ns2.hostmonster.com. It is this DNS configuration that will ensure the required DNS A records are inserted in your hosting platform’s DNS servers to map your domain name with your hosting account (and consequently your website).

 

STEP 2: Verify your domain

My domain was registered in less than half an hour and I could verify its registration using a WHOIS search. If your domain name registrar and hosting provider are different companies, then ensure you inform your hosting provider after registering your domain. My hosting provider switched my primary domain to cybergav.in and I configured mrkips.com as a parked domain. Now before you migrate your website to your new domain, you must verify if your new domain is resolvable. To do this, you can either use any one of the myriad websites available (e.g. www.who.is ) or use the nslookup utility as follows:

#
# SYNTAX 1: nslookup <domain name>
#
c:\>nslookup cybergav.in
Server:  BeBox.config
Address:  192.168.1.130:53
 
Non-authoritative answer:
Name:    cybergav.in
Address:  66.147.240.162
 
#
# SYNTAX 2: nslookup <domain name> <dns server>
#
c:\>nslookup cybergav.in ns1.hostmonster.com
Server:  UnKnown
Address:  74.220.195.131:53
 
Name:    cybergav.in
Address:  66.147.240.162

STEP 3: Change your Wordpress blog’s domain name

(i) Define the WP_HOMEand WP_SITEURLvariables: This is required in order to give your Wordpress blog its new domain name and access its Administration console (wp-admin). You do this by adding the following in wp-config.php (in the root of your Wordpress installation):

define('WP_HOME','http://www.xyz.com');
define('WP_SITEURL','http://www.xyz.com');

 

(ii) Update your blog’s Wordpress database by ensuring that URLs containing your old domain reflect your new domain as per the following example :

UPDATE wp_posts SET guid = REPLACE (
guid,
'abc.com',
'xyz.com');
 
UPDATE wp_posts SET post_content = REPLACE (
post_content,
'abc.com',
'xyz.com');

 

STEP 4: Redirect all traffic from your old domain to your new domain

After getting your blog up and running with your new domain name, you must redirect all traffic arriving at your old domain to your new domain to ensure your users and search engines know that you’ve switched domains. You must use a HTTP 301 Redirect method (permanent move) so that search engines and browsers will recognize your blog’s new home. You can configure this redirect by either using your hosting provider’s management tools or configuring .htaccess (Apache web server) as per the following example:

 

RewriteEngine On
RewriteCond %{HTTP_HOST} ^abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.abc.com$
RewriteRule ^/?$ "http\:\/\/www\.xyz\.com\/" [R=301,L]
VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

How to determine the Linux distribution

If you’re given access to a Linux machine without being told the Linux distribution being used, there are a couple of ways by which you can determine the Linux distribution

OPTION 1: Use the lsb_release utility.

The Linux Standard Base (LSB) is a joint project by several Linux distribution vendors working under the Linux Foundation, to develop and promote a set of open standards that will increase compatibility among Linux distributions and enable software applications to run on any compliant system even in binary form.

The lsb_release utility which is part of all Linux distributions which adhere to the LSB specification will print distribution specific information. Check the lsb_release manpage for details on usage. Example screenshots of using lsb_release on Ubuntu and Fedora distributions are given below:

 

lsb_release_ubuntu

 

lsb_release_fedora

 

OPTION 2: Check release files in /etc.

Linux distribution vendors typically include release files with details about the distribution, in the /etc directory. Screenshots of examples showing how to check such files on Ubuntu and Fedora are given below:

 

etc_release_ubuntu

 

etc_release_fedora

VN:F [1.6.5_908]
Rating: +1 (from 1 vote)

WebLogic – IP Multicast : A primer

In Oracle WebLogic (formerly BEA WebLogic) versions prior to version 10.0, WebLogic Servers relied on IP multicast to ensure cluster membership (versions 10.0 and later provide the alternative of Unicast which is preferred over Multicast). This article will pertain to IP multicast used by WebLogic.

What is IP multicast?

IP multicast is a technology used to broadcast data (or datagrams) across a network using IP. For IP multicasting, certain special IP addresses called multicast addresses are defined. According to the Internet Assigned Numbers Authority (IANA), its RFC3171 guidelines specify that addresses 224.0.0.0 to 239.255.255.255 are designated as multicast addresses. A multicast address is associated with a group of receivers. When a sender wishes to send a datagram to a group of receivers using IP multicast, it will send the datagram to the multicast address/port associated with that group of receivers. When routers or switches on the network receive the datagram, they know which servers (receivers) are associated with the multicast address (using IGMP) and so they make copies of the datagram and send a copy to every registered receiver. This is illustrated in the figure below:

 

HowMulticastingWorks

 

Why does WebLogic use IP multicast?

A WebLogic Cluster is a group of WebLogic servers which provides similar services, with resilience (if a server crashes and exits the cluster, it can rejoin the cluster later), high availability (if a server in the cluster crashes, other servers in the cluster can continue the provision of services) and load balancing (the load on all servers in a cluster can be uniformly distributed) for an application deployed on a WebLogic cluster. WebLogic makes these beneficial clustering features possible by using IP Multicast for the following:

(1) Cluster heartbeats: All servers in a WebLogic cluster must always know which servers are part of the cluster. To make this possible, each server in the cluster uses IP multicast to broadcast regular "heartbeat" messages that advertise its availability.

(2) Cluster-wide JNDI updates: Each WebLogic Server in a cluster uses IP multicast to announce the availability of clustered objects that are deployed or removed locally.

 

How does WebLogic use IP multicast?

All servers in a WebLogic Cluster send out multicast fragments (heartbeat messages) from their interface addresses to the multicast IP address and port configured for the WebLogic Cluster. All servers in the cluster are registered with the multicast address and port and so every server in the cluster receives fragments from all other servers in the cluster as well as the fragment it sent out. So, since every server in the cluster sends out fragments every 10 seconds, based on the fragments it receives, it can determine which servers are still part of the cluster. If a server (say Server A) does not receive a fragment from another server in the cluster within 30 seconds (3 multicast heartbeat failures), then it will remove that server from its cluster membership list. When fragments from the removed server start arriving at Server A, then Server A will add the removed server back to its cluster membership list. This way, every server in a WebLogic cluster maintains its own cluster membership list. Regarding cluster-wide JNDI updates, each server instance in the cluster monitors these announcements and updates its local JNDI tree to reflect current deployments of clustered objects.

Note: Clustered server instances also monitor IP sockets as a more immediate method of determining when a server instance has failed.

The figure below illustrates how a WebLogic cluster uses IP multicast.

 

HowWebLogicUsesIPMulticast

 

How do you configure and test multicast for a WebLogic Cluster?

Configuring IP Multicast for a WebLogic Cluster is simple. The steps required are given below:

STEP 1: If your WebLogic cluster is part of a network containing other clusters, obtain a multicast address and port for it, from your Network Admins. Understandably, a multicast address and port combination is unique for every WebLogic cluster. Several WebLogic clusters may share the same multicast address if and only if they use different multicast ports. Typically, in organizations, network admins allocate multicast addresses and ports for various projects to ensure there are no conflicts across the network. By default, WebLogic uses a multicast address of 237.0.0.1 and the listen port of the Administration server as the multicast port.

 

STEP 2: Having obtained a multicast address and port for your WebLogic cluster, you must test them before starting your WebLogic cluster to ensure that there are no network glitches and conflicts with other WebLogic clusters. You may do so with the MulticastTest utility provided with the WebLogic installation (part of weblogic.jar). An example test for a cluster containing 2 WebLogic servers on UNIX hosts and using multicast address/port of 237.0.0.1/30000 is given below:

# Command to run on both server hosts (any one of the following within the WebLogic domain directory)
# to set the WebLogic domain environment
. ./setDomainEnv.sh
. ./setEnv.sh
 
# Command to run on server 1 (within any directory)
${JAVA_HOME}/bin/java utils.MulticastTest -N server1 -A 237.0.0.1 -P 30000
 
# Command to run on server 2 (within any directory)
${JAVA_HOME}/bin/java utils.MulticastTest -N server2 -A 237.0.0.1 -P 30000
 
# NOTE: Both java commands must be run on both WebLogic server hosts concurrently.

 

View screenshots of the tests executed (on Windows Vista) when the WebLogic cluster was running (conflicts between test and running cluster outlined in red) and when the WebLogic cluster was stopped, by clicking on the images below:

 

utils.MulticastTest with cluster running - click to view     utils.MulticastTest with cluster stopped - click to view

 

Note: On Vinny Carpenter’s blog, he mentions a problem when using the utils.MulticastTest utility bundled with WebLogic Server 8.1 SP4. Well, I have never faced any issues with the utils.MulticastTest utility, but I am not sure if I’ve used it with WLS 8.1 SP4.

 

STEP 3: After successfully testing the multicast address and port, you may use the WebLogic Administration Console to configure multicast for the cluster. Descriptions of various multicast parameters are available on the console itself. The three most important parameters are (1) Multicast Address, (2) Multicast Port and (3) Interface Address. The Interface Address may be left blank if the WebLogic servers use their hosts’ default interface. On multi-NIC machines or in WebLogic clusters with Network channels, you may have to configure an Interface Address. Given below is a screenshot from a WLS 8.1 SP6 Administration Console indicating the various multicast parameters that may be configured for a cluster. Note that the interface address is on a different screen as it is associated with each server in the cluster, rather than the cluster itself.

 

ConfigureMulticast

 

After configuring Multicast for a WebLogic cluster, you can monitor the health of the cluster and exchange of multicast fragments among the servers in the cluster by using the WebLogic Administration console. A screenshot of such a monitoring screen with WLS 8.1 SP6 is given below:

 

Monitoring a WebLogic Cluster using the Administration Console

 

Note that the screenshot above indicates that:

(1) All servers are participating in the cluster ("Servers" column).

(2) Every server in the cluster is aware of every other server in the cluster. The "Known Servers" column is especially useful for large clusters to know exactly which servers are not participating in the cluster.

(3) The total number of fragments received by each server (34) is equal to the sum of all the fragments sent by all the servers in the cluster (17 + 17). Note that the "Fragments Sent" and "Fragments Received" columns on the console need not always indicate a correct relationship even if multicast works fine. That’s because these stats on the console are reset to 0 when servers are restarted.

 

Troubleshooting WebLogic’s Multicast configuration

When you encounter a problem with WebLogic multicast (or any problem for that matter), it is important to confirm the problem by executing as many tests as possible and gather as much data as possible when the problem occurs. For WebLogic multicast, you may confirm the problem by using the MulticastTest utility or checking the Administration console as described above. To troubleshoot WebLogic multicast, refer to the Oracle documentation. Also, check the section below to determine if the problem you’ve encountered is similar to one of the problems described, to provide you with a quick resolution.

 

WebLogic Multicast eureka!

Given below are WebLogic multicast problems which I’ve encountered and investigated, along with solutions that worked:

 

PROBLEM 1:

SYMPTOMS: All WebLogic servers could not see any other server in the cluster. Tests using the MulticastTest utility failed indicating that all servers could only receive the multicast fragments which they sent out.

ANALYSIS: The MulticastTest utility was tried with the correct multicast address, multicast port and interface address. No conflict with any other cluster was observed, but no messages were received from other servers. Assuming that all servers in the cluster are not hung, the symptoms indicate a problem with the underlying network or the multicast configuration on the network.

SOLUTIONS:

Solution 1: The Network Admin just gave us another multicast address/port pair and multicast tests worked. The multicast address/port pair which failed was not registered correctly on the network.

Solution 2: The Network Admin informed us that more than one switch was used on the cluster network and this configuration did not ensure that multicast fragments sent by one server in the cluster were copied and transmitted to other servers in the cluster. Refer to this CISCO document for details regarding this problem and its solutions. As a tactical solution, the Network Admin configured static multicast MAC entries on the switches (Solution 4 in the CISCO document). This tactical solution requires the Network Admin to maintain those static entries, but since there weren’t too many WebLogic clusters using multicast on the network, this solution was chosen.

Solution 3: The two managed servers in a cluster were in geographically separated data centres and several hops across the network were required for the servers to receive each other’s multicast fragments. Increasing the multicast TTL solved this problem and both the MulticastTest utility and the WebLogic servers successfully multicasted.


PROBLEM 2:

SYMPTOMS: The following errors were seen in the WebLogic managed server logs and the managed servers did not start.

Exception:weblogic.server.ServerLifecycleException: Failed to listen on multicast address
weblogic.server.ServerLifecycleException: Failed to listen on multicast address
        at weblogic.cluster.ClusterCommunicationService.initialize()V(ClusterCommunicationService.java:48)
        at weblogic.t3.srvr.T3Srvr.initializeHere()V(T3Srvr.java:923)
        at weblogic.t3.srvr.T3Srvr.initialize()V(T3Srvr.java:669)
        at weblogic.t3.srvr.T3Srvr.run([Ljava/lang/String;)I(T3Srvr.java:343)
        at weblogic.Server.main([Ljava/lang/String;)V(Server.java:32)
Caused by: java.net.BindException: Cannot assign requested address
        at jrockit.net.SocketNativeIO.setMulticastAddress(ILjava/net/InetAddress;)V(Unknown Source)
        at jrockit.net.SocketNativeIO.setMulticastAddress(Ljava/io/FileDescriptor;Ljava/net/InetAddress;)V(Unknown Source)
        .
        .
        .

ANALYSIS: The errors occured irrespective of whichever multicast address/pair was used. The error indicates that the WebLogic server could not bind to an address to send datagrams to the multicast address. i.e. it could not bind to its Interface Address

SOLUTION: The WebLogic server host was a multi-NIC machine and another interface had to be specified for communication with the multicast address/port. Specifying the correct interface address solved the problem.


PROBLEM 3:

SYMPTOMS: The following errors were seen in the WebLogic managed server logs. The managed servers were running, but clustering features (like JNDI replication) were not working.

####<May 20, 2008 4:00:58 AM BST> <Error> <Cluster> <kips1host> <kips1_managed1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1211252458100> <BEA-000170> <Server kips1_managed1 did not receive the multicast packets that were sent by itself>
####<May 20, 2008 4:00:58 AM BST> <Critical> <Health> <kips1host> <kips1_managed1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1211252458100> <BEA-310006> <Critical Subsystem Cluster has failed. Setting server state to FAILED.
Reason: Unable to receive self generated multicast messages>

ANALYSIS: The errors above indicate that the WebLogic server kips_managed1 could not receive its own multicast fragments from the multicast address/port. Probably, the server’s multicast fragments did not reach the multicast address/port in the first place and this points to an issue with the configuration of the interface address or route from interface address to multicast address/port or multicast address/port (most likely the interface address or route as if the multicast address/port were wrong, the server would not have received multicast fragments from any other server, as in PROBLEM 1).

SOLUTION: The WebLogic server kips_managed1 used -Dhttps.nonProxyHosts and -Dhttp.nonProxyHosts JVM parameters in its server startup command and these parameter values did not contain the name of the host which hosted kips_managed1. After including the relevant hostname in these parameter values, the errors stopped occurring. I am not sure how these HTTP proxy parameters affected self-generated multicast messages (will try to investigate this).


PROBLEM 4:

SYMPTOMS: All WebLogic servers were often (not always) part of a cluster and intermittently, servers in the cluster were removed and added and the LostMulticastMessageCount was increasing for some servers in the cluster. However, tests using the MulticastTest utility (when the cluster was stopped) were successful.

ANALYSIS: The problem occurred intermittently when the WebLogic servers were running, but never occurred when using the MulticastTest utility. This indicates that the underlying IP multicast works fine and something is preventing the servers in the cluster from IP multicasting properly. Further analysis revealed that the servers had issues with JVM Garbage Collection with long stop-the-world pauses (> 30 secs) during which the JVM did absolutely nothing else other than garbage collection. Also, the times of occurrences of these long GC pauses correlated with the times of increases in LostMulticastMessageCount and removal of servers from the cluster.

SOLUTION: The JVMs hosting the WebLogic servers were tuned to minimize stop-the-world GC pauses to allow the servers to multicast properly. For the specific GC problem I encountered, you may refer to the tuning details here.


Reference: Oracle documentation

 

NOTE:

Your rating of this post will be much appreciated. Also, feel free to leave comments (especially if you have constructive negative feedback).

VN:F [1.6.5_908]
Rating: +2 (from 2 votes)

When using the Concurrent Low Pause or Concurrent Mark Sweep Garbage collector with a Sun Hotspot JVM, you may observe the following "concurrent mode failures" errors in your GC logs or stderr:

(concurrent mode failure): 1404669K->602298K(1482752K), 35.9660286 secs] 1988728K->602298K(2096576K), 46.2083962 secs]

A concurrent mode failure indicates that a concurrent garbage collection of the tenured generation did not complete before the tenured generation filled up.

 

Impact of a concurrent mode failure: When a 1.4 JVM encounters a concurrent mode failure, it will trigger the default stop-the-world garbage collector in the tenured generation, resulting in a relatively long pause. In the example error above, note that the concurrent mode failure results in a GC (default stop-the-world) of around 46 seconds.

 

When does it occur?: A concurrent mode failure typically occurs with the following scenarios:

(1) Heavy load: Heavy load on the application running in the JVM, causing a huge promotion from the young to the tenured generation is typically what causes concurrent mode failures.

(2) Young generation guarantee failure: With JVM 1.4, a requirement for successful promotions from young to tenured generation is to have a contiguous block of free space equal to the size of the young generation, in the tenured generation to cater to the worst case requirement of having to promote all objects. Even if there is required space in the tenured generation, but it is not contiguous (i.e. it is fragmented), promotion failures and concurrent mode failures could occur. Fragmentation problems typically manifest themselves after a long period of continuous use. So, your application and JVM may be running fine for a while and suddenly (when the tenured generation is too fragmented) exhibit these problems.

 

How to fix it?: To fix these concurrent mode failures with JVM 1.4, typical solutions are:

(1) Increase the size of the JVM heap and consequently the size of the old generation.

(2) Tune the JVM depending on your application profile.

(3) Scale your platform to distribute load and subject each JVM to a smaller load.

 

JVM Tuning: My colleagues and I observed that our Hotspot 1.4.2_11 JVMs running WebLogic 8.1 SP6 threw several concurrent mode failures during peak load, at specific times of the day. The JVM heap for each WebLogic managed server was 2 GB which was already quite big (cannot increase much more anyway, as were using a 32-bit 1.4.2 JVM on Solaris 9). So, we decided to tune the JVM. Here are details of our JVM tuning to significantly reduce the number of concurrent mode failures:

 

(1) JVM Options before tuning: Given below, are the JVM parameters used when the problem occurred (WLjvm output):

**************************************************************************************************
JVM DETAILS FOR WEBLOGIC SERVER m1 (PID = 9999)
**************************************************************************************************
 
VERSION & BUILD
===============
 
java version "1.4.2_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
 
OPTIONS
=======
 
-Dbt.weblogic.RootDirectory=/software/weblogic
-Dbt.weblogic.RootDirectory=/software/weblogic
-Dweblogic.Name=m1
-Dweblogic.ProductionModeEnabled=true
-Dweblogic.management.server=http://localhost:50000
-Dweblogic.system.BootIdentityFile=/software/weblogic/boot.properties
-XX:+CMSParallelRemarkEnabled
-XX:+JavaMonitorsInStackTrace
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+UseConcMarkSweepGC
-XX:+UseLWPSynchronization
-XX:+UseParNewGC
-XX:+UsePerfData
-XX:MaxNewSize=600m
-XX:MaxPermSize=128m
-XX:NewSize=600m
-Xloggc:/software/weblogic/logs/GC/m1_200909012300.log
-Xms2048m
-Xmx2048m
-Xoss2m
-Xss2m
-server
 
**************************************************************************************************

 

(2) GC Analysis: I used PrintGCStats to analyze GC logs. It is also important to determine the CMSInitiatingOccupancyFraction (the % occupancy of the tenured generation at which a CMS GC is triggered). As the JVM options above do not set this parameter, the JVM calculates its own CMSInitiatingOccupancyFraction  at runtime. The default for JVM 1.4.2 is 68%, but do NOT assume that the JVM always uses the default if you do not specify this parameter. Instead, analyze the GC logs to understand when the JVM triggers a CMS GC. The script CMSGCStats.ksh (formerly CMSGCTrigger.ksh) may be used for this purpose, along with the provision of other metrics. By using PrintGCStats and CMSGCTrigger.ksh, we determined that a lot of objects were promoted to the tenured generation and CMS GC was mostly triggered at 50% occupancy of the tenured generation with some occurrences between 60% to 75% also.

 

(3) Requirements Analysis: Our application mostly created short-lived objects and very low latency was not critical due to the mostly asynchronous services provided by the application. Hence, our goal was to retain most of the objects for as long as possible in the young generation, to facilitate their garbage collection in the Young generation, thereby promoting fewer objects to the tenured generation and reducing the probability of filling up the tenured generation during a CMS GC (causing concurrent mode failures).

 

(4) Implementation:

In order to garbage collect objects in the Young Generation and decrease the number of objects being promoted to the tenured generation, we tuned the following parameters:

 

JVM Parameter Why selected for tuning
-XX:NewSize, -XX:MaxNewSize These parameters control the size of the Young generation. Increasing the size of the Young generation increases probability of more garbage collection in the Young Generation. Rule of thumb is to size the Young generation to 3/8 of the maximum heap size.
-XX:MaxTenuringThreshold This parameter determines how long the objects in the Young generation may age (number of times they are copied between survivor spaces before being promoted to the Tenured generation). The default is 31. Increasing the value of this parameter increases probability of more garbage collection in the Young Generation. Refer to this article for more details.
-XX:TargetSurvivorRatio This parameter sets the desired percentage of the survivor spaces which must be used before objects are promoted to the Tenured generation. The default is 50. Increasing the value of this parameter increases probability of more garbage collection in the Young Generation.
-XX:SurvivorRatio This parameter is the ratio of the size of Eden to the size of each survivor space (SR = EdenSize/SurvivorSpaceSize) and hence it can be used to set the size of a survivor space. Decreasing the value of this parameter ensures larger survivor spaces and increases probability of more garbage collection in the Young Generation

 

In order to override the JVM’s choice of when to trigger a CMS GC in the tenured generation, we tuned the following parameters:

 

JVM Parameter Why selected for tuning
-XX:CMSInitiatingOccupancyFraction This parameter sets the threshold percentage occupancy of the old generation at which the CMS GC is triggered. The default for JVM 1.4.2 is 68, but the JVM deviates from this default at runtime. So, setting this parameter explicitly tells the JVM when to trigger CMS GC in the tenured generation.
-XX:+UseCMSInitiatingOccupancyOnly This parameter tells the JVM to use only the value defined by -XX:CMSInitiatingOccupancyFraction , rather than try to also calculate the value at runtime.

 

(5) Results: Based on 5 iterations of testing with different sets of the parameters mentioned above, we obtained best results with the following JVM parameters:

**************************************************************************************************
JVM DETAILS FOR WEBLOGIC SERVER m1 (PID = 8888)
**************************************************************************************************
 
VERSION & BUILD
===============
 
java version "1.4.2_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
 
OPTIONS
=======
 
-Dbt.weblogic.RootDirectory=/software/weblogic
-Dbt.weblogic.RootDirectory=/software/weblogic
-Dweblogic.Name=m1
-Dweblogic.ProductionModeEnabled=true
-Dweblogic.management.server=http://localhost:50000
-Dweblogic.system.BootIdentityFile=/software/weblogic/boot.properties
-XX:+CMSParallelRemarkEnabled
-XX:+JavaMonitorsInStackTrace
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+UseConcMarkSweepGC
-XX:+UseLWPSynchronization
-XX:+UseParNewGC
-XX:+UsePerfData
-XX:MaxPermSize=128m
-XX:MaxNewSize=768m
-XX:NewSize=768m
-XX:MaxTenuringThreshold=8
-XX:TargetSurvivorRatio=90
-XX:SurvivorRatio=4
-XX:CMSInitiatingOccupancyFraction=55
-XX:+UseCMSInitiatingOccupancyOnly
-Xloggc:/software/weblogic/logs/GC/m1_200909022300.log
-Xms2048m
-Xmx2048m
-Xoss2m
-Xss2m
-server
 
**************************************************************************************************

 

Some graphs of parameters before (baseline) and after JVM tuning for 4 WebLogic managed servers are given below:

 

JVM Tuning to eliminate concurrent mode failures

 

The above graphs indicate the following:

(1) The number of occurrences of "concurrent mode failures" significantly decreased after JVM tuning, although these errors weren’t eliminated.

(2) The amount of objects (MB) promoted from the young to the tenured generation significantly decreased after JVM Tuning, thereby indication more garbage collection in the young generation.

(3) The GC Sequential load (% of total time spent in GC with all application threads suspended) increased after JVM Tuning. Although this is not desired, given that our application did not require very low latency, we were willing to make a compromise and accept the increase in GC Sequential load. As a matter of fact, when our JVM changes were rolled out onto Production, the GC Sequential load was only around 1%.  We were just being cautious and testing our changes on a test environment with very high loads.

NOTE: The tuning exercise described above worked well for us. However, depending on your scenario, you may have to do further tuning. Also, there’s only so much you can benefit by tuning a JVM and you must give due consideration to scaling the platform and/or application design. In the example above, although JVM tuning helped, the load on our platform was too high and we had to scale our platform by adding more WebLogic managed servers (JVMs). Problems such as "concurrent mode failures" are typically caused by high loads when the CMS GC isn’t able to keep up with the rate of allocation of objects in the tenured generation.

REFERENCES:

(1) When the Sum of the parts – Jon Masamitsu

(2) What the Heck’s a Concurrent Mode? – Jon Masamitsu

VN:F [1.6.5_908]
Rating: +2 (from 2 votes)

YouTube is arguably the most popular video streaming/sharing website in the world today. You can find pretty much any video you want, be it videos of the current music chart topper or those classic videos of yore. You may wish to download your favourite videos from video streaming websites and perhaps even burn the videos onto a DVD for playback on your DVD player (DVD Authoring). YouTube and other streaming video websites don’t provide options to download the streaming videos. However, there is a myriad of software tools out there (both free and paid) that make the download and burn tasks very straightforward. Given below are the steps I used to create a DVD-Video containing 30 of my favourite YouTube videos:

STEP 1: Install a Download Manager

In order to download streaming videos, you must install a download manager. I’ve tried the following download managers:

(1) Orbit Downloader: You may download and install Orbit Downloader from here. After installation of Orbit downloader, if you visit a streaming video website and hover your mouse over  the streaming video, you will see a drop-down as shown in the image below:

od_getit

Clicking on the GetIt button or using drop-down options like “With Grab++” will start downloading the streaming video.

 

(2) RealPlayer SP: You may download and install RealPlayer SP from here. After installation of RealPlayer SP, if you visit a streaming video website and hover your mouse over a streaming video, you will see a "Download This Video" drop-down on the upper right corner of the video, as shown in the image below:

rp_download

 

Click on the “Download This Video” button to start downloading the streaming video.

Which download manager do I use?: I used Orbit Downloader to download the 30 YouTube videos. However, having been introduced to RealPlayer SP recently, I recommend you use RealPlayer SP, because as per my observations, it has advantages over Orbit downloader in the following areas:

(1) Speed: RealPlayer SP downloads streaming videos faster than Orbit downloader, though not a significant difference.

(2) Compatibility: RealPlayer SP downloads streaming videos played in the popular browsers (Mozilla, IE, Chrome) whereas Orbit Downloader does not work with Chrome.

 

STEP 2: Install a DVD Authoring tool

In order to burn videos onto a DVD in DVD-Video format, you must install a DVD Authoring software. I used a free, easy-to-use DVD Authoring software called DVD Flick, which you may download from here and install.

 

STEP 3: Download streaming videos

Having installed the required software, you may now proceed with downloading your favourite streaming videos. To do so, play the streaming video and use the buttons (Orbit Downloader or RealPlayer SP) to download the streaming video. When saving the video, ensure you save it in an appropriate format. Visit here to check the video formats supported by DVD Flick for creating a DVD-Video. For example, on YouTube, videos are typically available in flv (flash video) and mov (QuickTime movie) formats, both of which are supported by DVD Flick. I downloaded standard quality (SQ) YouTube videos in flv format and high quality (HQ) YouTube videos in mov format (renaming .mov to .mp4, as Quicktime and MP4 are interchangeable).

 

STEP 4: Create a DVD-Video

After downloading your favourite videos, you can burn them onto a DVD for playback on both hardware and software DVD players, with features such as menus and subtitles. Here’s how you do it:

(1) Insert a blank recordable/rewritable DVD in your computer’s DVD drive and launch the DVD Flick software.

(2) Click on “Add Title” in the right-menu, select all the videos you wish to burn and then click the “Open” button. This will load all the selected videos into the project window. You may choose to save this project for later burning or just proceeding with the next step.

(3) Click on “Menu Settings”, choose a Menu and click “Accept”

(4) Click on “Project Settings”, set various options including “Burning” (which tells DVD Flick to burn the DVD after converting the video files into DVD-Video format).

(4) Click on “Create DVD” and select a project destination folder (if prompted).

After completing the steps above, DVD Flick should commence the process of encoding and burning your DVD-Video. A successful completion should resemble the image below:

 

dvdflickdone

It took 1 hour and 38 minutes to encode and burn my 30 favourite YouTube videos onto a 4.7 GB DVD. The resulting DVD-Video occupied 4.3 GB. The DVD played fine in my software DVD players such as Windows Media Player and VLC Media Player, but unfortunately exhibited sync issues (audio out of sync with video) when played on my hardware DVD player. However, until I test the DVD on another DVD  player, I will assume that the sync issues are caused by my cheap Alba DVD player.

VN:F [1.6.5_908]
Rating: +2 (from 2 votes)

How to configure Apache 2.x as a Reverse Proxy

Recently, I used a Reverse Proxy server to work around a constraint. I wanted to host a monitoring dashboard (website) at port 80 on a corporate intranet host, but running Apache (or any software) to listen at port 80 (or any port from 1 to 1024) on UNIX requires root privilege. Since the use of root privilege has been significantly restricted by my System Administrators, it would have been very inefficient and cumbersome to administer the website because my team would have had to raise a formal request to the Sys Admins via Change Management procedures whenever it was required to restart/administer Apache. So, I used a standard user to run Apache (hosting the website) to listen the a non-privileged port 7777 and configured a reverse proxy Apache server instance to listen at port 80 and forward requests to the Apache server instances which hosted the website at port 7777. Now, we can do whatever administration work we require on the Apache web server instance hosting the website without being dependent on the Sys Admins. If the reverse proxy apache web instance goes down, we will need to seek assistance from the Sys Admins to start it, but there’s very low probability of the reverse proxy apache web instance going down. My use of a reverse proxy server, as described above, is illustrated in the figure below:

 

Reverse Proxy

Given below, are the steps I followed to set up a reverse proxy server using Apache 2.2.12 on Solaris 9:

Note: As a prerequisite, Apache 2.2.12 must be compiled with the ––enable-so option to enable Apache to load modules dynamically at runtime.

STEP 1: Build and load the Apache proxy modules

Apache requires the mod_proxy and mod_proxy_http modules to serve as a reverse proxy server for HTTP requests. The source code (.c files) for these modules are available in the apache source code repository. Build and install the required proxy modules using the APache eXtenSion (apxs) tool as follows:

# Note that the apache ServerRoot is /apache-2.2.12 in the examples below. Run the following commands in the source repository directory containing the relevant “.c” files (httpd-2.2.12/modules/proxy/).
#
# Build and install mod_proxy module. 
/apache-2.2.12/bin/apxs -i -a -o mod_proxy.so -c mod_proxy.c proxy_util.c
 
# Build and install mod_proxy_http module. 
/apache-2.2.12/bin/apxs -i -a -o mod_proxy_http.so -c mod_proxy_http.c proxy_util.c

STEP 2: Configure the required reverse proxy directives

Having extended Apache with "proxy" functionality in STEP 1, you will now need to tell Apache how you wish to use this new functionality and to do this, you must use the Proxypass and ProxyPassReverse directives in httpd.conf. Given below are directives which I used in httpd.conf to reverse proxy all HTTP requests coming in at port 80 to a website hosted on apache at port 7777:

ProxyPass / http://www.mydomain.com:7777/
ProxyPassReverse / http://www.mydomain.com:7777/

STEP 3: Restart Apache for the changes to take effect

mrkips@kipsserver: /apache-2.2.12/bin/apachectl -k restart
VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Sun VirtualBox is a popular, easy-to-use, free Virtualization software. I use it on 64-bit Windows Vista Ultimate (host OS) to virtualize Solaris10 and a few other Linux distributions. A frequent requirement is to share files and directories between the host OS and guest OSes. Sun VirtualBox makes this sharing easy with the "Shared Folders" feature. Given below are steps I followed to permanently share a directory on my host OS (Windows Vista) with Ubuntu 9.04 (guest OS) on Sun VirtualBox 3.04:

STEP 1: Configure the Shared Folder on the Sun VirtualBox GUI.

Select the Virtual Machine (Ubuntu 9.04) and click "Shared Folders" in the "Details" tab on the right pane. You will see the following window pop-up:

vboxsf

Click the “Add shared folder” icon, select a name for your shared folder, the path to the actual folder on your host OS and the access level for the folder.

I configured the following:

For Ubuntu 9.04 Guest OS:

Name = Ubuntu9.04

Path = E:\VirtualMachines\Ubuntu9.04

Access = Full

For Solaris 10 Guest OS:

Name = Solaris10

Path = E:\VirtualMachines\Solaris10

Access = Full

 

STEP 2: Mount the Shared Folder

For Ubuntu 9.04 Guest OS:

Temporary Mountpoint(disappears after rebooting Guest OS)

Start the Ubuntu 9.04 Virtual Machine, open a terminal window and enter the following command:

sudo mount -t vboxsf Ubuntu9.04 /whatever-you-want

Permanent Mountpoint (remains after rebooting Guest OS)

Start the Ubuntu 9.04 Virtual Machine, open a terminal window and add the following line to the /etc/fstab file:

Ubuntu9.04      /whatever-you-want  vboxsf    rw 0       0

Restart the Ubuntu 9.04 Guest OS.

 

For Solaris 10 Guest OS:

Temporary Mountpoint(disappears after rebooting Guest OS)

Start the Solaris 10 Virtual Machine, open a terminal window and enter the following command as the root user:

pfexec mount -F vboxsf Solaris10 /whatever-you-want

Permanent Mountpoint (remains after rebooting Guest OS)

Start the Solaris 10 Virtual Machine, open a terminal window and add the following line to the /etc/vfstab file:

Solaris10       - /mrkips_vista   vboxfs - yes -

Restart the Solaris 10 Guest OS.

 

References:

UNIX manual (man mount, man fstab)

VN:F [1.6.5_908]
Rating: 0 (from 0 votes)

Subversion is one of the most popular open source version control tools currently available. Many organizations are moving from clunky, proprietary version control or configuration management software to Subversion. Recently, I compiled and built Subversion 1.6.4 on Solaris 9. While compiling and building software from source is usually straightforward with the 3-step “configure-make-make install” process, doing so on Solaris(unlike Linux) can be a bit frustrating at times, primarily due to the lack of packages/tools that are commonly available on Linux. So, here are the steps I followed to build subversion 1.6.4 from source on Solaris 9:

Note: By default, Solaris 9 does not have the gcc C compiler and some other packages generally available on Linux platforms. I had installed packages libiconv, gcc and libxml2 to the default build installed by my Sys Admins. You do not require root privileges to install subversion. I installed subversion using a non-root user. Refer this UPDATE for instructions specific to Red Hat Enterprise Linux 5.1

 

STEP 1: Download, unzip and extract the source code:

#
# Download subversion. Use your browser or the wget command below:
#
wget http://subversion.tigris.org/downloads/subversion-1.6.4.tar.gz
#
# Unzip and extract source (can be done in many ways)
#
gunzip subversion-1.6.4.tar.gz
tar xvf subversion-1.6.4.tar

The above commands create a directory called subversion-1.6.4.

 

STEP 2: Download, unzip and extract the dependencies (source):

#
# Download subversion dependencies. Use your browser or the wget command below:
#
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.4.tar.gz
#
# Unzip and extract source (can be done in many ways)
#
gunzip subversion-deps-1.6.4.tar.gz
tar xvf subversion-deps-1.6.4.tar

The above commands will add the contents of the subversion-deps-1.6.4.tar archive into the subversion-1.6.4 directory created in STEP 1.

 

STEP 3: Remove the serf directory:

Subversion 1.6.4 uses two HTTP client libraries called neon and serf to enable users access the subversion repository using a browser (via HTTP/WebDAV). You don’t need both libraries and since the serf library made it mandatory to have SSL as a pre-requisite, I removed the serf library and used only neon. I’ve provided some feedback regarding this requirement to the serf team. This meant I could access the subversion repository via HTTP, but not via HTTPS (SSL) which met my requirements. However, if you do need HTTPS, then ensure you have an SSL installation (e.g. OpenSSL) and pass the appropriate options (–with-ssl) to subversion during the configure process. Refer Subversion INSTALL file.

#
# Remove serf directory within subversion-1.6.4
#
cd subversion-1.6.4
rm -rf serf

 

STEP 4: Set your PATH:

Set the PATH variable correctly, so that binaries like gcc (typically in /usr/local/bin) and make (typically in /usr/ccs/bin) can be accessed. For example, my PATH is /bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/ccs/bin

 

STEP 5: Build Subversion:

Compile and build Subversion as follows:

#
# Change directory to subversion-1.6.4 and execute the following commands:
# Note: The --with-apxs option is required to build and load the mod_dav_svn to access subversion repositories via Apache using the WebDAV protocol. It creates the svn modules (mod_dav_svn.so and mod_authz_svn.so) in the Apache modules directory.
#
./configure --prefix=/wherever-you-want --with-apxs=/apache-ServerRoot/bin/apxs
make
make install

 

STEP 6: Test Subversion:

Test Subversion as follows:

#
# Change directory to where subversion-1.6.4 has been installed (cd /wherever-you-want)
#
bin/svn --version

If subversion is built properly, the above command will display subversion’s version and allowed methods of accessing the repository. For my installation, the output is given below:

svn, version 1.6.4 (r38063)
  compiled Sep  4 2009, 20:42:03
 
Copyright  2000-2009 CollabNet.
Subversion is open source software, see _http://subversion.tigris.org/
This product includes software developed by CollabNet (_http://www.Collab.Net/).
 
The following repository access (RA) modules are available:
 
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
 - handles 'http' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
 - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
 - handles 'file' scheme

 

—– T H E     E N D —–

 

Note: Installing subversion on Solaris 10 is as straightforward as doing so on Linux systems as Solaris 10 includes all the GNU software goodies in /usr/sfw/bin , where sfw => Sun Freeware

 

UPDATE (27th October 2009): I just installed Subversion 1.6.5 and 1.6.6 on Red Hat Enterprise Linux 5.1. The steps involved are the same as listed above for Solaris 9 with the exception of STEP 5 (Build Subversion) which was done as follows:

#
# Change directory to subversion-1.6.5/zlib (or subversion-1.6.6/zlib) and execute the following commands:
#
./configure --prefix=/mysvn-location --shared
make
make install
#
# Change directory to subversion-1.6.5 (or subversion-1.6.6)  and execute the following commands:
# Note: The --with-apxs option is required to build and load the mod_dav_svn to access subversion repositories via Apache using the WebDAV protocol. It creates the svn modules (mod_dav_svn.so and mod_authz_svn.so) in the Apache modules directory.
#
./configure --prefix=/mysvn-location --with-zlib=/mysvn-location --with-apxs=/apache-ServerRoot/bin/apxs
make
make install
VN:F [1.6.5_908]
Rating: +3 (from 3 votes)

 Page 1 of 2  1  2 »