Tuesday, March 19, 2013

Integrating JBoss Admin iOS App with Apigee App Perf Monitoring Tool

Ever since I left JBoss/Red Hat last year to work on InstaOps, a start up that I co-founded, I have always wanted to stay connected not only with many life long friends that I have made at Red Hat but also with amazing technologies that are built over there. Along this line, I came across JBoss Admin iOS mobile app and wondered what if I could integrate this app with iOS SDK that we have built. The app is very well designed thanks to Christos (@cvasilak) and uses standard iOS frameworks so integration literally took less than 10 minutes. If I were a brand new user, the end to end integration would have probably taken 20 min most of which would have been time taken to sign up and download the SDK. ;-). Here is a screenshot of app running on Simulator:

You can see the code changes that I had to make to integrate our SDK on GitHub.  Changes are very minimal and in terms of new lines of code, it's literally 2 files (App Delegate header and impl) and less than 5 lines of code. Once I ran the app on Simulator, following are screenshots of what I could see in our dashboard:

  • Automagic Log Capture

  • Automagic Network Capture

The one network error you see on the chart is because I had not started AS7 before I started the app. 

If you like what you see and are into mobile App development, pls give it a shot.  It's free. Let me know your feedback (@prabhatjha). We currently have SDK for native Android and iOS apps.

Saturday, February 2, 2013

Components of Mobile App Performance Analytics

Just wanted to drop a line that I blogged about three critical components of real time mobile app performance analytics solution at Apigee Blog. http://blog.apigee.com/detail/analytics_platforms_data_capture_data_processing_data_visualization

Monday, June 18, 2012

Infinispan and Twilio integration

