Bash subshell & piping to a loop

When setting/changing variables within the scope of a subshell. And then attempt to use those variables outside the scope of this subshell won’t give the ‘expected result’.
A subshell has to be seen as a totally seperate process with it’s own environment.
(check a previous entry about processes)

Now the above might seem logical: Subshell, seperate process, … okay. Let’s say you want to pipe the output of a certain command thru a loop. In this loop you can manipulate/filter/… the data. In some cases you might want to set a flag if a certain criteria is met. Here is where it all comes into play. When you pipe an output to any kind of loop, it’ll become a subshell.

So as you might have guessed. The flag you wanted to set won’t cross it’s subshell borders. So you won’t be able to see it outside the loop. And yet again, an output that you might not have expected.

More info about “bash gotchas” can be found here

Windows XP SP3?

When reading thru I came across the following article:

WinInfo Short Takes: Week of April 9
And What About Windows XP Service Pack 3?
And while I’m ranting a bit, let’s dredge up Windows XP Service Pack 3, which was delayed from 2005 to 2006 to 2007 and now to 2008. If you were looking for any glimpse into the mind of Microsoft, this is it: The company has completely abandoned Windows XP, and it has absolutely no plans to ever ship an XP SP3. My guess is that Microsoft will do what it did with the final Windows 2000 Service Pack: Claim years later that it’s no longer needed and just ship a final security patch roll-up. This is the worst kiss-off to any Microsoft product I’ve ever seen, and you’d think the company would show a little more respect to its best-selling OS of all time. But the reality is, Microsoft is looking ahead to new revenue and not behind to money that’s already in the bank. And though hundreds of millions of people will be running XP for years to come, despite Microsoft’s best efforts at selling them a later Windows version, the company has absolutely no plans to actually support those customers. This flies in the face of its publicly-stated life cycle support plans. And it really freaks me out. It should freak you out as well.”

To be honest, I don’t think the guy will be off too much on the matter. Yet it’d still be a dreadful thing to do from Microsoft. But in a world where shareholders need to be satisfied, the guys who already payed (and won’t pay no more, namely home-users) aren’t the ones you need to satisfy.
But what they seem to forget, is that what people use at home, is what they like to use at work too… That’s something we’ve seen discussed in the Linux world often enough (cfr RedHat & Fedora versus Ubuntu discussions).

Unix processes

A nice tutorial on unix processes can be found here

It’s a basic but profound explanation on how unix processes works. Starting from how they are multitasked, started, forked, etc. So in short, it’s good reading material for those who work with unix processes.

Ajax websites & search engine indexing

When coding an ajax website, don’t forget the need to be compliant with search engines. When checking the google guidelines, the following is stated:

Use a text browser such as Lynx to examine your site, because most search engine spiders see your site much as Lynx would. If fancy features such as JavaScript, cookies, session IDs, frames, DHTML, or Flash keep you from seeing all of your site in a text browser, then search engine spiders may have trouble crawling your site.

So the crawlers have a very simplistic view of website. So when coding a fully “ajax” website, be aware that this website will only be partially indexed. In some cases this might be handy, where ‘private data’ needs to be shown but not indexed. Yet in most cases a website needs to be indexed fully, as it’s the content that attracts visitors.

A method of coding can be to create ‘dual links’: href=”” onclick=”GoToFooBar; return false;”
In this case when a visitor with a browser that support javascript clicks on the link, it will execute the JavaScript function ‘GoToFooBar’, and then try to execute the next function. As it’s hard coded to fail, it will not go to the url listed. This gives you the speed of Ajax. But if one doesn’t support javascript, then the url will be used.
(Obvious note: make sure that the function & the url return the same output!)

For more information about the Ajax Framework, check wikipedia

Load average

load average: 1.11, 2.10, 2.97

We’ve got 3 numbers here… yet what do they mean? The *nix (linux/unix) load average is a set of 3 numbers seperated by a comma. It’s defined by the number of processes waiting to be run, plus the number of processes currently executing. The numbers indicated the load average over the last 1, 5 and 15 minutes respectively.

The load average is NOT identical to CPU utilization. This can be seen in sar, mpstat or top commands. A high load is an indicator that something isn’t as it should be. But don’t use it as a sole performance metric.

In general, for a working server in a day to day environment, it is said that the load average should not exceed the number of processors(/cores) in the server. Yet this is a very simplistic view, as you haven’t accounted for memory usage, disk access times, network utilisation, etc.

Bigip: tmm process

What is TMM
When you’ve been working with a BigIP loadbalancer, you may have encountered the tmm process and wondered what it is… TMM stands for “Traffic Management Microkernel”. In basis it handles all of the BigIP’s traffic functionality. This being the loadbalancning, SSL processing, compression, iRules, …

For more detailed tech info, check the following page:

CPU Utilization
What about it’s CPU Utilization? You see it use a lot of cpu time “from time to time”, yet you’re wondering how the algorithm behind is working.
The TMM process will utilize all the available time from one CPU. In case of a multicpu model, it will use the highest numbered CPU for this. All other processes will utilize the remaining processing time from the other CPUs.
Yet the system is idle (no traffice to process), it will release up to 99% of it’s utilization for other processes. Under load it will only release 20% of available time to other processes (like f.e. the httpd which powers the gui).