<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5078108725173084206</id><updated>2011-07-29T01:45:50.063-07:00</updated><category term='ant  javac debug debug level'/><title type='text'>Java Tech Sharing</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-5824366429474983620</id><published>2011-05-03T07:12:00.000-07:00</published><updated>2011-07-17T23:29:31.072-07:00</updated><title type='text'>Compress Traces - increasing time frame captured by trace files</title><content type='html'>When I enable a  java server application traces in production environment - the traces only captured the last few minutes and this is not enough to diagnose some types of bugs.&lt;br /&gt;&lt;br /&gt;In order to extend the time coverage by the traces I did several changes:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;reduce the number of messages to be traced i.e.,"less is more" : I reduce the log level of many trace message to finest log level, keeping the most important messages in info level. So the finest messages can still be used during development stage but not in production environments.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;compress the messages before writing them to the log file.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Here are the different compress algorithms I tested:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The Dictionary : when tracing a line - we first split it to sub strings and then look for them in a hash table if it exist it return an integer associated with this string otherwise it insert this string as a key to a new unique integer. The hash table is also written to a file which act as a dictionary. The trace contain only integers.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Zip : when tracing a string, we buffered it into memory and after we have 100 messages we zip them to a byte array. Then we write to the array size followed by the its content.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Dictionary &amp;amp; Zip : when tracing a string, we use method 1 to replace the string with an integer, then buffering the integer into memory. After we have 1000 integers we zip them to a byte array. Then we write to the array size followed by the its content. &lt;/li&gt;&lt;/ol&gt;I ran the same simulation against the server application in order to create identical logs and calculate the compression ratio of the different methods above.&lt;br /&gt;&lt;br /&gt;Here are the results I got:&lt;br /&gt;&lt;table frame="VOID" rules="NONE" border="0" cellspacing="0" cols="5"&gt;  &lt;colgroup&gt;&lt;col width="132"&gt;&lt;col width="110"&gt;&lt;col width="86"&gt;&lt;col width="86"&gt;&lt;col width="86"&gt;&lt;/colgroup&gt;  &lt;tbody&gt;   &lt;tr&gt;    &lt;td align="LEFT" height="17" width="132"&gt;&lt;br /&gt;&lt;/td&gt;    &lt;td align="CENTER" width="110"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;No compression&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;    &lt;td align="CENTER" width="86"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Method-1&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;    &lt;td align="CENTER" width="86"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Method-2&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;    &lt;td align="CENTER" width="86"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Method-3&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;    &lt;td align="CENTER" height="17"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Trace file size (KB)&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;343&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;65&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;29&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;10&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;    &lt;td align="CENTER" height="17"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Compression ratio&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;1&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;5.27&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;11.82&lt;/span&gt;&lt;/td&gt;    &lt;td align="CENTER"&gt;&lt;span style="font-family:Arial;"&gt;34.3&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;  &lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;X-axis is the number of the compress algorithm as described above.&lt;br /&gt;Y-axis is calculated by (trace file with no compression) / (trace file with compression method x)&lt;br /&gt;&lt;img src="file:///C:/Users/guym/AppData/Local/Temp/moz-screenshot.png" alt="" /&gt;&lt;a href="http://2.bp.blogspot.com/-O1WqNvMZuFM/TcAjxEmHQlI/AAAAAAAAAB4/ojYA1DWkY6I/s1600/compression.bmp"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 227px; height: 256px;" src="http://2.bp.blogspot.com/-O1WqNvMZuFM/TcAjxEmHQlI/AAAAAAAAAB4/ojYA1DWkY6I/s400/compression.bmp" alt="" id="BLOGGER_PHOTO_ID_5602517262403060306" border="0" /&gt;&lt;/a&gt;I plan to post soon:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;measurements of performance degradation of option 3&lt;/li&gt;&lt;li&gt;measurements how time coverage improved by reducing the amount of trace messages.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;to be continue...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-5824366429474983620?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/5824366429474983620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2011/05/compress-traces-increasing-time-frame.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/5824366429474983620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/5824366429474983620'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2011/05/compress-traces-increasing-time-frame.html' title='Compress Traces - increasing time frame captured by trace files'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-O1WqNvMZuFM/TcAjxEmHQlI/AAAAAAAAAB4/ojYA1DWkY6I/s72-c/compression.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-1228777628199379324</id><published>2010-07-25T03:48:00.000-07:00</published><updated>2010-10-10T04:46:23.321-07:00</updated><title type='text'>When sendsignal and Ctrl+break fail to generate Java thread dump in Windows</title><content type='html'>I handled a customer incident where it was looked like the application was hang. As our application is running as NT service - I suggested to use &lt;a href="http://www.latenighthacking.com/projects/2003/sendSignal/"&gt;sendsignal &lt;/a&gt;in order to generate threads dump file. this worked fine in my local environment but on the customer environment the file was not generated. I then send a batch file that launch the application as console application instead than NT service and suggested to press Ctrl+Break in the application window in order to generate threads dump file.&lt;br /&gt;This also failed.&lt;br /&gt;The customer was using Remote Desktop application. I suspect that the failure is related to the fact that the "Ctrl+Break" was done from remote so I suggested to do it on the server's keyboard itself but this also failed.&lt;br /&gt;&lt;br /&gt;Next, I thought to generate the threads dump from inside the application. I googled on this but did not find away. I consult a colleague of mine on this and he told me on &lt;span style="font-style: italic;"&gt;com.ibm.jvm.Dump.JavaDump()&lt;/span&gt; see "&lt;a href="http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=/com.ibm.java.doc.diagnostics.50/html/whatdumpfis.html"&gt;IBM JVM 6.0 diagnostics guide&lt;/a&gt;".&lt;br /&gt;Before implementing this into our application, I went to consult my team lead on this idea - she thought there must be a more standard way to generate threads dump. She did not want to add new functionality (dump generation) that was  not necessary to our application activity. She asked me to try and find if such standard way exist.&lt;br /&gt;She was right - there is such way and it worked for the customer.&lt;br /&gt;I found it in the diagnostics guide above and it involves the use of three steps:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;generating system dump&lt;br /&gt;&lt;/li&gt;&lt;li&gt;extracting JVM info from the system dump&lt;br /&gt;&lt;/li&gt;&lt;li&gt;viewing the thread's stacks and monitors&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:100%;"&gt;How to generate system dump in windows&lt;/span&gt;  &lt;ol&gt;&lt;li&gt;install "userdump" from  Microsoft site: &lt;span class="nobr"&gt;&lt;a href="http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=e089ca41-6a87-40c8-bf69-28ac08570b7e&amp;amp;displayLang=en" title="Visit page outside WikiCentral" rel="nofollow"&gt;http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=e089ca41-6a87-40c8-bf69-28ac08570b7e&amp;amp;displayLang=en&lt;sup&gt;&lt;img class="rendericon" src="https://w3.tap.ibm.com/w3ki08/images/icons/linkext7.gif" alt="" width="7" align="absmiddle" border="0" height="7" /&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;run "userdump -p" . it will list all running processes and their  process id in the right column&lt;/li&gt;&lt;li&gt;find the application process id&lt;/li&gt;&lt;li&gt;run "userdump &lt;span style="font-style: italic;"&gt;pid&lt;/span&gt;  &lt;process_id&gt;&lt;application _pid=""&gt;" . this should generate " &lt;/application&gt;&lt;/process_id&gt;&lt;span style="font-style: italic;"&gt;process_name&lt;/span&gt;&lt;process_id&gt;&lt;application _pid=""&gt;&lt;application_name&gt;.dmp" file in  "C:\kktools\userdump8.1\x86" folder (in case you are using x86 platform)&lt;br /&gt;&lt;/application_name&gt;&lt;/application&gt;&lt;/process_id&gt;&lt;/li&gt;&lt;/ol&gt;   &lt;h3 style="font-weight: normal;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a name="HowtogenerateJavadumpsuserdumpinWindows?-How togenerateaJVMrelatedinfofromthesystemdump"&gt;&lt;/a&gt;How   to extract the JVM info from the system dump&lt;/span&gt;&lt;/h3&gt;  &lt;ol&gt;&lt;li&gt;cd to C:\kktools\userdump8.1\x86&lt;/li&gt;&lt;li&gt;run "jextract  &lt;span style="font-style: italic;"&gt;process_name&lt;/span&gt; .dmp". this should generate "&lt;span style="font-style: italic;"&gt;process_name&lt;/span&gt;.&lt;application_name&gt;dmp.zip" and  "&lt;application_name&gt;&lt;/application_name&gt;&lt;/application_name&gt;&lt;span style="font-style: italic;"&gt;process_name&lt;/span&gt;&lt;application_name&gt;&lt;application_name&gt;.dmp.xml"&lt;/application_name&gt;&lt;/application_name&gt;&lt;/li&gt;&lt;/ol&gt;   &lt;h3 style="font-weight: normal;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a name="HowtogenerateJavadumpsuserdumpinWindows?-Howtoreadthezipfile:"&gt;&lt;/a&gt;How  to view the thread's stacks and monitors&lt;/span&gt;&lt;/h3&gt;  &lt;ol&gt;&lt;li&gt;copy the &lt;span style="font-style: italic;"&gt;"process_name&lt;/span&gt;.dmp.zip" to a local folder&lt;br /&gt;&lt;/li&gt;&lt;li&gt;open CMD.exe&lt;/li&gt;&lt;li&gt;cd to the local folder&lt;br /&gt;&lt;/li&gt;&lt;li&gt;run "jdmpview -zip &lt;span style="font-style: italic;"&gt;process_name&lt;/span&gt;&lt;application_dump&gt;.dmp.zip"&lt;/application_dump&gt;&lt;/li&gt;&lt;li&gt;execute "set logging file &lt;span style="font-style: italic;"&gt;file_name&lt;/span&gt;&lt;log_file_name&gt;"&lt;/log_file_name&gt;&lt;/li&gt;&lt;li&gt;execute "set logging on"&lt;/li&gt;&lt;li&gt;execute "info thread *"&lt;/li&gt;&lt;li&gt;open the log file in editor and investigate&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By the way, &lt;span style="font-style: italic;"&gt;jdmpview &lt;/span&gt;has rich functionality and you can read on it in the diagnostics guide.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-1228777628199379324?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/1228777628199379324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/07/when-sendsignal-and-ctrlbreak-fail-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/1228777628199379324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/1228777628199379324'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/07/when-sendsignal-and-ctrlbreak-fail-to.html' title='When sendsignal and Ctrl+break fail to generate Java thread dump in Windows'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-6167787993672532500</id><published>2010-05-30T07:47:00.000-07:00</published><updated>2010-05-30T08:18:43.098-07:00</updated><title type='text'>How to create Window's dump files with unique names</title><content type='html'>We wanted to configure our server in Windows environment, so when one of its process crashes it will produce a dump file.&lt;br /&gt;&lt;br /&gt;Our first try was Dr.Watson but we quickly found out that it creates all dump files with the same name i.e., in case there are several crashes only the last one will have a dump file. This was unacceptable.&lt;br /&gt;&lt;br /&gt;After googling on this for a while I found this useful &lt;a href="http://www.debuginfo.com/articles/ntsdwatson.html#jitregister"&gt;article &lt;/a&gt;that talks about NTSD (NT Symbolic Debugger).&lt;br /&gt;This debugger has several advantages:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;it creates a unique dump file for each process that crashes&lt;/li&gt;&lt;li&gt;it does not need a special installation as it is included in Windows installation (in C:\WINDOWS\system32)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Note: It might be understood from the article above that the NTSD version that  comes with Windows Server 2003 does not support  unique dump file names but it does.&lt;br /&gt;&lt;br /&gt;Here is how to install NTSD:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;make sure your C code doe not catch exceptions (so the exception is handled by Windows code)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;open "regedit"&lt;/li&gt;&lt;li&gt;go to "&lt;span style="font-family:courier new;"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug&lt;/span&gt;"&lt;/li&gt;&lt;li&gt;choose "Debugger"&lt;/li&gt;&lt;li&gt;set: "&lt;span style="font-family:courier new;"&gt;ntsd.exe" -p %ld -e %ld -g -c ".dump /ma /u c:\app.dmp;q&lt;/span&gt;"&lt;/li&gt;&lt;/ol&gt;this will create dump files with names like "app_2010-05-30_08-07-25-406_145C.dmp" in "c:\" folder&lt;br /&gt;&lt;br /&gt;you can test the configuration by running &lt;a href="http://windbg.info/apps/46-crashme.html"&gt;CrashMe &lt;/a&gt;application&lt;a href="http://windbg.info/apps/46-crashme.html"&gt;&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-6167787993672532500?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/6167787993672532500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/how-to-create-windows-dump-files-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/6167787993672532500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/6167787993672532500'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/how-to-create-windows-dump-files-with.html' title='How to create Window&apos;s dump files with unique names'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-6217639983425461857</id><published>2010-05-21T00:11:00.000-07:00</published><updated>2010-07-27T01:33:12.946-07:00</updated><title type='text'>Field experience: Java Util Logger preformance tunning</title><content type='html'>I needed to run one of our Java server in production environment with full traces enabled.&lt;br /&gt;The server would crash under load, due to out of memory error. I've looked into the heap dump that was produced, with eclipse MemoryAnalayzer,   and found that the memory outage was due to overflow in the incoming message queue. I concluded that running with traces damaged the throughput and caused the outage.&lt;br /&gt;&lt;br /&gt;First, I wanted to measure the throughput without traces and found it is takes 0.18 ms to process a message. Then I run with full traces and measure that it took 20 ms to process a message, more than 100 times longer.&lt;br /&gt;&lt;br /&gt;My next step was to review the code related to the logger initialization and formatter. I found that when the logger was initialized then it was using  a ConsoleHandler (as well as FileHandler) by default while our server runs as NT service and have no console. This code was insert during development phase but was not needed in production. After removing this code, I measured 9.32 ms per message i.e., now it takes only 50 times longer.&lt;br /&gt;&lt;br /&gt;Next I tried to change the way we format a trace message e.g., In the formater, we had code that calculated the name of the method from the call stack. Similar, we had code that calculated the class name from the logger record. both were designed to remove the burden form the programmer to write the class name and method each time he writes a trace message and let this information be appended automatically. After removing this code, I measure 1.94 ms per message i.e.,  now it takes 10 times longer.  This code change means that the programmers will have to fix all existing message to include class and method names, and all future traces should be added with this information as well. This is a heavy task as hundreds of trace line should be manually fix but the impact of this change is an improvement by 500%. in case this change will enable running with traces in production than I think its worth the work.&lt;br /&gt;&lt;br /&gt;Next, I replaced the time calculation that is appended to each trace line and put System.currentTime, but this change had a minor impact of 1.69 ms per message.&lt;br /&gt;I had to decide if the burden of running a special tool to transfer the currentTime millisecond to date and daily time each time a trace is investigated is worth the minor throughput improvement and decided no to go with this change.&lt;br /&gt;&lt;br /&gt;Here is a graph that summarize the results: the blue graph depict the improvements of average time of processing message due to code change and the pink graph is the average time of processing a message without traces.&lt;br /&gt;the Vertical axis is the average time it took to process a message and the horizontal axis is the code changes I did:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;original code (name "base" in the graph)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;removal of tracing to console (named "console" in the graph)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;removal of class and method name from the formatter. (named "class and methods" in the graph)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;replacing Date with System.currentTime (named "currentTime" in the graph)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_Y4Jf01QpI/AAAAAAAAABg/O0yVGmuljgA/s1600/sm_trace_improvement_graph.bmp"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 246px;" src="http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_Y4Jf01QpI/AAAAAAAAABg/O0yVGmuljgA/s400/sm_trace_improvement_graph.bmp" alt="" id="BLOGGER_PHOTO_ID_5473624132928488082" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I've conducted a load test against our application with two set ups: one with the original logging we had and the other with logging version were I removed the logging to console and the class and method name from the formatter.&lt;br /&gt;The result of the tests show that in the first set up the application was not available 100% of the time while in the second set up it was not available only 15% of the time. the maximum response time was ~10 minutes and the average response time was 24.6 seconds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-6217639983425461857?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/6217639983425461857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/field-experience-java-util-logger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/6217639983425461857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/6217639983425461857'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/field-experience-java-util-logger.html' title='Field experience: Java Util Logger preformance tunning'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_Y4Jf01QpI/AAAAAAAAABg/O0yVGmuljgA/s72-c/sm_trace_improvement_graph.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-3525691299595080961</id><published>2010-05-14T03:49:00.000-07:00</published><updated>2010-05-17T02:01:25.414-07:00</updated><title type='text'>Java Logger with SimpleFormatter is ten time slower than OutputStream</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_EFKttZHyI/AAAAAAAAABQ/bOjShmfnAGQ/s1600/results.bmp"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;I compared the time it takes to write a log file with several Java I/O classes and found that Logger takes 10 times longer than OutputStream.&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;I used OutputStream, RandomAccessFile and Logger to write a trace file of million lines. each line contained 250 characters and a prefix of the writing time. I repeated and  collected the results 7 times.&lt;br /&gt;&lt;br /&gt;The graph below summarize the results: vertical axe is the time it took to write the file in milliseconds and the horizontal is the sampling number.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_EFKttZHyI/AAAAAAAAABQ/bOjShmfnAGQ/s1600/results.bmp"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 228px;" src="http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_EFKttZHyI/AAAAAAAAABQ/bOjShmfnAGQ/s400/results.bmp" alt="" id="BLOGGER_PHOTO_ID_5472160703858679586" border="0" /&gt;&lt;/a&gt;Here is the I/O setup I used :&lt;br /&gt;FileInputStream #1 - PrintWriter with auto flush enabled&lt;br /&gt;FileInputStream #2 - PrintWriter with auto flush disabled&lt;br /&gt;RandomAccessFile #1 - RandomAccessFile which write to file after each line&lt;br /&gt;RandomAccessFile #2 - RandomAccessFile which store 10,000 lines in a buffer before writing to file&lt;br /&gt;RandomAccessFile #3 - RandomAccessFile which store 200,000 lines in a buffer before writing to  file&lt;br /&gt;Logger #1 - Java util logger (JUL) with SimpleFormatter&lt;br /&gt;Logger #2 - JUL with a Formatter that append the time to each message&lt;br /&gt;Logger #3 -  JUL with a Formatter that append the time and class name  to each message&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-3525691299595080961?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/3525691299595080961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/java-logger-is-ten-time-slower-than.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/3525691299595080961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/3525691299595080961'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/05/java-logger-is-ten-time-slower-than.html' title='Java Logger with SimpleFormatter is ten time slower than OutputStream'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_5_aRZlMa6Hw/S_EFKttZHyI/AAAAAAAAABQ/bOjShmfnAGQ/s72-c/results.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-3698829835155283394</id><published>2010-04-12T02:01:00.000-07:00</published><updated>2010-04-12T04:03:46.416-07:00</updated><title type='text'>Java Notes API prints "PANIC: Insufficient memory."</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt;&lt;br /&gt;A Java application using the Java Notes API (for IBM Domino server) printed:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Thread=[1934:0002-193C]&lt;/span&gt; &lt;span style="font-style: italic;"&gt;Stack base=0x0032EB34, Stack size = 1248 bytes&lt;/span&gt; &lt;span style="font-style: italic;"&gt;PANIC: Insufficient memory.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;when it was reading and writing to a large size NSF file ~2GB .&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution:&lt;br /&gt;&lt;/span&gt;setting the JVM maximum heap to 200MB with "-Xmx200m"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why this resolve the issue?&lt;/span&gt;&lt;br /&gt;When launching a JVM without "-Xmx" parameter the JVM set it to a default value which on Windows platform is half of the real memory.&lt;br /&gt;As the machine had 3.5 GB RAM , it means the JVM tried to reserve 1.7 GB for the process.&lt;br /&gt;The Java Notes API uses the process shared memory to handle the nsf.&lt;br /&gt;it PANIC when it could not allocate more memory, as 1.7 GB of process memory space was already reserved by the JVM.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What facts suggested the cause?&lt;/span&gt;&lt;br /&gt;The domino server NSD contained the following:&lt;br /&gt;   COMMIT RESERVED    TOTAL&lt;br /&gt;  PRIVATE:    25.1M     1.7G     1.7G&lt;br /&gt;   MAPPED:   174.9M     4.5M   179.4M&lt;br /&gt;    IMAGE:    56.1M     0.0K    56.1M&lt;br /&gt;    TOTAL:   256.1M     1.7G     2.0G&lt;br /&gt;which indicated that the memory was reserved by the Java application and not by the Java Notes API&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-3698829835155283394?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/3698829835155283394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/04/java-notes-api-prints-panic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/3698829835155283394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/3698829835155283394'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/04/java-notes-api-prints-panic.html' title='Java Notes API prints &quot;PANIC: Insufficient memory.&quot;'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-5585752617636859000</id><published>2010-01-27T01:23:00.000-08:00</published><updated>2010-01-27T01:40:16.967-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ant  javac debug debug level'/><title type='text'>ant compile without debug information by default</title><content type='html'>&lt;div style="text-align: left;"&gt;I've wrote a build.xml for a java project and found out that the application trace contained exceptions stack trace with "&lt;small&gt;&lt;span style=";font-family:Verdana,Arial,Helvetica;font-size:85%;"  &gt;(Unknown Source)"&lt;b&gt;  &lt;/b&gt;&lt;/span&gt;&lt;/small&gt;instead of line numbers.&lt;br /&gt;I found out that ant compile without debug information by default.&lt;br /&gt;&lt;br /&gt;The way to set debug information is by adding&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);font-family:courier new;" &gt;debug="true" debuglevel="lines,vars,source"&lt;/span&gt;&lt;br /&gt;to the javac task.&lt;br /&gt;&lt;br /&gt;&lt;javac srcdir="${src};${toolkit_tests}" destdir="${build}" includes="com/ibm/sametime/**,com/lotus/sametime/util" extdirs="${toolkit_jar};${junit_jar}" fork="true" style="color: rgb(0, 153, 0);"&gt;&lt;/javac&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;javac srcdir="${src};${toolkit_tests}" destdir="${build}" includes="com/ibm/sametime/**,com/lotus/sametime/util" extdirs="${toolkit_jar};${junit_jar}" fork="true"&gt;&lt;span style="color: rgb(0, 153, 0);"&gt; &lt;/span&gt;&lt;/javac&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;javac srcdir="${src};${toolkit_tests}" destdir="${build}" includes="com/ibm/sametime/**,com/lotus/sametime/util" extdirs="${toolkit_jar};${junit_jar}" fork="true" style="color: rgb(0, 153, 0);"&gt;&lt;/javac&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-5585752617636859000?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/5585752617636859000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/01/ant-compile-without-debug-information.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/5585752617636859000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/5585752617636859000'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/01/ant-compile-without-debug-information.html' title='ant compile without debug information by default'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-8159287901773382626</id><published>2010-01-10T03:31:00.000-08:00</published><updated>2010-01-10T04:39:13.296-08:00</updated><title type='text'>Can not open solutions and projects in Visual Studio 2003</title><content type='html'>&lt;div dir="ltr"&gt;&lt;div dir="ltr"&gt;One day I could not open solutions and projects in my Visual Studio 2003 - every time I've doubled click the solution then the Visual Studio had crashed immediately.&lt;/div&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;The Solution:&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;delete my account profile for VisualStuido in windows by:&lt;br /&gt;1) go Documents and Settings - Find your account - Application Data - Microsoft - delete your VisualStudio folder.&lt;br /&gt;2) go Documents and Settings - Find your account - Local Settings - Application Data - Microsoft -delete your VisualStudio folder.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;The Investigation:&lt;/div&gt;&lt;div dir="ltr"&gt;I've Googled with th error in the Windows event viewer log.&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;Here is a link to the site that contained this information: &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/bd2cd8e8-58a1-4b7a-878f-80c9981179c7"&gt;http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/bd2cd8e8-58a1-4b7a-878f-80c9981179c7&lt;/a&gt;&lt;br /&gt;&lt;div dir="ltr"&gt;&lt;span class="Apple-style-span"   style="font-family:Arial;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre; font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;span class="Apple-style-span"   style="font-family:Arial;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;span class="Apple-style-span"   style="font-family:Arial;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-8159287901773382626?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/8159287901773382626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2010/01/can-not-open-solutions-and-projects-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/8159287901773382626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/8159287901773382626'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2010/01/can-not-open-solutions-and-projects-in.html' title='Can not open solutions and projects in Visual Studio 2003'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5078108725173084206.post-441525794602761848</id><published>2009-12-30T01:12:00.000-08:00</published><updated>2009-12-30T13:36:11.833-08:00</updated><title type='text'>JNI_CreateJavaVM failed with "Failed to find VM - aborting" in Linux for IBM JDK1.5</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;div dir="ltr" style="text-align: left;"&gt;I was trying to use IBM JDK 1.5 JNI in Linux.&lt;br /&gt;I've added the libjvm.so path i.e. "ibm-jre/jre/bin/classic"  to the LD_LIBRARY_PATH.&lt;br /&gt;when I launched the code I've got "Failed to find VM - aborting" message after running the JNI_CreateJavaVM.&lt;br /&gt;after investigating this for a while I found that the JVM lib is loading other libs that are located in "ibm-jre/jre/bin" path.&lt;br /&gt;So adding both  "ibm-jre/jre/bin/classic" and "ibm-jre/jre/bin" to the LD_LIBRARY_PATH resolved the issue and the JVM was initate Okay.&lt;br /&gt;&lt;br /&gt;BTW, When I tried to use IBM JDK1.6 in Linux with only "ibm-jre/jre/bin/classic" in  the LD_LIBRARY_PATH then the JVM was launched Okay.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5078108725173084206-441525794602761848?l=javatechsharing.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javatechsharing.blogspot.com/feeds/441525794602761848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javatechsharing.blogspot.com/2009/12/jni-call-createjvmmethod-failed-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/441525794602761848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5078108725173084206/posts/default/441525794602761848'/><link rel='alternate' type='text/html' href='http://javatechsharing.blogspot.com/2009/12/jni-call-createjvmmethod-failed-with.html' title='JNI_CreateJavaVM failed with &quot;Failed to find VM - aborting&quot; in Linux for IBM JDK1.5'/><author><name>Guy Moshkowich</name><uri>http://www.blogger.com/profile/11250759260249991208</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_5_aRZlMa6Hw/S2AF3CkzzfI/AAAAAAAAAAM/eiJDFZ14fyY/S220/Guy_passport_picture3.bmp'/></author><thr:total>0</thr:total></entry></feed>
