No… [root@cmhlcarchapp01 ~]# cat t.java import java.util.concurrent.*; public class t implements Runnable { static ArrayBlockingQueue Q = new ArrayBlockingQueue(5); String type; public static void main (String args[]) { t n = new t(“producer”); t n2 = new t(“consumer”); } public…
Category: Java Performance
Improving batch inserts into MySQL
We had a custom class to copy data from Oracle to MySQL at AWS. It was sending each statement individually, even though we batched them. import java.sql.*; public class test { public static void main(String args[]) throws Exception { Class.forName(“com.mysql.jdbc.Driver”);…
Flexibly instrumenting java with CPU utilization recordings
Each of these has their own set of strengths, and is appropriate for differing and sometimes similar requirements. What each of them lack is the ability to flexibly, easily, and succinctly report on CPU utilization at not only an individual…
What does web service do when client has socket timeout exceeded?
It should throw a broken pipe exception. Below shows an strace of a server socket when the client has timed out after not receiving a response in the time period it specified (setTimeout() method)… 13125 12:19:13.666786 ) = 1 ([{fd=7,…
Java garbage collection stats
jstat -gcutil -t 18987 1000 where 18987 is the java PID, and 1000 is the number of milliseconds (1 second) between samples 896794.7 0.00 0.00 4.01 5.63 98.94 9259 282.051 250 336.211 618.262 896795.7 0.00 0.00 5.31 5.63 98.94 9259…
Predict full CMS collection
((heap * cms fraction) – current heap used (young and tenured)) / growth rate = prediction Sample data from GC log… : 4499906K->310178K(4718592K), 0.2461130 secs] 10382742K->6214227K(12058624K), 0.2469460 secs] [Times: user=2.77 sys=0.03, real=0.25 secs] 2016-10-25T09:41:02.431-0400: 48708.056: [GC 48708.056: [ParNew48708.198: [SoftReference, 0…
Testing the overhead of creating connections vs using a pool in Weblogic
We had a need to understand the overhead of creating connections versus using a pool. Connection pooling is most beneficial when using very short lived database sessions. If the associated database request takes longer than a few seconds, we needed…
Getting memory by thread
This is not perfect, as the heap is shared. However, the documentation indicates that a ThreadMXBean can calculate how much is in use by each. The idea behind this would be to either instrument your code, or use byte code…
Setting java command line flags when value is default
Just a snippet of how I proved we were setting values to the default. While this has no negative impact, it does result in needless conversations like… “Why did we set that?” “It’s the default, don’t worry about it.” “Really?…