Posts Tagged ‘Search’

Search Engine’s dirty secrets !

April 13, 2010

HOW much does a web search cost? You don’t pay up front, but there are costs nevertheless, and they are not just measured in dollars.

The term search “engine” is apt. Searches are powered by millions of computers packed into warehouses, all wired together to function as a single system. Like any system, it obeys the laws of thermodynamics, and therefore wastes energy.

The first law says it takes energy to do work, even if that work is only to move electrons across silicon wafers. The second law says that no engine is perfect, meaning some of the input gets lost as heat. This is the entropy, or disorder, arising from your search.

A successful results page brings clarity and order to your corner of the universe, but down in the server farms things get messy. Thermal motion of silicon atoms agitates air molecules behind the CPU racks, heating them up. More energy must be fed in to power the computer fans and air-conditioning units needed to remove this heat from the warehouses.

Whatever you search for, it boils down to the same cycle: move atoms, then cool atoms. Both these steps consume energy. How much? Let’s run through some numbers, using the leading search engine as our guide.

Whatever you search for, it boils down to the same cycle: move atoms, then cool atoms

IT research firm Gartner estimates Google’s data centres contain nearly a million servers, each drawing about 1 kilowatt of electricity. So every hour Google’s engine burns through 1 million kilowatt-hours. Google serves up approximately 10 million search results per hour, so one search has the same energy cost as turning on a 100-watt light bulb for an hour.
This doesn’t bode well. Even though the average American performs just 1.5 searches per day, it is hard to imagine that this will not rise dramatically.

The US Environmental Protection Agency estimates that data centres are responsible for 1.5 per cent of US energy use. How much more will that be when we, and our gadgets, are doing hundreds of searches per day? Or when the planet’s 6 billion inhabitants all want equal access? We’ve all heard the future of information architecture is cloud computing. It just might be a cloud of carbon dioxide.

ABC to use grep to search for a word and also to get its line number

June 18, 2009

Wondering about the big title…. lolzzz… will it has a meaning….

First, The command :

cat filename | grep -n search_keyword | less

Say, you have a file called filename and you want to search for a term called search_keyword. The -n stands for number. It will print the line number where the search_keyword is found. | less is just a normal utility that lets you scroll up and down if you have the output (of the above command) running for more than a page.The following are some example –

Say, we have a file called abc.txt with the following contents:

A  :  mangoes are tasty fruits.
      Do u like mangoes ?
B  :  No, I don't.
      I like apples.
A  :  But I like mangoes more than apple.

From the shell (terminal), execute the following command.

cat abc.txt | grep mangoes

You will get the following output

A  :  mangoes are tasty fruits.
      Do u like mangoes ?
A  :  But I like mangoes more than apple.

When you added -n to the above command i.e.

cat abc.txt | grep -n mangoes

The output looks like this , notice the line numbers :

1:A : mangoes are tasty fruits.
2:    Do u like mangoes ?
5:A : But I like mangoes more than apple.

I hope everything is clear !
%d bloggers like this: