Thursday, December 27, 2012

सुनो फिर इक और शेर

हर रोज़ की ख़लिश है हर रोज़ है अज़ीयत,
चला चलता हूँ सोच के ये बंदिश-ए-मशीयत।
बंधा सा बैठा हूँ खुद के बनाये कमरों में,
करूँ तो क्या करूँ अब तुझसे भी शिकायत?

Wednesday, November 14, 2012

एक और कविता


जिया तो क्या जिया बस सुन के ही सबकी धुनी?
दबा हो सर तेरा फिर भी उठा स्वर गर्जनी।
न कर सकता हो कुछ भी, लिख-बोल कर रख गर्म स्याही,
क्या पता कोई गा सके इक गान तेरा गुन्जनी।

Wednesday, October 17, 2012

अहा, शायरी सुनिए

शायर अकील नोमानी ने लिखा है: 
पायेदारी क्या कि बस इक ही लहर से गिर गए ,
कुछ मकाँ सैलाब की झूँठी खबर से गिर गए।


अब मैंने कुछ और बढ़ाया:
सुकूत के बल पे मेरे ऐवान में तुम थे मकीं,
अल्फ़ाज़ तेरी सुन के अब मेरी नज़र से गिर गए।

Tuesday, October 16, 2012

BMW Ad

I always struggled if I should buy a BMW or a car that gives me more gas mileage. When I found BMW is the most efficient car in its class there remained no confusion. I love my BMW.

Thursday, September 20, 2012

Anna should continue his fight and Kejriwal his own

I completely agree with Anna's position to continue to fight against corruption and not associate or align with any specific political party including Kejriwal's. That said, today Indians need an alternative. Congress is no good on their own and BJP is no good either. The Third front initiatives are all marred by opportunists and "game players" and do not truly represent Indians when it comes to common interests. Kejriwal's decision to provide that alternative is a good one. Our democratic system is not broken it is just dirty. We as electorates welcome new alternatives new faces new ideas and leaders outside of political parties that have become breading grounds of family run careers or where leadership are limited to a very few. Anna's value and his stature is not tied to Kejriwal's success. Neither Kejriwal's failure would or should dampen what Anna is fighting for. If Kejriwal becomes corrupt then he would see the wrath of Anna in the same way Congress is under today. If ends up giving a cleaner and efficient government then it only achieves the dream Anna has given us. They are neither conflicting nor challenging to each other. What Kejriwal does have exposed himself to is a vulnerability that Congress and other parties were waiting to see and if he is really an able administrator not just a dreamer he should demonstrate how he can plug them close. Kejriwal's success to launch, control and win the next elections will also provide confidence to the electorates that he is ripe for governance.

Wednesday, September 05, 2012

बहुत दिन बाद एक शेर

अभी मत सोवो कि राह बाकी है आधी,
लोग जग रहे हैं उस पार तेरे इंतज़ार में।
खोने की सोच भी कैसे सकते हो तुम?
तुझे पाने को लोग हैं कतार में।

Thursday, July 19, 2012

Monday, July 02, 2012

अपनी अपनी सी पगडण्डी

ये डरी डरी सी पगडण्डी,
इन खेतों में अनजानी सी,
निकली है राह बनाने को,
इक ठौर यहीं इक ठौर कहीं।

नदिया सी दिखती ये बहती,
पर नहीं कहीं मिट जाने को,
ये राह है ढूंढें बड़ी राह,
और भटकों को घर लाने को।

मिट्टी में लिपटी धूल धूल,
उबड़ खाबड़ दुबले तन सी,
बस आशाएं लेकर चलती,
बल रखती है अपनी माँ सी।

अपने हों या हों अनजानें,
आते हों या फिर हों जाते,
घर के चौबारों से निकले,
ये ढोती स्वप्न हजारों की,
फिर भी डरती सी पगडण्डी,
अपनी सी लगती पगडण्डी।

Saturday, June 16, 2012

एक कविता

कोई वृक्ष चीखे न चीखे, बादल दर्द जान लेते हैं।
ढँक लें कितना ही पत्ते, पंछी दरख़्त पहचान लेते हैं।
कुछ प्रेम ऐसे हैं जिन्हें करना नहीं पड़ता,
न दिख कर भी कुछ लोग हाथ थाम लेते हैं।

Sunday, June 10, 2012

किसी दीवाने के साथ

With Kumar Vishwas and Pradeep Sundriyal





Thursday, June 07, 2012

और जनाब मैंने कहा है



खुदा तो हर जगह है दिखता कहीं नहीं ,
नशे कि लत में ही खुद में इक खुदा पाया।
होशोहवास में तो बस कुछ ही मस्जिदें दिखतीं हैं,
नशे में हर दर पे बस तेरा ही साया पाया।

-मिर्ज़ा आशीष 

Wednesday, May 30, 2012

कुछ भूला भूला रहता हूँ


क्यूँ बिछड़ा हुआ सा रहता हूँ?
क्यूँ भूला भूला रहता हूँ?
ये क्या हुआ मुझमें है जो,
मैं रूठा रूठा रहता हूँ?

न कल की थी फ़िक्र मुझमे,
न सोचा क्या है आगे ही,
हाँ बिठा लिया जो गुज़रा साथ,
यादों से तरसा तरसा हूँ,
मैं रूठा रूठा रहता हूँ |

जो पाया था वो छोड़ा हूँ,
जो मिला नहीं वो खोया हूँ,
बस लपटों की आग़ोश में हूँ,
कुछ जला भुना सा रहता हूँ,
मैं रूठा रूठा रहता हूँ |

तुम रोकोगे तो क्या दोगे?
जो पाया है वो खो दोगे,
मैं उड़ता हुआ एक पंछी हूँ,
इस डाल पे हूँ उस डाल पे हूँ,
बस भूला भूला रहता हूँ,
कुछ बिछड़ा हुआ सा रहता हूँ |

Tuesday, May 22, 2012

Caste system? So whats our political system?

I am not talking about political parties and leaders who do caste politics but they themselves and the fraternity they belong - that's politics itself. Today's politics has built a system where it is virtually impossible for an outsider to get in and succeed. Look around how has this system evolved? From Rajiv it has gone to Rahul, Mulayam to Akhilesh, Karunanidhi to Stalin, Farooq to Omar and this list goes on. Can you with no political background think of succeeding and running a campaign? No. You will be wiped out before you realise what hit you. The kind of money involved even in small time University elections are getting beyond control. Political leaders have dedicated teams of "issue finders" and writers to write speeches. They want you to stay voters not issue takers. They want you to choose among them as your representative not to become someone with a following - not theoretically impossible but making it so hard to discourage you. If this is not a caste system then what is it? This is a caste of politics and this is how our own caste system had evolved once. This caste has power, when challenged from outside they work together, they have resources and they have motive. If this would not have been a case then Anna's mission would have succeeded long time ago.

Monday, May 07, 2012

एक शेर अन्ना और रामदेव पर

सभी हैं चोर जो हैं चुन के आये कहना गलत होगा, 
अगर सिर्फ एक अच्छा है हजारों में, तो क्या तुझको गर्व ही होगा?
सदन का मान जो ऊंचा धरम से भी जो होना था,
अगर कुछ लोग ही रख पाते तेरा क्या भ्रम नहीं होगा?
अगर हम आज अपना देश इनको बेच देते हैं,
अगर हम इक सहारे आँख अपना मूँद लेते हैं,
अपना हक भी मिलता हो जो सब अपना लुटा कर जो,
अपने देश में ही लुट रहे, बड़ा अब शर्म क्या होगा?
उठो अब जाग जाओ साथ तेरे है कोई अपना, 
सुनो तुम भी जिन्होंने दशको से है ये फैला रक्खा,
"हरे थे शत्रु पहले से औ भगवा ने किया है क़त्ल गाँधी का" -
अब इक है गाँधी की टोपी में तो पहना दूसरा जोगा।

Thursday, February 23, 2012

U limit to extend

Sitting in the year 2012 it is needless to say Multithreaded software applications are not an option, it is the norm. Systems are today even more complex with its underneath distributed architecture with Clustered services and multiple system and user threads. Recently three of Tachyon's development team members had to scratch their heads for many hours to debug a problem none of us ever cared to look at before. And post the Aha moment came a tandem smile making it worthwhile to blog about and share with the rest of the Gang.
We were testing Tachyon on a system that we got as part of a system rotational policy. Tachyon is a pure Java application using a few of Oracle's middletier products and we have created a system agnostic deployable artifact and a rich console to manage our processes and nodes. With 1Terabyte of Memory on these machine we were already smiling like a Kid with an Icecream in hand in Winter. We started seeing an OutOfMemoryError when the fourth node was started. This just couldn't be possible we thought - each node has just 1GB heap allocated, in no way possible it could exhaust the 1T memory. "free -m" reflected our assumption. No swapping and plenty of memory available to grow. And then we happen to run the 'ulimit' (..the command I derived my blog title from):
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 28138
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited


