Tag: desktop-management

Application Performance Monitoring using NetFlow Analyzer

In most of the Corporate networks, the common problem seen over decades is that application performance worsens during business hours. Network Admin managing the corporate network faces the huge task of finding out what is causing the slowness in accessing the application hosted on a remote data center. The application performance can degrade due to following reason s: Application installed server is not good enough (Related Hardware)

High Java CPU due to String Concatenation – String + Vs StringBuffer or StringBuilder

Many of you might know, the String concat(+) is costly operation compare to StringBuffer or StringBuilder append() method. But you might not know the actual performance difference. Let me show you the performance difference with a simple test program, package test; public class StrVsBuffVsBuild { public static void main(String[] args) { int count=200000; System.out.println(“Number of Strings concat Operation is ‘”+count+”‘”); long st = System.currentTimeMillis(); String str = “”; for (int i = 0; i < count; i++) { str += "MyString"; } System.out.println("Time taken for String concat (+) Operation is '"+(System.currentTimeMillis()-st)+"' Millis"); st = System.currentTimeMillis(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < count; i++) { sb.append("MyString"); } System.out.println("Time taken for StringBuffer.append() Operation is '"+(System.currentTimeMillis()-st)+"' Millis"); st = System.currentTimeMillis(); StringBuilder sbr = new StringBuilder(); for (int i = 0; i < count; i++) { sbr.append("MyString"); } System.out.println("Time taken for StringBuilder.append() Operation is '"+(System.currentTimeMillis()-st)+"' Millis"); } } Following are the output of the above test program, Number of Strings concat Operation is '200000' Time taken for String concat (+) Operation is '373933' Millis Time taken for StringBuffer.append() Operation is '19' Millis Time taken for StringBuilder.append() Operation is '5' Millis The String concat (+) took 6.2 Minutes , however others took only 19 / 5 milliseconds