Wednesday 9 October 2013

Performance testing on IRCTC Website


Recently I have seen lot many people complaining about the performance of theIndian Railways website and most complains relates to the fact they are not able to book the tickets online and it takes hours for them to book the ticket via IRCTC.I also had faced the similar situation many times but I must say I have been fortunate enough that more than 95% percent of the time,I was able to book it in the first attempt.Maybe its just my luck or my good timings.So I thought let me do some investigation in my spare time and see how much traffic does this site handle and what all are the real trouble the users are facing while using this site.So with this intention,I pulled out the below facts about IRCTC site,(Please do remember that Government employee’s rarely exaggerates the numbers as they just don’t have any motives to play with numbers,based on this wisdom, I believe these below numbers are correct or should be on lower side),
IRCTC site receives close to 10 to 12 lakhs(10,00,000 to 12,00,000) hits per minute.
The site uses around 450mbps bandwidth.
Nearly 5 lakhs tickets are booked on daily basis.
At any point of time, it has got close to 10,00,000 concurrent connections open to it.

Of course IRCTC has taken some measures to increase the scalability of its site by adding flash memory drives,restricting the activities of its agent and ensuring that it does regular maintenance of its infrastructure,but I do feel personally it still needs lot of improvement given the kind of traffic it gets.

I can understand general users who don’t understand the complexity of the software complaining about it,but I just don’t understand as what makes IT Folks who had spend years designing IT Systems/Testing to complain about this site,can’t they understand the complexity/volume of the traffic the site handles and the way bureaucracy is slowing it down or they believe these numbers are negligible in volumes.

I feel the folks who are working on this site and folks who had scaled this site has done remarkable job to the people of India.They are in fact heroes and they have wealth of technical information with them. So I would request people who run technical IT magazines contact these folks and maybe you can ask them as what is secret of their scalability in spite of working in tight/constrained and limited work environment.How on earth can they maintain close to 10 million concurrent connections ? Isn’t this a interesting case study worth a attention ?.

Tuning Apache Tomcat – Reduce Network Calls

One of the ways to gain the response time by couple of milliseconds is to reduce the unnecessary calls back and forth in the network. Whenever the application is deployed in Apache Tomcat, I would suggest that you disable theenableLookups flag of connector element in server.xml of the Server. This is cheap way to gain couple of milliseconds in performance depending on the your network speed. If your server or users are slow network, then obviously you should be gaining in seconds, however for high speed network, you should be able to gain at least close to 200ms minimum.(My experiments showed 200ms gain minimum).

Whenever the application is deployed in Apache Tomcat, it logs information about the client’s ip or host name by querying the DNS servers. This query often adds couple of milliseconds to your transaction response time behind the scene. We can disable this roundtrip by setting the enableLookups flag to false in server.xml for connector element.

Below is sample server xml connector tag where changes needs to be done,
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="true" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />

By Default the enableLookups flag is set to true. Once the change is done, ensure that you restart the server.

However if you want to implement this change, ensure that you access impact on application correctly since if your application is mining the client’s data , then this change might break your application. By setting enableLookups to false, you will not be able to get the client’s host name details.