Turns out among three nodes the total number of threads started was already in 900+ and the fourth node didn't have enough user processes available to start. What took us in a total wrong path was an "OutOfMemory" Error. May be its an overused term in this scenario but eventually we did find that under Linux, threads are counted as processes so any limits to the number of processes also applies to threads. In a heavily threaded app we can quickly run out of threads.
There is a security implication too. As we researched the topic more we came across a term "Bash fork() bomb - :(){ :|:& :};:". This is a bash function that gets called recursively and is often used by Unix administrators to test the process limitations. An "unlimited" max user processes setting could also be misused to carry a Denial of Service attack by exhausting the total number of threads to deny applications running on that system to start any new threads.
Following command can be used to find out how many threads are already started by a user:
$ ps -u -L | wc -l
If processes are started by an user account , this command is an useful tool along with "ulimit -a" to figure out how many more processes can still be started - A key mechanism for system provisioning.
At the end for time being, ulimit -u unlimited was good enough for us to continue our testing.
Enjoy!

Wednesday, January 18, 2012

Measuring a Toddlers weight and Object size in heap

...And the common problem is they both need some warm up phase. Toddlers are notorious to not stay standstill and if you have one you know typically the first reading is almost always wrong. But for these naughty Kids there is a way to measure it - Hold them in your arms measure your weight with the kid and then measure yours alone and subtract it. This modelling can also be applied to when Objects need to be measured for their size in a heap. Why? Because flakiness do exist with JVMs and based on sheer observation the first reading is almost always wrong. So not being part of a JVM team how am I suppose to measure an Object size fairly accurately? By reducing the flakiness. By measuring it multiple times. By minimising the affect of chaos.
Problem: To provide an API so that it can measure the size of an Object passed to it

Solution: Clean up the JVM, measure the heap size, create multiple instances of the Object, create strong references to these instances. clean up the JVM again and measure the heap. Take a difference and divide by the total number of Objects used.

If you are looking for measuring the size of Objects in a Coherence cache then look into Coherence's MemoryCalculator APIs. This solution uses Coherence's PoF framework for serialzing and deserializing non-Serialozable Objects.

1. We need to create multiple instances of the Object passed so that strong references can be maintained to these Objects and do not let GC collect these. So make multiple instances of the passed object. How? There are multiple options -
  • If Object implements Serializable or any of Serializable types - Serialize the Object into byte array and to create an instance use this byte array to reconstruct the Object.
  • If Object is Cloneable - To create a new instance then clone the Object
  • If Object is neither Serializable nor Cloneable - Oracle Coherence provides a mechanism to serialize a non-serializable Object called Portable Object Format. PoF as it is commonly called, allows programmers to write external serializers for an Object that does not implement Serializer interface. These Serializers and the Object they serialize and deserialize can be defined in a pof configuration and loaded by a Coherence system property tangosol.pof.config. Once this is done the Object is ready to be serialized.

For the third option Coherence provides a utility in ExternalizableHelper to convert the Object into a Binary:


ConfigurablePofContext pofContext = new ConfigurablePofContext ("my-pof-config.xml");
then:
Binary binObj = ExternalizableHelper.toBinary (objToBeMeasured, pofContext);

This binObj can then be used to create new instances to make multiple strong references:
Object[] objects = new Object [1000];
Runtime runTime = Runtime.getRuntime();

for (int i = -1; i < 1000; ++i) {
     Object o = ExternalizableHelper.fromBinary(binObj, pofContext);
    // -- Reject the first object
     if (i >= 0) {
        objects[i] = o;
     } else {
            o = null;
            // -- Execute GC;
        beforeSize = runTime.totalMemory() - runTime.freeMemory();
     }
}

Execute GC again;
afterSize = runTime.totalMemory() - runTime.freeMemory();

Use the difference of (afterSize - beforSize)/1000I also found a very good implementation of "Execute Garbage Collection" from an article on the javaworld.com, that I am reproducing it here:


for (int i = 0; i < 4; ++i) {
    long m1 = runTime.totalMemory() - runTime.freeMemory();
    long m2 = Long.MAX_VALUE;
    for (int j = 0; (m1 < m2) && (j < 500): ++j) {
         runTime.runFinalization();
         runTime.gc();
         Thread.yield();
         m2 = m1;
         m1 = runTime.totalMemory() - runTime.freeMemory();
    }
}
Watching your baby's and Object's weight is critical and you know it why? Enjoy!

Monday, January 16, 2012

एक और शेर

छुआ जो आसमां तो बादल यूँ फट गए,
अरमान दिल के सब पानी में बह गए।
बूँद हज़ार बन फिर वो खो गए कहीं,
आँख के आंसू भी कहीं उसी में मिल गए।