You have a good old JavaEE transactional application where you have done all right things such as database index, caching etc so that its performance is good. If you are really careful and want to make sure that it keeps performing well and scaling well as well, you would use Infinispan [1]. ;-) For some extraordinary reasons, imagine that when an entry gets added to the cache, you want to get notified right away. I will show you in this blog how you can integrate Twilio with cache events in Infinispan so that you get an SMS when a cache entry is created.

  • You need to create a cache event listener which is simply annotating a POJO with listener annotation and annotating relevant methods for event you are interested in.
    public class InfinispanTwilioCacheListener
    public void print(CacheEntryCreatedEvent event) {
  • Register this listener to your cache, not at cache manger. See Listeners and Notfications for details.
    defaultCacheManager().getCache(CACHE_NAME).addListener(new InfinispanTwilioCacheListener());
  • Create a utility method to get SmsFactory from Twilio Rest Client.
    private SmsFactory getTwilioSmsFactory () {
    if (client == null)    
       client = new TwilioRestClient("YOUR_TWILIO_SID", "YOUR_TWILIO_TOKEN");
       Account mainAccount = client.getAccount();      
       SmsFactory smsFactory = mainAccount.getSmsFactory();
       return smsFactory;
  • Send an SMS. You would add this in your method annotated with @CacheEntryCreated
     Map smsParams = new HashMap();
     smsParams.put("To", "VALID_PHONE_NUMBER");
     smsParams.put("From", "TWILIO_PHONE_NUMBER"); 
     smsParams.put("Body", "A cache entry got created" + event.getKey().toString());
     try {
     } catch (TwilioRestException e) {
        // TODO Auto-generated catch block
Here is a screenshot of my phone when an SMS was sent.
Note, if you are using a trial account then you can not call or send an SMS without verification of that number which obviously makes sense. If the number is not verified then you will get an exception like : "com.twilio.sdk.TwilioRestException: The number XXXXX is unverified. Trial accounts cannot send messages to unverified numbers; verify XXXXX at twilio.com/user/account/phone-numbers/verified, or purchase a Twilio number to send messages to unverified numbers"

You can find the complete code at https://github.com/prabhatjha/infinispan-examples which is forked from https://github.com/mgencur/infinispan-examples .

[1] I work with Infinispan and JBoss Data Grid 

Monday, April 23, 2012

What does it mean to be JBoss Data Grid ??

Red Hat recently announced beta release of JBoss Data Grid (JDG) , a supported product based on Infinispan. Infinispan was first announced in 2009 and its first GA release was made in February, 2010. So it took more than three years for us, folks at JBoss, to announce a supported beta release. In case you are wondering why it took so long, here are few things to consider. Besides introducing several handy features such as virtual nodes, grouping API, deadlock detection and optimization, improvements with transactions, we wanted to make sure that it
  • can scale in a large cluster. Scalability is a very generic term and its meaning is highly contextual. For JDG, we narrowed down it to two : client scalability and data scalability.
    • Client Scalabilty:  Given a  percentage of data in virtual heap, does JDG handle more client requests as more nodes are added to the cluster? We measure throughput, 99 percentile response  time under read heavy, write heavy scenarios to verify this assertion.
    • Data Scalability: Given a fix number of clients, how much data can be filled in virtual heap while performance metrics such as throughput and 99 percentile response time are still under user defined values. This is again tested under read heavy, write heavy scenarios. 
  • is elastic. Does the cluster scale out and scale in? As nodes are added and removed, how long does it take for cluster to stabilize? This stability is measured by comparing data distribution before and after nodes leave and join.
  • is resilient. While cluster is in active use and node/s crash, what's the impact on throughput, response time? Is there any data inconsistency? How long does it take to stabilize?
  • is stable. Tests are run for long time and monitored for CPU, memory usage, number of full GC, average GC time.
This matrix gets quite complicated if you add various configurations that are available in JDG such as three different end points (Hot Rod, memcached, REST), partially versus fully replicated modes aslo known as "DISTRIBUTED" and  "REPLICATED" mode respectively,  synchronous vs asynchronous replication, number of virtual nodes, READ heavy vs WRITE heavy, L1 cache enabled vs disabled, File Cache Store, JDBC cache store, and so on. 

I have only touched the performance and scalability aspects in details. There are various other functional verification which gets quite complicated as well if you think in terms of OS+JVM+File System + DB combinations we have to certify. 

I can proudly said that we have come a long way and come GA availability, our customers will have in their hands an extremely scalable and highly available data grid platform. And I should mention linear scalability as well!! Wait should not be too long. ;-)

Wednesday, December 7, 2011

Things I installed after fresh Fedora 16 installation

Gnome Tweak Tool
Gnome Shell Extensions
  • gnome-shell-extension-common-3.2.0-2.fc16.noarch
  • gnome-shell-extension-apps-menu-3.2.0-2.fc16.noarch
  • gnome-shell-extension-icon-manager-0-0.4.gitc34779c.fc16.noarch
Google Chrome , Flash plugin, Talk plugin
Adobe Reader
Libre Office
Different JDKs
Thunderbird and lightning
icedtea-web for java webstart
MySQL and Administrator
Eclipse EE, m2eclipse and its extras

Tuesday, November 8, 2011

One of a kind immigration and visa story !!

The saga started way back in 2009 and I paid off the price of minor lapse in 2011. Now that I have your attention, here is the details.

My mom, a Nepali citizen, came to visit us in Texas for a period of six months in 2009. Six months is the most you can stay in USA if you are on a tourist visa without applying for extension. We knew this rule and certainly wanted to follow it. A glitch came when the person who was supposed to go back with her had to cancel his plan. I prefer to have somebody accompany my mom who speaks English so I started looking for a person who could match her itinerary. Probabilistically, chances of finding a person who you know and has the same itinerary is very low and that's what happened. We could not find one who was traveling along the route within the six month limit but we did have a person flying back to Nepal after one week of that period. So I changed the itinerary and at the same time filed an application for extension of six months stay hoping that there should not be a problem of extending the say since we were only asking for couple of extra weeks in the worst case.

As you might have guessed, the extension was denied. Now what? Re-booking the ticket was going to cost me couple of hundred of dollars so I thought it may not be too "risky" to overstay for a week and that's what we decided. There was no problem going back to Nepal so it turned out to be a well calculated risk.

Come 2011, my mom came back again to attend my sister's graduation. At Boston airport, officials wont let her pass the immigration because her visa had expired. She had got a 5-year multiple entry visa starting 2009 so visa was valid at least 2014. It turns out that if you overstay, your visa is automatically canceled and you will be sent back to your country if you manage to land in US. Obviously we did not know that, did you? Thankfully immigration officials understood that it was not done on purpose and they let my mom in for a period of six months with constraints that we would not be able to apply for extension and she would have to leave USA before six month period. That's totally fair and we all appreciated the generosity of officials. The six month period is still valid as of this writing and will be over on Nov 10.

Today is Nov 8 and also when my mom has her flight back to Nepal through London. My mom was not allowed to board the flight at Boston airport. Before you read further, I would like you to think why that could be the case. It defies logic and I don't know how general folks like me is supposed to know these things!!

There is no problem leaving USA but there is a problem with transit at London airport. It turns out that if your USA visa has expired/canceled then you can not transit at London airport without having a visa. If we had known that we obviously would have applied for a transit visa but it was too late again. Did you know that? :-(  This only happens at London airport, not at other airports. On top of that I have only 2 days to sort this mess out.

After debating many options, I decided to get a new one way ticket that did not include a transit at London and let go off previous return ticket. I not only lost good chunk of money on return ticket but new one way ticket for NY-Dubai-KTM cost me almost a thousand dollar. My sister drives my mom to NY tomorrow and she departs from NY on 10th morning. I hope that even after this, she gets back home on time and without much hassle. I will keep my fingers crossed and will definitely think twice about flying through London.

BTW, what's so special about London that they have special rule that no other airport has about transit?

Thursday, August 25, 2011

Java EE6, JBoss AS7 and OpenShift talk at Austin JUG

For August 2011 Austin JUG meeting, Red Hat is sponsoring a talk on Java EE6, JBoss AS 7 and OpenShift. I will be covering JBoss AS7 and EE6 while my colleague David Blado will do a presentation and demo using OpenShift, Red Hat's PAAS offering. I hope to see you Austinites and their neighbors at the meeting. JBoss AS7 landing page talks about 7 reasons to love it but I will give you a very compelling 8th reason and probably more. ;-) In case this all is not appealing enough, there are free pizza and drinks as well. More details at http://austinjug.org/index.jsp?p=events-20110830