Skip to main content

Posts

Killing a particular Tomcat thread

Update: This JSP does not work on a thread that is inside some native code.  On many occasions I had a thread stuck in JNI code and it wont work. Also in some cases thread.stop can cause jvm to hang. According to javadocs " This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked". I have used it only in some rare occasions where I wanted to avoid a system shutdown and in some cases we ended up doing system shutdown as jvm was hung so I had a 70-80% success with it.   -------------------------------------------------------------------------------------------------------------------------- We had an interesting requirement. A tomcat thread that was spawned from an ExecutorService ThreadPool had gone Rogue and was causing lots of disk churning issues. We cant bring down the production server as that would involve downtime. Killing this thread was harmless but how to kill i...

Partition your Rolling Fact by time or not

We are creating a data warehouse to store event logging for actions done by user. The requirements are to keep 6 months of historical data and allow user to run audit reports. The challenge here is to partition the facts by creationtime of the record or not. The advantage of partitioning by creationtime is that we can chop a partition when we want to purge the data within seconds and all new data would be added to current month partition so ETL data loads would become fast. The disadvantage is that you will have to include time horizon in your every query that gets fired on the data warehouse otherwise it will do FULL SCAN. The alternative is to not partition by time or you can create global indexes on time-partitioned tables but when you drop data these indexes/tables becomes fragmented. This is a very important decision here and if you can get the User requirements and all the queries would contain time then go ahead and partition your fact by time else its better to pay the performa...

Managing User Perception in long running operations

Its important to manage User Perception properly and give him feedback if you are doing a long running synchronous operation. In the web world a user can get frustrated/impatient and try to do the same operation again leading to sending even more load on your server. We recently ran into one issue like this where registration was taking a long time due to some server issue and looking into apache logs it was taking 10 sec but users were reporting it was taking 30-40 sec. Doing registration from a browser with empty cache confirmed that it was not registration but it was the confirmation page that was taking a long time and its a plain html page. It was all because the confirmation page was making 50 requests to the server to download images/js/css. The solution that clicked to me was simple, reduce the no of images, css, JS requests. The confirmation page was downloading all these images to 25 images/css/JS for rendering Header/Footer 5 images for rendering rounded corners 5-6 JS/...

Axis bank programming error or deliberate prank

Look at the number 4 in front of each menu item and the ) in front of logout. Even the signon page has a -) in the title. Not sure if it was some easter egg as both the pages seems to be functional in all respects.

Holy Cow Google is crawling my site real time

I submitted a post and it was searcheable on Google index within minutes. I wonder this is because the blogger I am using is owned by google.

Premature optimization

I have been assigned the task to increase the the performance of the application in my last 2 companies and from my past experience I believe in 80-20 code execution rule, i.e. in production most of the time its the 20% of the code that is being executed and the rest 80% is used rarely. Therefore before you embark on increasing the performance of the website You should know your customers You should know their usage patterns You should first collect statistics about what are the features that customers are using heavily Don't try to guess which features are used, do a quantitative analysis and focus on only those features that are used heavily. Apache/Tomcat access logs can be your buddies in reaching the goal, take daily logs from last 2-3 months put them in mysql or any DB using some simple python/perl script and create some excel graphs and do a trend analysis. For example in the below graph of webdav usage, I would rather focus on optimizing the PROPFINDs first then othe...

Brother MFC490CW printer offline issue

Bought a new Brother printer on Thanksgiving day sale, though the reviews for a 1 year old version were better I bought this one thinking that it would be more better, but this is worse. The printer has no issues connecting for the first time and I was able to scan,print, copy through it but after 2-3 weeks I had to print a document and the printer would show offline in systray.One design flaw I see straight away in printer was no Ethernet port, WTF and it had only a USB port(at 10 in the night I didn't wanted to go shop for a USB port). Googling on it I somehow found that if you reinstall the printer it would work, later I found that there is no need to reinstall as my router is DHCP and I hadn't given a static IP to the printer it was getting a different IP so I had to go to printer properties and change the port. After 1 week I had to scan a document for my wife's Math assignment and the printer in systray was showing offline, changing printer properties also wouldn...