<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>ExploreIT</title><description></description><managingEditor>noreply@blogger.com (sridhar)</managingEditor><pubDate>Sat, 4 Apr 2026 23:53:53 -0700</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">47</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://tech-wikis.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle/><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><title>TensorFlow</title><link>http://tech-wikis.blogspot.com/2018/11/tensorflow.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Mon, 26 Nov 2018 01:26:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6653335322881878028</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
TensorFlow !!&lt;br /&gt;
&lt;br /&gt;
one more cool yet powerful framework/library to develop ML programs.&lt;br /&gt;
&lt;br /&gt;
The underlying basis for this is a directed graph. The data otherwise called edges flows through nodes which are otherwise called operations.&lt;br /&gt;
&lt;br /&gt;
TensorFlow normally works in a lazy way i.e., it builds the graphs and execution happens later during the programming although, there is an 'eager' way to execute in runtime mode. And, the TensorFlow programming happens at "estimator" api level. Or there is another high level API called 'keras' which can be used to define models and execute at ease.&lt;br /&gt;
&lt;br /&gt;
This is how it can be installed..&lt;br /&gt;
&lt;br /&gt;
conda - package manager can be used for this. update conda and then use conda to upgrade all the packages if you are not sure which ones are dependent packages like numpy etc.,&lt;br /&gt;
And, then install python packages using pip3 to install/upgrade tensorflow and keras.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>ML how to..</title><link>http://tech-wikis.blogspot.com/2018/11/ml-how-to.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sun, 11 Nov 2018 01:15:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-3216011462239413630</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
How to approach an ML problem.. here is what I think&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Take a look at the data and decide what do you want to do like, what to predict - &lt;b&gt;Explore the data&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
2. Decide what type of ML problem is it - &lt;b&gt;unsupervised / supervised (classification / regression)&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
3. Clean up the data .. remove unwanted data, noise, decide on features and create features, normalize feature values -&lt;b&gt; data cleanup and feature engineering&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
4. Create data sets - &lt;b&gt;training/validation/test data sets&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
5. Train the model - supply train and validation sets, choose the model parameters, loss function, number of iterations etc., &lt;b&gt;- Create and train a model&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
6. evaluate the error on training set and validation set. Tune the parameters and re-train until the error is close on both training and validation sets - &lt;b&gt;model validation and tuning&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
7. Check the model prediction on the test data set which is the data set that the model was not aware of the output label value in the above phases &lt;b&gt;- final check&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
8. all good ? release to live data. If not, repeat above by revisiting input features and model and model parameters to get a better fit. - &lt;b&gt;going live&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Machine Learning</title><link>http://tech-wikis.blogspot.com/2018/11/machine-learning.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sat, 10 Nov 2018 23:09:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-7723957162538989945</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Machine Learning - as the name suggest, it is about teaching a machine to learn about something. The crust is about how to teach a machine.. the better you teach the better it learns.&lt;br /&gt;
&lt;br /&gt;
How we teach a machine ? well, remember the word 'maths' ? it is every where.. most of the logical problems are solved through maths and that is how machines work. so, we teach the same way.. to do that, it is required to collect 'enough' data sets and feed it to a machine asking to fit a mathematical equation. By doing so, the machine learns about the data and its dynamics .. once it is done, the machine would be able to predict the outcome for a future data point.&lt;br /&gt;
&lt;br /&gt;
the first step in doing so, is identify what kind of ML problem is it. Generally, an ml problem falls into either of the two categories or sometimes both ! depends on what you want..&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ML Problem&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;supervised&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unsupervised&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; classification&amp;nbsp; &amp;nbsp; regression&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;grouping/clustering&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
supervised problems are the cases where the data sets contains both input (features) and output (label). The teaching process will be carried out in guidance with the output so that, ml algorithm will know how is it doing how to evaluate the model so that it better fits to the data.&lt;br /&gt;
&lt;br /&gt;
This is further categorized into two types. 'classification' is type of problem where the output is basically classified into two or a few unique values and the goal is to fit a model so that, the future data point will be classified into the given sets. like what is the number that a given picture contains..&lt;br /&gt;
&lt;br /&gt;
Regression is the second type of supervised problems where the output variable is a continuous label instead of limited/discrete value. like whether your favorite team wins a match against a given opponent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unsupervised problems are the cases where the outcome is not really known. So, the goal is to fit a model in order to identify the clusters in the data sets.&lt;br /&gt;
&lt;br /&gt;
There are lot of ML Algorithms and libraries and frameworks available as opensource and as commercial products in the market already..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Web Application's Navigation Paths and Page Performance</title><link>http://tech-wikis.blogspot.com/2018/01/web-applications-navigation-paths-and.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Fri, 12 Jan 2018 23:03:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-2330428010770027572</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
I have been trying to find out a better way to visualize and better understand how a web application is being accessed by the end users and how the end user journey looks like and which pages are indirectly became the close groups based on how the end users are distributed and their interests in the application features. And, finally how smooth is the path between pages..&lt;br /&gt;
&lt;br /&gt;
And, stumbled on a wonderful visualization tool called Gephi. And, below is how a sample website looks like depicting the user navigation paths, the page grouping and page performance which is characterized by the weights of the path between the pages. In the graph terminology, the pages are nodes and the paths between pages are called edges which are attributed by response times as weight.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUbsCS6Oxjrg9qbAqw_0ZvQry14zX-BEgrmfr0Zxmu_0mp49B5D2Q9R4VstvB5QB4-3qJXC9SLZPcDdvfSDS-vxIb511nOOTHEhijDdZ28lgg3uXyXt8sgivVMg2owvteIJLGqI9dxTc/s1600/Website_UserPaths_And_Performance_1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="551" data-original-width="704" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUbsCS6Oxjrg9qbAqw_0ZvQry14zX-BEgrmfr0Zxmu_0mp49B5D2Q9R4VstvB5QB4-3qJXC9SLZPcDdvfSDS-vxIb511nOOTHEhijDdZ28lgg3uXyXt8sgivVMg2owvteIJLGqI9dxTc/s1600/Website_UserPaths_And_Performance_1.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUbsCS6Oxjrg9qbAqw_0ZvQry14zX-BEgrmfr0Zxmu_0mp49B5D2Q9R4VstvB5QB4-3qJXC9SLZPcDdvfSDS-vxIb511nOOTHEhijDdZ28lgg3uXyXt8sgivVMg2owvteIJLGqI9dxTc/s72-c/Website_UserPaths_And_Performance_1.PNG" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>A Sample Splunk Dashboard</title><link>http://tech-wikis.blogspot.com/2017/10/a-sample-splunk-dashboard.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 4 Oct 2017 06:39:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6691483602955181929</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
A sample dashboard built using Splunk.. showing some meaningful stats from some pseudo data.&lt;br /&gt;
Have to say wow ! it was so quick to build and the responsiveness of the features are so fast .. and it's fun learning this stuff..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNgQGD3kVqnLbsHcfj7k48hLILeherH2c9pzBvZaH_iGAwbQIqLI1aN0n5qXL2q-Q70TgtISOXfDAh_u7qnTtryEIzPHpWpd8habqZkxgiKwQmK7oQP9nI4mqz7tl2MQGJ3B7jX9ziEcQ/s1600/sample.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="596" data-original-width="1337" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNgQGD3kVqnLbsHcfj7k48hLILeherH2c9pzBvZaH_iGAwbQIqLI1aN0n5qXL2q-Q70TgtISOXfDAh_u7qnTtryEIzPHpWpd8habqZkxgiKwQmK7oQP9nI4mqz7tl2MQGJ3B7jX9ziEcQ/s640/sample.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNgQGD3kVqnLbsHcfj7k48hLILeherH2c9pzBvZaH_iGAwbQIqLI1aN0n5qXL2q-Q70TgtISOXfDAh_u7qnTtryEIzPHpWpd8habqZkxgiKwQmK7oQP9nI4mqz7tl2MQGJ3B7jX9ziEcQ/s72-c/sample.PNG" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Applying machine learning to study and do capacity planning</title><link>http://tech-wikis.blogspot.com/2017/05/applying-machine-learning-to-study-and.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Thu, 25 May 2017 07:01:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6174133992836890085</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
ML algorithms and libraries have evolved and the scope of applying the techniques has also grown a lot. I am trying here to apply one of such techniques to study the performance metrics and then estimate the required capacity at a future load.&lt;br /&gt;
&lt;br /&gt;
Lets take a simple set like pageviews and heap usage&lt;br /&gt;
Example:&lt;br /&gt;
pv, &amp;nbsp;heapusage(mb)&lt;br /&gt;
105,637&lt;br /&gt;
110,638&lt;br /&gt;
115,640&lt;br /&gt;
120,642&lt;br /&gt;
125,644&lt;br /&gt;
130,646&lt;br /&gt;
135,648&lt;br /&gt;
140,650&lt;br /&gt;
145,652&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now, since this is not a classification type dataset, the regression models can be used. There are a few regression models from one of the coolest ML libraries - scikit (sklearn).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
let's take a linearRegression model and try to fit it on the set.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The logic to implement the model is: &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
- declare the data set into arrays (have not changed the parameters like squaring them etc.,)&lt;/div&gt;
&lt;div&gt;
- create sets for training and validation as 20% is used for validation&lt;/div&gt;
&lt;div&gt;
- choose the model as linearRegression&lt;/div&gt;
&lt;div&gt;
- fit the model on the train set to make it learn the trends&lt;/div&gt;
&lt;div&gt;
- get the score of learning to verify how well it has fit on the dataset&lt;/div&gt;
&lt;div&gt;
- get the coefs and intecepts used to fit the model&lt;/div&gt;
&lt;div&gt;
- predict the validation set and compare it with actual values in validation set&lt;/div&gt;
&lt;div&gt;
- if it is all good, then try to predict the load for future increased load&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once, this is done, I have build wrappers and a simple UI.&lt;br /&gt;
&lt;br /&gt;
UI Page 1: To simply upload the feature file i.e. the metrics file&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuEsmLZV9n8zG44BZJimsLNuAcwMhQYsE-0QiwOwu-H0kulSWUEP7sva-mnSwyFwacLjoXUBkV2i0PcgkDdvobyL6ngmjG6ElVpDrS8I7kXofyepZFi70UyG-2mp647KI4Zrq57Y-7y4I/s1600/Input.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="295" data-original-width="748" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuEsmLZV9n8zG44BZJimsLNuAcwMhQYsE-0QiwOwu-H0kulSWUEP7sva-mnSwyFwacLjoXUBkV2i0PcgkDdvobyL6ngmjG6ElVpDrS8I7kXofyepZFi70UyG-2mp647KI4Zrq57Y-7y4I/s320/Input.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
UI Page 2: This will show the result. The correlation between the metrics, validation sets and how close the predicted values and finally the predicted output i.e. required Heap Memory for the given page views.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMn6f9pi8LBmIMfBPxIrbKKZhkCPM2bFz37r0SERn2deOPRz0EmwlaIepNJkvLp9fXpN_8EQWyCpM0sHSMC5871M4uIIQt6EGS4kIt8_nHHdnHhZryupeVuPIQ86kOPa2uUFODJ2YlAgM/s1600/Result.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="844" data-original-width="1600" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMn6f9pi8LBmIMfBPxIrbKKZhkCPM2bFz37r0SERn2deOPRz0EmwlaIepNJkvLp9fXpN_8EQWyCpM0sHSMC5871M4uIIQt6EGS4kIt8_nHHdnHhZryupeVuPIQ86kOPa2uUFODJ2YlAgM/s320/Result.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Although this is a simple demonstration, more features can be added..&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuEsmLZV9n8zG44BZJimsLNuAcwMhQYsE-0QiwOwu-H0kulSWUEP7sva-mnSwyFwacLjoXUBkV2i0PcgkDdvobyL6ngmjG6ElVpDrS8I7kXofyepZFi70UyG-2mp647KI4Zrq57Y-7y4I/s72-c/Input.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>some useful linux commands</title><link>http://tech-wikis.blogspot.com/2017/04/some-useful-linux-commands.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sun, 23 Apr 2017 07:13:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-2051794023744834903</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Below are some of the useful linux commands to diagnose issues..&lt;br /&gt;
&lt;br /&gt;
To know about processes, parent and call heirarchy and to know the process's resource usage etc., we can use pstree, ps, top -H etc.,&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;b&gt;pstree&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
init─┬─Xvnc&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;├─crond&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;├─firefox───9*[{firefox}]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;├─gnome-terminal─┬─bash&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;│ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;├─gnome-pty-helpe&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;│ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;└─{gnome-terminal}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;├─gnome-terminal─┬─bash───su───bash───startWebLogic.s───java───103*[{java}]&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ps -e f&lt;/b&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
132 ? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sl &amp;nbsp; &amp;nbsp; 0:01 gnome-terminal&lt;br /&gt;
137 ? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S &amp;nbsp; &amp;nbsp; &amp;nbsp;0:00 &amp;nbsp;\_ gnome-pty-helper&lt;br /&gt;
138 pts/1 &amp;nbsp; &amp;nbsp;Ss &amp;nbsp; &amp;nbsp; 0:00 &amp;nbsp;\_ bash&lt;br /&gt;
353 pts/1 &amp;nbsp; &amp;nbsp;S &amp;nbsp; &amp;nbsp; &amp;nbsp;0:00 &amp;nbsp;| &amp;nbsp; \_ su&lt;br /&gt;
357 pts/1 &amp;nbsp; &amp;nbsp;S+ &amp;nbsp; &amp;nbsp; 0:00 &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; \_ bash&lt;br /&gt;
460 pts/1 &amp;nbsp; &amp;nbsp;S &amp;nbsp; &amp;nbsp; &amp;nbsp;0:00 &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \_ /bin/sh ./startWebLogic.sh&lt;br /&gt;
510 pts/1 &amp;nbsp; &amp;nbsp;Sl &amp;nbsp; &amp;nbsp;26:44 &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \_ /...../jdk/bin/java -server -Xms256m -Xmx1024m -Dwe&lt;br /&gt;
993 pts/0 &amp;nbsp; &amp;nbsp;Ss+ &amp;nbsp; &amp;nbsp;0:00 &amp;nbsp;\_ bash&lt;br /&gt;
&lt;br /&gt;
while ps -ef can give you full command of the process&lt;br /&gt;
And, it will also show the parent process id and process cpu, rss size etc.,&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
To know all the list of files that the process has accessed, lsof is the command..&lt;br /&gt;
&lt;br /&gt;
/usr/sbin/lsof -p 510&lt;br /&gt;
&lt;br /&gt;
So the weblogic server which is a JVM has accessed 2K+ files. And example is below..&lt;br /&gt;
&lt;br /&gt;
COMMAND &amp;nbsp; PID USER &amp;nbsp; FD &amp;nbsp; TYPE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DEVICE SIZE/OFF &amp;nbsp; &amp;nbsp; NODE NAME&lt;br /&gt;
java &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;510 root &amp;nbsp; &amp;nbsp; &amp;nbsp;cwd &amp;nbsp; &amp;nbsp;DIR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;202,2 &amp;nbsp; &amp;nbsp; 4096 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5657417 .../DefaultDomain&lt;br /&gt;
&lt;br /&gt;
FD -is the file descriptor like below &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cwd &amp;nbsp;current working directory;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mem &amp;nbsp;memory-mapped file;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mmap memory-mapped device;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pd &amp;nbsp; parent directory;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;rtd &amp;nbsp;root directory;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tr &amp;nbsp; kernel trace file&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt; &lt;br /&gt;
TYPE is the file type like a REGulare or DIRectory..&lt;br /&gt;
NODE is the inode number&lt;br /&gt;
DEVICE indicates the device type and partition numbers&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are couple of other useful commands to debug issues like &lt;b&gt;top -H -p &lt;pid&gt; &lt;/pid&gt;&lt;/b&gt;will give the thread level processor utilization which is useful when debugging high CPU consumption&lt;br /&gt;
issues in a JVM..&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;strace&lt;/b&gt; is another useful command to know what a process is doing at OS level like socket connections, reads etc.,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;netstat &lt;/b&gt;is another command with options like -nap gives the information on the connections and rec/send Q which can indicate any network or program slow or being blocked and which&lt;br /&gt;
connections in which state etc.,&lt;br /&gt;
&lt;br /&gt;
Disk space check commands like &lt;b&gt;df -h, du -sh .&lt;/b&gt; etc., are useful to verify sizes and space on disk and network shares&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;free -g&lt;/b&gt; is another useful command to know how much memory has been consumed in physical, swap and cache/buffer areas.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SAR&lt;/b&gt; is another great collection of metrics rangning from processes, memory, swap activity, CPU, load average, disk, network etc.,&lt;br /&gt;
&lt;br /&gt;
To flush out the cache and buffers &lt;b&gt;drop_caches &lt;/b&gt;is what that needs to be cleared out. Example as shown below&lt;br /&gt;
&lt;br /&gt;
free -m&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;total &amp;nbsp; &amp;nbsp; &amp;nbsp; used &amp;nbsp; &amp;nbsp; &amp;nbsp; free &amp;nbsp; &amp;nbsp; shared &amp;nbsp; &amp;nbsp;buffers &amp;nbsp; &amp;nbsp; cached&lt;br /&gt;
Mem: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15500 &amp;nbsp; &amp;nbsp; &amp;nbsp;15330 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;169 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;249 &amp;nbsp; &amp;nbsp; &amp;nbsp;11778&lt;br /&gt;
-/+ buffers/cache: &amp;nbsp; &amp;nbsp; &amp;nbsp; 3302 &amp;nbsp; &amp;nbsp; &amp;nbsp;12197&lt;br /&gt;
Swap: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10047 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1704 &amp;nbsp; &amp;nbsp; &amp;nbsp; 8342&lt;br /&gt;
&lt;br /&gt;
echo 1 &amp;gt; /proc/sys/vm/drop_caches &amp;nbsp; --- this will flush out the cache and buffers.&lt;br /&gt;
&lt;br /&gt;
free -m&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;total &amp;nbsp; &amp;nbsp; &amp;nbsp; used &amp;nbsp; &amp;nbsp; &amp;nbsp; free &amp;nbsp; &amp;nbsp; shared &amp;nbsp; &amp;nbsp;buffers &amp;nbsp; &amp;nbsp; cached&lt;br /&gt;
Mem: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15500 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3367 &amp;nbsp; &amp;nbsp; &amp;nbsp;12132 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;635&lt;br /&gt;
-/+ buffers/cache: &amp;nbsp; &amp;nbsp; &amp;nbsp; 2731 &amp;nbsp; &amp;nbsp; &amp;nbsp;12768&lt;br /&gt;
Swap: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10047 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1704 &amp;nbsp; &amp;nbsp; &amp;nbsp; 8342&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The above is useful if you want something to be loaded into memory again with some runtime changes and also to test out something like a disk speed&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
To check &lt;b&gt;disk speed: DD&lt;/b&gt; - a linux command is a very useful one.&lt;br /&gt;
&lt;br /&gt;
Example Write test:&lt;br /&gt;
&lt;b&gt;&amp;nbsp;date; time dd if=ip/test.txt of=op/test.txt bs=1024k count=1000&lt;/b&gt;&lt;br /&gt;
Sun Apr 23 06:46:17 PDT 2017&lt;br /&gt;
1000+0 records in&lt;br /&gt;
1000+0 records out&lt;br /&gt;
1048576000 bytes (1.0 GB) copied, 3.15715 seconds, 332 MB/s&lt;br /&gt;
&lt;br /&gt;
real &amp;nbsp; &amp;nbsp;0m3.164s&lt;br /&gt;
user &amp;nbsp; &amp;nbsp;0m0.000s&lt;br /&gt;
sys &amp;nbsp; &amp;nbsp; 0m1.104s&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
-- date is to print out which date and time is to time the command and it is writing a file from ip dir to op dir with block size as 1K and a 1000 times i.e. a total of 1GB. This has spent 3.16s total i.e. 'real' means the elapsed time and system mode CPU time is 1.1 s and nothing really in user mode. So its basically the speed i.e. 332 MB/s took that much time..&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
But to test it in isolation i.e. read and write speeds, one can use /dev/zero which is a special null char file gives as many as read..&lt;br /&gt;
&lt;br /&gt;
date; time dd of=/dev/zero if=test.txt bs=1024k count=1000 &amp;nbsp; --- read speed&lt;br /&gt;
date; time dd if=/dev/zero of=test.txt bs=1024k count=1000 &amp;nbsp; --- write speed&lt;br /&gt;
&lt;br /&gt;
some of other commands like &lt;b&gt;ping, tracert&lt;/b&gt; can be used to test the network speed and network paths..&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Test JMS Connections</title><link>http://tech-wikis.blogspot.com/2017/03/test-jms-connections.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Fri, 3 Mar 2017 23:22:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-7339130999489911028</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Below a simple code to test the jms connection. This will time the initialcontext and the queue connection steps. You can get a queue and factory details from the weblogic console. Services - Messaging - JMSModules. Pre-reqs are like, you need to create a JMS server, JMSModule, ConnectionFactory, Queue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.util.Hashtable;&lt;br /&gt;
import javax.jms.*;&lt;br /&gt;
import javax.naming.Context;&lt;br /&gt;
import javax.naming.InitialContext;&lt;br /&gt;
import javax.naming.NamingException;&lt;br /&gt;
&lt;br /&gt;
public class TestJMS&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";&lt;br /&gt;
public final static String JMS_FACTORY="testFactory";&lt;br /&gt;
public final static String QUEUE="testQ";&lt;br /&gt;
private QueueConnectionFactory qconFactory;&lt;br /&gt;
private QueueConnection qcon;&lt;br /&gt;
private Queue queue;&lt;br /&gt;
&lt;br /&gt;
long t1,t2;&lt;br /&gt;
&lt;br /&gt;
public void initialize(Context ctx, String queueName)throws NamingException, JMSException&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
t1=System.currentTimeMillis();&lt;br /&gt;
qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);&lt;br /&gt;
qcon = qconFactory.createQueueConnection();&lt;br /&gt;
t2=System.currentTimeMillis();&lt;br /&gt;
System.out.println(t2-t1);// this is to measure how long does the connection takes&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public void close() throws JMSException {&lt;br /&gt;
qcon.close();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public static void main(String[] args) throws Exception {&lt;br /&gt;
long t1,t2;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hashtable env = new Hashtable();&lt;br /&gt;
env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);&lt;br /&gt;
env.put(Context.PROVIDER_URL, args[0]);&lt;br /&gt;
t1=System.currentTimeMillis();&lt;br /&gt;
InitialContext ic = new InitialContext(env);&lt;br /&gt;
t2=System.currentTimeMillis();&lt;br /&gt;
System.out.println("inittime:"+(t2-t1));// this is to measure how long does the initial context takes&lt;br /&gt;
&lt;br /&gt;
TestJMS qs = new TestJMS();&lt;br /&gt;
qs.initialize(ic, QUEUE);&lt;br /&gt;
qs.close();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Before executing this program, the environment variables needs to be set. This can be done by running&amp;nbsp;setDomainEnv.sh under weblogic home-userprojs-domains..bin and run the java code from here by passing the t3 url as argument.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java EE 7 APIs</title><link>http://tech-wikis.blogspot.com/2017/02/java-ee-7-apis.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 1 Feb 2017 07:26:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-3564648929871253472</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
EJB&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;session (stateful and stateless)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Message driven beans&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Async local session in ejb lite&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;nonpersistent timers in ejb lite&lt;br /&gt;
&lt;br /&gt;
Java Servlets&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Nonblocking IO - for scalablity&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;http protocol upgrade&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
JSF&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;the UI framework for the web apps supports many features like&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;rendering, input validation, event handling, data conversion, page navigation,&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;EL and new ones like HTML 5, Faces flows, resource libraries..&lt;br /&gt;
&lt;br /&gt;
JSP&lt;br /&gt;
JSTL (tag libraries)&lt;br /&gt;
Java Persistent API&lt;br /&gt;
JAX-RS - Java API for RESTful services&lt;br /&gt;
Managed Beans&lt;br /&gt;
Dependancy injection for Java and Java EE&lt;br /&gt;
Bean Validation&lt;br /&gt;
JMS&lt;br /&gt;
Java EE Connector Architecture&lt;br /&gt;
JavaMail API&lt;br /&gt;
JAAC - Java Authorization Contract for Container&lt;br /&gt;
JASPIC - Java Aithentication Service Provider for Continers&lt;br /&gt;
Java API for WebSocket&lt;br /&gt;
JSON-P - Java API for JSON processing&lt;br /&gt;
Concurrency Utilities for Java EE&lt;br /&gt;
Batch Applications for Java Platform&lt;br /&gt;
JDBC&lt;br /&gt;
JNDI&lt;br /&gt;
JavaBeanc Activation Framework&lt;br /&gt;
JAXP&lt;br /&gt;
JAXB (Java Architecture for XML binding)&lt;br /&gt;
JAX-WS&lt;br /&gt;
SAAJ - SOAP with attachments &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;API for Java&lt;br /&gt;
JAAS - Java authentication and authorization service&lt;br /&gt;
Annotations&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Weblogic Monitoring Sessions</title><link>http://tech-wikis.blogspot.com/2016/11/weblogic-monitoring-sessions.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 30 Nov 2016 00:47:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-8698736148438070776</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the sample script to monitor weblogic server app level session counts. This helps in understanding which apps the sessions are being created the most and how frequent etc., and this can be extended to get session time details as well.&lt;br /&gt;
&lt;br /&gt;
These stats can help in estimating the session memory footprints like sizing a JVM heap.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getSessionStats():&lt;br /&gt;
&amp;nbsp;connect(adminname,adminPd, url);&lt;br /&gt;
&amp;nbsp;servers = domainRuntimeService.getServerRuntimes();&lt;br /&gt;
&amp;nbsp;timestmp = datetime.datetime.utcnow();&lt;br /&gt;
&amp;nbsp;for server in servers:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; apps = server.getApplicationRuntimes();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for app in apps:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; crs = app.getComponentRuntimes();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for cr in crs:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (cr.getType() == 'WebAppComponentRuntime'):&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; snm = cr.getName();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; opens = repr(cr.getOpenSessionsCurrentCount());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; totals = repr(cr.getSessionsOpenedTotalCount());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; highs = repr(cr.getOpenSessionsHighCount());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fo.write(str(timestmp)+','+snm+','+opens+','+totals+','+highs+'\n')&lt;br /&gt;
&lt;br /&gt;
import datetime&lt;br /&gt;
adminPd='&lt;pwd&gt;'&lt;/pwd&gt;&lt;br /&gt;
url='t3://...:'&lt;br /&gt;
adminname='faadmin'&lt;br /&gt;
fo=open("filepathtoopen","a+")&lt;br /&gt;
fo.write('Time, Name , OpenSessionCount, TotalSessions, SessionCountHigh \n')&lt;br /&gt;
AdminPorts=[ '&lt;port&gt;' ]&lt;/port&gt;&lt;br /&gt;
for port in AdminPorts:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; urltoconnect=url+port&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getSessionStats()&lt;br /&gt;
&lt;br /&gt;
fo.close()&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>JDK 8 - HOTSPOT JVM </title><link>http://tech-wikis.blogspot.com/2016/10/jdk-8-hotspot-jvm.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Tue, 18 Oct 2016 05:32:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-7012860053117466499</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
With JDK 8 getting adopted vastly, I just want to give a high level view of hotspot memory management and the garbage collection techniques&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Quickly, about Garbage Collection&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Allocates objects to young generation&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Promotes aged objects to old generation&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Marking old generation objects &lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Recovering space by removing unreachable or
compacting live objects &lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;Available collectors in Hotspot JVM&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;1.&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Serial collector – for single processor and low
concurrent apps. -XX:+UseSerialGC.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;2.&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Parallel collector (or throughput collector) –
by default one on the server machines and medium to large scale apps. User -XX:+UseParallelGC.
Its multithreaded GC. Select this when
high throughput is needed.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;3.&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Mostly concurrent collector – performs most of
its work concurrently i.e. app is still running. Select this when faster
response times are needed. Since the app is running most of the time without
any pauses, means RTs are not impacted often by the pause times. There are 2
types of mostly concurrent collectors – Concurrent Mark &amp;amp; sweep, G1
(garbage first gc – a generational algo preferred for heaps more than 4GB). &lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .25in; margin-right: 0in; margin-top: 3.0pt;"&gt;
*throughput is termed as time spent in
GC vs time spent in app. The more timespent is app means it has high amount of
resources to deliver.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .25in; margin-right: 0in; margin-top: 3.0pt;"&gt;
* for generational GCs i.e. GCs with
young,eden,tenured generations, both young and major gcs do pause the app in all
types of GC algos. Minor/young gc happens very fast but a major gc happens when
there is no space for tenured objects, so it involves entire heap collections
i.e. identifying the reachable objects, marking and sweeping unreachable objs
and compacting the space to avoid fragmentation. So it pauses longer time. CMS, G1 tries to reduce this by doing them always in the background while app is running and pausing app only in certain times and for short duration&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;Tuning first steps:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Go with the defaults &lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;serial for single core machine,&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;parallel for high throughput requirement i.e.
where App’s RTs can be acceptable at a bit higher sec that means giving longer
pause times i.e. less frequent pauses – overall, the app will be paused at
times but longer (means high throughput but breaches RT as it causes spike) and
the parallel GC does its work with multiple threads in parallel to each and
consumes CPU.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Mostly concurrent – on large apps, multi
processor machines, when RT is important. Since RT is important, the pause
times are less but may be frequent however, some part of the gc work like
marking can happen without any pause. Use CMS when heap&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal; text-indent: -0.25in;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="text-indent: -0.25in;"&gt;when heap less than 4gb else use G1&lt;/span&gt;&lt;br /&gt;
&lt;span style="text-indent: -0.25in;"&gt;-&lt;/span&gt;&lt;span style="font-size: 7pt; font-stretch: normal; line-height: normal; text-indent: -0.25in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style="text-indent: -0.25in;"&gt;Once the default is selected, check whether the
requirement is met else, try playing around increasing the XMX. Then try tuning
the heap areas.&lt;/span&gt;&lt;br /&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;Parallel Collector:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;-XX:+UseParallelGC&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;both minor and major collections are executed in
parallel&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;number of threads is calculated as 5/8 * N
(number of HW threads) or can be set manually as -XX:ParallelGCThreads=&lt;n&gt;&lt;/n&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;since higher number of threads causes
fragmentation when promoting objects from young to tenured spaces, try reducing
the number or increase tenured space to cope up with freagmentation.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;parallel collector tunes automatically based on behavior.
So no need to specify generation sizes or granular level tunings. Behavior
is mentioned are max gc pause time, throughput, foot print of heap size.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Max pausetime target:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -XX:MaxGCPauseMillis=&lt;n&gt;
&lt;/n&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Throughput target: -XX:GCTimeRatio=&lt;n&gt;&amp;nbsp; i.e. it tries to spend 1/(1+N) percentage in
GC. By default is 99 i.e. i/(1+99) = 1% in GC , 99% leaving it to app&lt;/n&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;Footprint : is basically the –Xmx&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;parallel collector tries to meet max pausetime
first then throughput then footprint targets. It plays around growth/shrink percentages
of generations to achieve these targets.&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;Mostly concurrent collectors:&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;CMS: &lt;/b&gt;if the importance is faster RT i.e.
lesser pause times and can afford CPU &lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;-XX:+UseConcMarkSweepGC.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;reduces pause time by always keeping few threads
to concurrently (i.e. without pausing the threads) to mark the reachable &amp;amp;
unreachable objects and sweeping of unreachable objects but pauses during a
major gc during movement of references. It always tries to keep the tenured
space clean to avoid longer pauses or accumulation of objects. When it fails
keep up the tenured space free then a full collection happens with all the
threads paused (a failure case)&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;In CMS, the tenured and young can happen
independently as they have different threads running in concurrent to the
application.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;CMS output is a bit different to other GC
outputs. -verbose:gc&amp;nbsp;and&amp;nbsp;-XX:+PrintGCDetails (-XX:+PrintAllGCDetails
to print more details). It has below output&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;code&gt;&lt;span style="color: #444444; font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/code&gt;&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;CMS-initial-mark
indicates the start of the concurrent collection cycle&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;CMS-concurrent-mark indicates the end
of the concurrent marking phase&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.5in; margin-right: 0in; margin-top: 3.0pt; text-indent: .5in;"&gt;
&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;CMS-concurrent-preclean&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.5in; margin-right: 0in; margin-top: 3.0pt; text-indent: .5in;"&gt;
&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CMS-remark&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CMS-concurrent-sweep
marks the end of the conc sweeping phase&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;span style="font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CMS-concurrent-reset
(getting ready for next collection)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;-&lt;span style="font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-family: &amp;quot;calibri&amp;quot; , &amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;CMS and Parallel does compactions for the whole
heap when there is no consecutive space available&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;b&gt;G1:&lt;/b&gt; for large heaps and pause times
targets can be met at higher probability and also achieving high throughput
(i.e. more time given to app)&lt;/div&gt;
&lt;div style="margin-bottom: 12.75pt; margin-left: .75in; margin-right: 0in; margin-top: 2.25pt; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: &amp;quot;calibri&amp;quot; , sans-serif; font-size: 9pt;"&gt;-&lt;span style="font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;heap will be partitioned into a set of equally
sized heap regions, each a contiguous range of virtual memory. the algo performs a
concurrent global marking phase to determine the live objects of the heap. After the marking phase completes, it collects the mostly empty regions first, to yield a large amount of
free space. So it is called Garbage-First.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;This always works to reduce fragmentation by
compacting during collections.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .75in; margin-right: 0in; margin-top: 3.0pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;!--[if !supportLists]--&gt;-&lt;span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;!--[endif]--&gt;G1 is beneficial when there is large amount of
live data i.e. 50% of heap, allocation rate changes, when there is long
collection time or if there is long compaction times&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Default configuration on server class
machines&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
On server-class
machines, the following are selected by default if not specified otherwise.&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Throughput
garbage collector&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Initial
heap size of 1/64 of physical memory up to 1 GB&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Maximum
heap size of 1/4 of physical memory up to 1 GB&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
Server
runtime compiler&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;a href="https://www.blogger.com/null" name="sthref32"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;o:p&gt;



















































































&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
And, to view the default configurations use java&lt;span style="color: #444444;"&gt; &lt;/span&gt;-XX:+PrintFlagsFinal
&lt;gc options=""&gt; -version&amp;nbsp;&amp;nbsp;&lt;/gc&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 3.0pt;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>JMeter Solr Banana</title><link>http://tech-wikis.blogspot.com/2016/10/jmeter-solr-banana.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sun, 2 Oct 2016 12:08:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-4882385866342681197</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Want to give some colors to JMeter ? We all know JMeter is a great tool and helps load testing the apps.. how about bringing two more awesome tools on to the table - Solr and Banana&lt;br /&gt;
&lt;br /&gt;
With Solr, we can store/index/search large amount of data and Banana is a pretty tool with lot of latest HTML and javascript capabilities to draft some cool graphs to show the trends.&lt;br /&gt;
&lt;br /&gt;
So, how we can use these tools ..&lt;br /&gt;
&lt;br /&gt;
we can do a lot in fact, but to start with,&lt;br /&gt;
&lt;br /&gt;
- Load test results to display the runtime stats - Response times/Transaction throughput/Bytes and the list goes on..&lt;br /&gt;
- Monitoring system resources like Memory/CPU/Disk/Load, JVM garbage collection activity etc.,&lt;br /&gt;
&lt;br /&gt;
So, its all sounds interesting ? and do you think we can really build a good monitoring tool ? Well, &amp;nbsp;below are couple of dashboards&lt;br /&gt;
&lt;br /&gt;
Load Test Report:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt5VTcX7c2Dnb7P4QHcmVV1MhznfWMRZ8QaVKz2kLUeDtNDJjRh1i9SoXPigacstlo9uUsIXXGyskyjtF4vy6sAehyZc4kl9P_ci49XGP8JK5ZfIKNq-w803AjS0do3BmJTSQcLdZ-Wsk/s1600/LoadTestReport_Sample.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="242" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt5VTcX7c2Dnb7P4QHcmVV1MhznfWMRZ8QaVKz2kLUeDtNDJjRh1i9SoXPigacstlo9uUsIXXGyskyjtF4vy6sAehyZc4kl9P_ci49XGP8JK5ZfIKNq-w803AjS0do3BmJTSQcLdZ-Wsk/s320/LoadTestReport_Sample.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
System Resources&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLsI5urksWZlUB0Ou3nYTG3kroHC7e4symWPnSjXwlM-CI-KmQL_XTtaFMCoE_B8o0MeaYyR4QKCQyGPIsGlZb6woN3pYba1TsxxiQaoKrPBYp9Yjxmmtr1v8SzRbsLhq6FoYotMmnzYQ/s1600/SystemResources_Sample.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLsI5urksWZlUB0Ou3nYTG3kroHC7e4symWPnSjXwlM-CI-KmQL_XTtaFMCoE_B8o0MeaYyR4QKCQyGPIsGlZb6woN3pYba1TsxxiQaoKrPBYp9Yjxmmtr1v8SzRbsLhq6FoYotMmnzYQ/s320/SystemResources_Sample.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
These are few sample dashboards. The actual setup does a lot more.. the remote agents collect the data and pushes them to solr and the dashboard refreshes the stats.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt5VTcX7c2Dnb7P4QHcmVV1MhznfWMRZ8QaVKz2kLUeDtNDJjRh1i9SoXPigacstlo9uUsIXXGyskyjtF4vy6sAehyZc4kl9P_ci49XGP8JK5ZfIKNq-w803AjS0do3BmJTSQcLdZ-Wsk/s72-c/LoadTestReport_Sample.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Sizing JVMs and VM Memory</title><link>http://tech-wikis.blogspot.com/2016/09/sizing-jvms-and-vm-memory.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sat, 24 Sep 2016 05:50:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-319243967326388728</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
How to estimate the amount of JVM heap and host memory requirement in complex cases where there are more JVM instances per VM and more apps per JVM and have different usage requirement per app ?&lt;br /&gt;
&lt;br /&gt;
let's see some of the metrics to collect to construct an equation on estimating the sizes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;list the apps per instance. Ideally there will be multiple apps deployed on one instance of JVM and all these apps are not equally used and each app will have its own characteristics thus have uneven memory requirements i.e. based on req. classes, code logic and constructs etc.,&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;And identify the 'typical' transactions.. ideally, in any app, 20% of features are executed 80% of times&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Take a first measurement - server start up heap. Once the server is up completely, get the first point after a full GC (hotspot) or first OC (jrockit)&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Now, ideally the first user access is demanding one as it loads lot of stuff. So, do just logins into each of the app and take a note of OCs/FGCs for each user. So, per app, the numbers gives the amount of heap required for first login&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;So, XMS - to make it good enough, it can be sum of (server startup heap + sum of all above deltas )&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Now, exercise the typical 20% transaction as single user per app and do not logout - so these are typical active users on the system - call these deltas as h1, h2 etc . This can be on a warmed up server but best is to have no other logged in users in the system. Each delta can be noted or take the final delta after all different app users are in and executed the typical flows but not logged out.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;XMX i.e. the max amount of memory can be XMS + ( total delta * (%app1 conc. users) &amp;nbsp; + &amp;nbsp;... )&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
for hotspot jvms or other jvms where there are more heap spaces like young/survivor, perm etc., they can be calculated as proportionate ratio of XMX ..&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
And, typical host memory usage requirement can be calculated as approx 1.8 times of XMX&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If someone can simulate load and want to bare the cost, time and complexity of all setup to do that then it is probably best to get the numbers based on test results.., the benefits in doing so can be not just limited to JVM heap but gives the other resource pools across the layers..&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Mobiles - The way they transformed made things reachable to some but created complexity to others</title><link>http://tech-wikis.blogspot.com/2016/09/mobiles-way-they-transformed-made.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 14 Sep 2016 06:57:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-1283424027060106075</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
I am talking about the quality checks for the applications built for mobile devices. Mobile devices transformation has to be considered as the fastest change in technology so as the complexity in delivering applications on this new platform which is becoming a must !&lt;br /&gt;
&lt;br /&gt;
Besides making sure the features work i.e. testing the functionality, it is the most important task to ensure the app actually perform as expected. someone can say what is there to think about as it is a light weight code .. there is infact a lot that could disrupt the performance - examples - have to support different vendors like android/APPLE, version of operating systems, underlying hardware, resolutions, GPU, CPUs, memory, network carriers and subscribed bandwidths like 2G/3G/4G, inter-apps interruptions, backend thread support for async calls .. what not !&lt;br /&gt;
&lt;br /&gt;
Well there is a lot, I can think of how one can approach to validate performance of the mobile applications and the upstream servers by using some of the great tools in the market.&lt;br /&gt;
&lt;br /&gt;
Below are some of the tasks to evaluate performance and what these tools can do..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Test and monitor the app's performance on different emulators. If it has to be done independently then each IDE is needed like android studio, IOS IDE and respective skill set as well. Perfecto addresses this with its support to multiple devices&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Test the app's performance on different real devices- can't do it manually.. can not have a farm of devices.. perfecto can do it using its mobile device cloud.. or its emulator is good enough as well&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Simulate apps performance under different network speeds on devices/emulators - can do by using various softwares like act but again perfecto along with shunra integration can manage devices by emulating various network bandwidths&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Capture the traffic and simulate 1000's of devices load to app servers - this can be done using emulators and tcp capture.. but perfecto-shunra can do and the captured traffic can be fed to Loadrunner. And, Shunra can virtualize networks to emulate load from different locations/carriers/bandwidths during load tests&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;At the same time one would have to recheck the app's performance on the device while server under load &amp;nbsp;- again by perfecto&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
Its a different world now with mobiles/tablets/wearables that move .. Apps need to support all these !&lt;/div&gt;
&lt;div&gt;
Gone are those days where apps are accessed from a standalone PC ..&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>End to end request processing time</title><link>http://tech-wikis.blogspot.com/2016/08/end-to-end-request-processing-time.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 24 Aug 2016 05:18:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-775327313659840861</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
In a simplistic view, in a typical online system, this is where one needs to check to know any slowness&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpKSmT0Jah2fJVebVqe1JLYPoq7mZF675zQmPxxTzYmtO2xAPpMgtisBCEyIDG4eHf8-uJ_B-unoI8SAJAO26BLVVJt2l-fZE7857I9ncFp5waDV3e0qDTHYLsamvQYSLfBKI3BkLtvlE/s1600/img1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpKSmT0Jah2fJVebVqe1JLYPoq7mZF675zQmPxxTzYmtO2xAPpMgtisBCEyIDG4eHf8-uJ_B-unoI8SAJAO26BLVVJt2l-fZE7857I9ncFp5waDV3e0qDTHYLsamvQYSLfBKI3BkLtvlE/s1600/img1.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Browser rendering time - if the page size too big or too complex with java scripts and style sheets&lt;br /&gt;
then the rendering time could take time..&lt;br /&gt;
# of static content being used on the web page has an impact on the overall load time. And, if they are not cacheable, the round trips even from a CDN could have an impact on the load time&lt;br /&gt;
Total download time for a page depends on how big is the response content and how many susbrequests are triggered part of the page and the network time and entire server side processing time&lt;br /&gt;
Page load time is the time by when user sees the page.. so above all have impact on it.&lt;br /&gt;
&lt;br /&gt;
coming to network, it is important to know what is the path the request is traversing from client to the server. Is it taking longest path via CDN or how the addresses being resolved over public internet and any proxy being used etc., the network delay and packet loss are important factors to keep an eye on.&lt;br /&gt;
&lt;br /&gt;
coming to server side, the request processing time depends on many factors.. it depends on underlying infrastructure, resources, architecture, code logic implementations etc.,&lt;br /&gt;
but there are few check points to look at to break it down..&lt;br /&gt;
checking at http server layer tells the variation between end page load time and total server time. This helps identify any network delays.&lt;br /&gt;
checking the difference between http server to app server times tells if there is any delay in the middle layers like authentication routing..&lt;br /&gt;
on the app server side, it could spend time in many places.. the routing can happen to many servers or even to external systems. using runtime instrumentation tools, it is possible to break down the time spent in pure code, wait times due to synchronous code blocking, gc pause times, time spent in reading from sockets/wirte to while interacting with DB or in the calls to other servers while making remote calls like rjvm to EJBs or service calls etc., by breaking this way, each underlying activity and the delays can be identified&lt;br /&gt;
&lt;br /&gt;
Each of the above ones are not more than just an index to an ocean of tuneable metrics that each underlying technology modules contains. However, where to look at and what to tune is the key.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpKSmT0Jah2fJVebVqe1JLYPoq7mZF675zQmPxxTzYmtO2xAPpMgtisBCEyIDG4eHf8-uJ_B-unoI8SAJAO26BLVVJt2l-fZE7857I9ncFp5waDV3e0qDTHYLsamvQYSLfBKI3BkLtvlE/s72-c/img1.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Application performance - odd bits</title><link>http://tech-wikis.blogspot.com/2016/08/application-performance-odd-bits.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 24 Aug 2016 03:51:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-3967181845646376535</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;we do normally warm up the systems and concerned about the how it performs under load but will it meet customer expectation or improve customer experience or avoid frustrating scenarios ?&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;how about the 'first time' and idle case performances ?&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;did you ever check what is the single user response times and request processing times on server side ? if it is not performing any good for single user then it will not do for multiple. The base performance for single user is what needs to tuned first&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;what about first time cases ? we can not ask users of the system to hang on until system warms up ! then who will use it first :) &amp;nbsp;so, analysing cold case system performance is important. it is important to know what happens on first access across the layers in cold cases i.e. after a system restart, app servers or entire VMs or DB etc., and what needs to be tweaked to get better first time performance.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;how about sleeping systems ! not all systems work round the clock atleast not all days in a week.. so did you ever check what is the resource usage of idle systems ? there could be some unexpected code path executions might happen even under no load case. So it is important to know the resources usage under no load as they might also run all the time.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;how about apps performance under a very slow network access or networks with high packet loss. how reliable are the systems..&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;what happens when infrastructure fails ? how many users can still continue doing what ever they are doing with out any interruption and feel the same performance of the app while a DR process kicks in.. &lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;how about the systems with long running sessions.. users may not logout for long time and it is required to keep the sessions so long and what is the impact !&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;how the applications handle when majority of end users do not logout but just closes the browser ! how to handle the memory usage in those cases..&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java EE - EJB</title><link>http://tech-wikis.blogspot.com/2016/08/java-ee-ejb.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sat, 20 Aug 2016 03:39:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-8776828864089974751</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Enterprise Java Beans - EJB&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;EJBs are the Java EE server side components which implement app's business logic. They normally be deployed in EJB containers provided by the app servers. Implementing EJBs can provide scalability to the application and better handling of security and transactions. EJBs can also implement webservices.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Types of EJB:&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Session - To implement user actions&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;- stateful: maintains a state for the client and this bean can not be shared.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;- stateless: does not maintain state so can be allocated to any clients. They are reusable. So this&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pool will be less compared to stateful.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;- singletone session beans: have only one instance for the whole time. &amp;nbsp;They can get initiated when the app starts. Although they act as stateless but there is no pool because of single existence&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; Message Driven Beans (MDB): for listening to the messages either from queues or JMS&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;(if someone read about entity beans, they are now part of persistence API..(referring to Java EE7)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
Implementation is simple.. infact, the annotations made it so..lets says to write a simple stateless EJB, just annotate the class with @Stateless and implement the business logic..&amp;nbsp;and to call this EJB, a servlet can do ..ofcourse, you need to annotate with @WebServlet(urlPatterns="/") the url pattern says the context root. And, as usual extend the class with HttpServlet. And, to access the EJB, just annotate with @EJB and then the declare the EJB instance.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
However, in a typical EJB implementation, there could be all type of session beans - stateless, stateless bean implementing a service, stateful bean accessed remotely etc.,&lt;br /&gt;
&lt;br /&gt;
A remote interface is required for the beans which allow remote access. This remote business interface defines all the business methods of a bean and annotated with Remote from javax.ejb pacakge and it gets implemented by the session bean. A session bean can be an end point for a web service.&lt;br /&gt;
&lt;br /&gt;
A stateful session bean can have methods annotated with Remove which can be invoked by client to remove the instance.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
In the case of singleton bean, the concurrent access from the clients can be controlled in two ways - container managed or bean managed by annotating accordingly. And, the methods must be annotated with the locktype i.e. read or write so that concurrent access can allowed or provided with a synchronous mechanism respectively..&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
For stateless session beans to implement service end points, they must be annotated with @Webservice and the business methods that are exposed must be annotated with @Webmethods. They can also implement async methods so that clients no need to wait for response from long running methods.&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
Coming to EJB pools - in weblogic, there is an element called max-beans-in-free-pool in weblogic-ejb-jar.xml. This determines how many EJBs must be made available in free pool. max-beans-in-pool will put a cap on the pool limit. For MDBs, the container will create as many instances required based on the size limited to max-beans-in-free-pool. Default MDB threads are 16 but this can be changed by having custom queue or workmanagers&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Oracle VM</title><link>http://tech-wikis.blogspot.com/2016/08/oracle-vm.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sun, 14 Aug 2016 04:41:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6541726166958438691</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Virtualization is a technique to share the hardware resources among multiple systems or users to achieve optimal usage of resources and reducing costs.&lt;br /&gt;
&lt;br /&gt;
Although virtualization is a generic one conceptually, lets talk on server virtualization. This means a bunch of HW resources like CPUs, Memory, Disks, ports etc., are shared among multiple OSs either of same type or multiple type. So, to achieve this we need someone or something to manage the underlying HW and above running guests (OSs). This 'manager' is what is called a 'Hypervisor'.&lt;br /&gt;
&lt;br /&gt;
There are couple of types of Hypervisors&lt;br /&gt;
Native or bare metal hypervisor - this is the software which directly runs on host's hardware to control the hardware and monitor the guests OS. so imagine this something that mediates between guest OS and underlying hardware. Example of&lt;br /&gt;
such implementation are Oracle VM, VMware EXXi Xen, Microsoft Hyper-V&lt;br /&gt;
&lt;br /&gt;
The other hypervisor is made to run within a traditional operating system and then guest OSs can run on top of it. Example Oracle VirtualBox (which can be installed on an PC where windows is the base OS but virtual box can then host another guest OS like linux..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Oracle VM Server:&lt;br /&gt;
&lt;br /&gt;
This can be installed on X86 instruction set based platforms with Xen hypervisor (GPU licensed) or on SPARC platforms (which will have its own hypervisor).&lt;br /&gt;
In general, the above implementation has their own firmware/hardware, a hypervisor and then a super domain/vm which controls the resource allocation to other guest VMs (also called domains or simply guests)&lt;br /&gt;
&lt;br /&gt;
So, simply Oracle VM server is a collection of hardware (CPU, Mem, Network, IO etc.,), hypervisor (for managing underlying baremetal i.e. the hardware), domains (the VMs with thier own set of OS except Dom0 which a complete linux kernel and manages all the other Domains).&lt;br /&gt;
&lt;br /&gt;
Lets explore some interesting things related to Oracle VM&lt;br /&gt;
&lt;br /&gt;
CPU capacity:&lt;br /&gt;
how to determine the cpu capacity on a vm server&lt;br /&gt;
xm info is the command to use. for example, as shown below, the number of cpus are 72 which are ideally the threads. There are 2 nodes, 18 cores per socket and 2 threads per core&lt;br /&gt;
i.e. 2 * 2 * 18 = 72 threads (0 to 71 total, 0-35 on sock1, 36-71 on sock2)&lt;br /&gt;
&lt;br /&gt;
nr_cpus &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 72&lt;br /&gt;
nr_nodes &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2&lt;br /&gt;
cores_per_socket &amp;nbsp; &amp;nbsp; &amp;nbsp; : 18&lt;br /&gt;
threads_per_core &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2&lt;br /&gt;
&lt;br /&gt;
The cpu topology can be viewed by using the commnad xenpm get-cpu-topology&lt;br /&gt;
CPU &amp;nbsp; &amp;nbsp; core &amp;nbsp; &amp;nbsp;socket &amp;nbsp;node&lt;br /&gt;
CPU0 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;br /&gt;
CPU1 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;br /&gt;
CPU2 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;br /&gt;
CPU3 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;br /&gt;
..&lt;br /&gt;
xm info also gives the high level vm details like what bit it supports, what instruction set (like intel x86), number of real cpus, number of nodes, number of sockets, number of threads per core, cpu frequency,&lt;br /&gt;
memory, pagesize etc.,&lt;br /&gt;
In an hyperthreaded model, each core will run 2 threads instead of one. and this would have counter effects but could improve efficiency..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
vCPUs&lt;br /&gt;
virtual cpus are the cpus that are assigned to a guest/domu i.e. a virtual machine which runs on a domu can be assigned 10 CPUs which are considered as virtual cpus and the actual bindings to real cpu depends on how they are configured. For example below, vm1 is a virtual machine with the id=1, has 3 vCPUs which are in bind state and mapped to CPUs 3,6 7. This vm1 is configured to have the cpu affinity as 2-35 which is first socket on a 2 socket 72 core machine. so, since there is no absolute binding, the mapping can change in runtime and depends on the availability,&lt;br /&gt;
the vcpus can be mapped to any of the real cpus in the range 2-35.&lt;br /&gt;
&lt;br /&gt;
xm vcpu-list&lt;br /&gt;
Name &amp;nbsp;ID &amp;nbsp;VCPU &amp;nbsp; CPU State &amp;nbsp; Time(s) CPU Affinity&lt;br /&gt;
vm1 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; -b- &amp;nbsp; 5354.1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;2-35&lt;br /&gt;
vm1 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; -b- &amp;nbsp; 2312.4 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;2-35&lt;br /&gt;
vm1 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; -b- &amp;nbsp; 2337.8 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;2-35&lt;br /&gt;
&lt;br /&gt;
you can pin the CPUs for guest vms runtime but to change any affinity to dom0 requires a reboot.. and dom0 always takes the top priority.&lt;br /&gt;
And, it is always good to monitor the real cpu usage from the vm server to check how in an &amp;nbsp;oversubscribed case, the busy vms on the same socket could impact each other..&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>JNDI - Java Naming and Directory Interface</title><link>http://tech-wikis.blogspot.com/2016/08/jndi-java-naming-and-directory-interface.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sun, 14 Aug 2016 03:13:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6006124950364925302</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
JNDI - Java Naming and Directory Interface&lt;br /&gt;
&lt;br /&gt;
what is JNDI - its a naming service&lt;br /&gt;
why is it needed - in a distributed enterprise application, there are multiple resources like DB pools or business components like EJBs deployed on the Java EE containers and they need a way to locate. JNDI serves that purpose.&lt;br /&gt;
&lt;br /&gt;
Applications can use annotations to locate the resource. Like datasources which are nothing but database resources, provides connection to database. when the application code refers to a&lt;br /&gt;
&amp;nbsp;datasource and invokes JDBC API to getconnection, it gets a physical connection. In case connection pooling is implemented then it gets a handle to pooled connection object instead of direct physical connection.&lt;br /&gt;
&amp;nbsp;These connections need to be closed and when closed will go back to the pool. The pool of database connections will give better performance and better connection handling mechanism.&lt;br /&gt;
&lt;br /&gt;
Similarly JNDI mapping can be done to other services like JMS, LDAP etc.,&lt;br /&gt;
&lt;br /&gt;
Below shown are some of the resources on Glassfish server and the JNDI mapping.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3kjOIWymuklNE7e2aY_jHA1oq_rLRcNXnKDqXpeZQxG1I8yn7JrH98Y92Ko8IdVA4yZXlsZ2WRbYSWc_y6ybUVHd35xI4tFUHZU611sXK7BnsQYhDuB59u35wt1SWQFUTObCF7VBB8_w/s1600/Glassfish_Resources.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="183" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3kjOIWymuklNE7e2aY_jHA1oq_rLRcNXnKDqXpeZQxG1I8yn7JrH98Y92Ko8IdVA4yZXlsZ2WRbYSWc_y6ybUVHd35xI4tFUHZU611sXK7BnsQYhDuB59u35wt1SWQFUTObCF7VBB8_w/s320/Glassfish_Resources.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3kjOIWymuklNE7e2aY_jHA1oq_rLRcNXnKDqXpeZQxG1I8yn7JrH98Y92Ko8IdVA4yZXlsZ2WRbYSWc_y6ybUVHd35xI4tFUHZU611sXK7BnsQYhDuB59u35wt1SWQFUTObCF7VBB8_w/s72-c/Glassfish_Resources.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Oracle database performance </title><link>http://tech-wikis.blogspot.com/2016/08/oracle-database-performance.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Mon, 8 Aug 2016 06:54:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-7169732342511250429</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br&gt;
Lets explore Oracle database performance aspects on a high level..&lt;br&gt;
&lt;br&gt;
some of the key terms to know about:&lt;br&gt;
&lt;br&gt;
SGA: Shared Global Area - is basically a collection of memory units or structures used by all the processes on a db instance.&lt;br&gt;
PGA: Program Global Area- is a memory region specific to a process (server process or bg process).&lt;br&gt;
Buffer Cache: is basically a buffer to keep data blocks read from data files. The buffer cache is shared across the users.&lt;br&gt;
Shared pool: basically contains the program data like parsed SQLs, PL/SQL code, data dictionaries etc., and this is accessed almost in every DB operation.&lt;br&gt;
&lt;br&gt;
And lets see some of the interesting views&lt;br&gt;
gv$process&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contains details on the currently active processes which are either on CPU or on latchwait or in spinning on a latch.. also contains PGA details for this process&lt;br&gt;
gv$sgastat&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contains details on the system global area (SGA). For each pool - shared/large/java/stream pools&lt;br&gt;
gv$session&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contains details for each current session. data from this view is sampled every sec and put into V$ACTIVE_SESSION_HISTORY. From 11G Rel 2 onwards, each individual req can be traced with the help of ECID.&lt;br&gt;
gv$pgastat&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contains details on PGA usage&lt;br&gt;
&lt;br&gt;
we can take a periodic snapshots on the above tables to analyze further..&lt;br&gt;
example: CREATE SNAPSHOT snapshotonprocess AS SELECT * FROM gv$process&lt;br&gt;
and then the processes pga can be calculated.. like select inst_id, count(*) cnt, Round(sum(PGA_USED_MEM) / 1024 / 1024 / 1024, 2) from snapshotonprocess group by inst_id order by inst_id&lt;br&gt;
- adding a criteria like 'background is not null' will give pga stats for background processes&lt;br&gt;
&lt;br&gt;
similarly, we can query sga stats, shared pools, shared pool usage, buffer cache usage and active sessions etc.,&lt;br&gt;
&lt;br&gt;
Another good place to look at for session performance and to point out the slow SQLs or event waits is by querying V$ACTIVE_SESSION_HISTORY.&lt;br&gt;
V$ACTIVE_SESSION_HISTORY contains sampled session activity in the database. samples are taken every sec. So, it is possible to calculate howmuch time spent on DB &amp;nbsp;and on which queries for a end user request by tracing the ECIDs in this view.&lt;br&gt;
&lt;br&gt;
Lets look at awesome reports by Oracle database on performance of the database.&lt;br&gt;
&lt;br&gt;
AWRs- A great performance report on DB workloads. It contains information about DB time, system resource usage, waits or other events that could impact performance, SQL statistics like long running SQLs or resource intensive sqls or&lt;br&gt;
SQLs with high buffer gets.&lt;br&gt;
we can check how the buffer cache and shared pool size changed from the beginning to the end of the snapshots.&lt;br&gt;
logical reads(the more the better), physical reads(the less the better), hardparses(the more over a warmedup system indicates the plans are not good perhaps and might need to gather stats or something attached to the queries in runtime), rollbacks etc.,&lt;br&gt;
latches(a short lived serialization methods that oracle uses on shared structures) efficiency metrics, top 5 foreground events, CPU and memory stats are good place to start with if there is a overall db performance hit.&lt;br&gt;
If the performance is specific to SQLs then other areas to look at in AWRs are related SQL performance - # of execs, time taken per exec, cpu used, buffer gets, hard parses etc., And, up on identifying the SQLs (best way is to match the ECIDs for the frontend initiated SQLs),&lt;br&gt;
SQLHC is next step to analyze further on the historical performance and the to analyze the SQL execution plan, indexes, bind variables/conditions etc.,&lt;br&gt;
&lt;br&gt;
To have a better insight, keep a good baseline AWR in the system so that any future snapshot can be compared against it..&lt;br&gt;
&lt;br&gt;
To create a awr snap:&lt;br&gt;
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;&lt;br&gt;
select snap_id from dba_hist_snapshot order by snap_id asc;&lt;br&gt;
&lt;br&gt;
To generate AWR:&amp;nbsp;select output from table(dbms_workload_repository.awr_report_html(&lt;db id=""&gt;,&lt;inst id=""&gt;,&lt;begin snapid=""&gt;,&lt;end id="" snap=""&gt;));&lt;/end&gt;&lt;/begin&gt;&lt;/inst&gt;&lt;/db&gt;&lt;br&gt;
&lt;br&gt;
To declare the basline:&lt;br&gt;
BEGIN &amp;nbsp; DBMS_WORKLOAD_REPOSITORY.create_baseline ( &amp;nbsp; &amp;nbsp; start_snap_id =&amp;gt; &amp;lt;###&amp;gt;, &amp;nbsp; &amp;nbsp; end_snap_id &amp;nbsp; =&amp;gt; &amp;lt;###&amp;gt;, &amp;nbsp; baseline_name =&amp;gt; 'baseline'); END;&lt;br&gt;
&amp;nbsp;/&lt;br&gt;
&lt;div&gt;
&lt;br&gt;&lt;/div&gt;
To compare AWRs:&lt;br&gt;
@$ORACLE_HOME/rdbms/admin/awrddrpi.sql&lt;br&gt;
or&lt;br&gt;
select * from TABLE(DBMS_WORKLOAD_REPOSITORY.awr_diff_report_html(&lt;dbid&gt;,&lt;inst id=""&gt;,&lt;awr1 beg.="" snap=""&gt;,&lt;awr1 end.="" snap=""&gt;,&lt;dbid&gt;,&lt;inst id=""&gt;,&lt;awr2 beg.="" snap=""&gt;,&lt;awr2 end="" snap=""&gt;));&lt;/awr2&gt;&lt;/awr2&gt;&lt;/inst&gt;&lt;/dbid&gt;&lt;/awr1&gt;&lt;/awr1&gt;&lt;/inst&gt;&lt;/dbid&gt;&lt;br&gt;
&lt;div&gt;
&lt;br&gt;&lt;/div&gt;
&lt;br&gt;
Other good reports to look at:&lt;br&gt;
ADDM report - an Automatic Db Disgnostic Monitoring report.. helps identifying the issues in an Active Workload Repository&lt;br&gt;
&lt;div&gt;
&lt;br&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Weblogic MBean Monitoring</title><link>http://tech-wikis.blogspot.com/2016/07/weblogic-mbean-monitoring.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Sat, 16 Jul 2016 11:43:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-3166510161451003836</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Weblogic provides a nice feature to monitor the server resources i.e. through MBeans.&lt;br /&gt;
&lt;br /&gt;
weblogic mbeans types - configuration MBeans, Runtime MBeans and Application Defined MBeans&lt;br /&gt;
&lt;br /&gt;
These can be browsed from EM console - go to admin server EM url for the domain which you are interested. Navigate to the server under the domain from EM console and then menu - System MBean Browser&lt;br /&gt;
&lt;br /&gt;
you can see the above 3 types of MBeans tree structure. Normally for runtime stats, we check Runtime MBeans. say &amp;nbsp;com.bea - select a server - ServerRuntime - and select a type of MBean to browse and select the server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example MBean for JDBC Data Sources&lt;br /&gt;
&lt;br /&gt;
MBean Name&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;com.bea:ServerRuntime=Server_1,Name=Server_1,Location=Server_1,Type=JDBCServiceRuntime&lt;br /&gt;
There are many attributes for this MBean and interesting one to monitor the resource usage is 'JDBCDataSourceRuntimeMBeans'&lt;br /&gt;
This attribute will list all the data sources configured for the server - click on a datasource to see its current usage&lt;br /&gt;
&lt;br /&gt;
This is same as what we monitor from Admin console - datasources - monitoring ..&lt;br /&gt;
&lt;br /&gt;
The same can also be done via a script using python/wlst&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------------------------&lt;br /&gt;
def getConnectionPoolStat():&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;connect('adminUserName', 'adminPassword', 'adminURL')&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;name=cmo.getName()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;domainRuntime()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;cd('ServerRuntimes')&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;srvrs=domainRuntimeService.getServerRuntimes()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;crntdr=pwd()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;for srv in srvrs:&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;srvName=srv.getName()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;cd(crntdr)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;print srvName&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;cd(srvName +'/JDBCServiceRuntime/' + srvName)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;allDS=cmo.getJDBCDataSourceRuntimeMBeans()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;cd('JDBCDataSourceRuntimeMBeans')&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for ds in &amp;nbsp;allDS:&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;dsName = ds.getName()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;cd(dsName)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;lcc=cmo.getLeakedConnectionCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;ccy=cmo.getCurrCapacity()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;accc=cmo.getActiveConnectionsCurrentCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;frrc=cmo.getFailedReserveRequestCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;ctc=cmo.getConnectionsTotalCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;acavg=cmo.getActiveConnectionsAverageCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;cchc=cmo.getCurrCapacityHighCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;achc=cmo.getActiveConnectionsHighCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;ftrc=cmo.getFailuresToReconnectCount()&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;st=name + ',' + dsName + ',' + srvName + ',' + str(acavg) + ',' + str(accc) + ',' + str(achc) + ',' + str(ctc) + ',' + str(ccy)+','+str(cchc)+ ',' + str(lcc) +',' + str(frrc)+','+ str(ftrc) + '\n'&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;fo.write(st)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;cd('..')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
fo=open("outputcsvfile","w+")&lt;br /&gt;
fo.write('DomainName , DataSourceName, ServerName, Active Connections Avg Count, Active connections current count, Active Connections high count, Connections Total Count, Current Capacity , Current High Capacity, Leaked Connection Count, Failed ReserveRequest Count, FailuresToReconnectCount &amp;nbsp;\n')&lt;br /&gt;
getConnectionPoolStat()&lt;br /&gt;
fo.close()&lt;br /&gt;
&lt;br /&gt;
This needs to be executed from wlst in oracle common home&lt;br /&gt;
sessions per app can be collected through&amp;nbsp;weblogic_j2eeserver:app_session..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java Web Services</title><link>http://tech-wikis.blogspot.com/2015/12/java-web-services_88.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Fri, 11 Dec 2015 04:41:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-4822635712060561418</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
Web services - in my simplistic view, these are the software components exposed over web (HTTP) as a service so various other programs or software modules can be able to interact. For easier understanding purpose, it is similar to how a web application deployed on an application server exposes its functions through a UI that a client program like internet browsers can access and display it. Web service even though communicate over HTTP, the exchange of information happens in an XML document with certain rules - called as SOAP (Simple Object Access Protocol)&lt;br /&gt;
&lt;br /&gt;
Java provides an API to develop these components. This is called JAX-WS (Java API for XML Web Services).&lt;br /&gt;
And these can be implemented in 2 ways - RPC (remote procedure call) and in a message oriented i.e. in a document style&lt;br /&gt;
&lt;br /&gt;
As this API makes it so simple, we just need below components to develop a simple webservice using JAX-WS&lt;br /&gt;
&lt;br /&gt;
Lets see an RPC style implementation&lt;br /&gt;
&lt;br /&gt;
1. Need a remote i.e. endpoint interface class&lt;br /&gt;
2. A remote implementation class&lt;br /&gt;
3. A remote publisher class&lt;br /&gt;
4. And a client&lt;br /&gt;
&lt;br /&gt;
Below is the self explainable simple code logic&lt;br /&gt;
&lt;br /&gt;
----------------&lt;br /&gt;
package com.myWSPackage;&lt;br /&gt;
import javax.jws.WebMethod;&lt;br /&gt;
import javax.jws.WebService;&lt;br /&gt;
import javax.jws.soap.SOAPBinding;&lt;br /&gt;
import javax.jws.soap.SOAPBinding.Style;&lt;br /&gt;
&lt;br /&gt;
@WebService&lt;br /&gt;
@SOAPBinding(style = Style.RPC)&lt;br /&gt;
public interface IamJustAnInterface{&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;@WebMethod String implementMe(String name);&lt;br /&gt;
}&lt;br /&gt;
----------------&lt;br /&gt;
package com.myWSPackage;&lt;br /&gt;
import javax.jws.WebService;&lt;br /&gt;
&lt;br /&gt;
@WebService(endpointInterface = "com.myWSPackage.IamJustAnInterface")&lt;br /&gt;
public class IamAnImplementer implements IamJustAnInterface{&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;@Override&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public String implementMe(String name) {&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;try{Thread.sleep(10000);}catch(Exception e){}&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;return "Hi There - at your service : " + name;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
-------------------&lt;br /&gt;
package com.myWSPackage;&lt;br /&gt;
import javax.xml.ws.Endpoint;&lt;br /&gt;
&lt;br /&gt;
public class IamAPublisher{&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static void main(String[] args) {&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; Endpoint.publish("http://localhost:7777/ws/hi", new IamAnImplementer());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
---------------&lt;br /&gt;
package com.myWSPackage;&lt;br /&gt;
import java.net.URL;&lt;br /&gt;
import javax.xml.namespace.QName;&lt;br /&gt;
import javax.xml.ws.Service;&lt;br /&gt;
&lt;br /&gt;
public class WSClient{&lt;br /&gt;
&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static void main(String[] args) throws Exception {&lt;br /&gt;
&amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;URL url = new URL("http://localhost:7777/ws/hi?wsdl");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; QName qname = new QName("http://myWSPackage.com/", "IamAnImplementerService");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Service service = Service.create(url, qname);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IamJustAnInterface ifi = service.getPort(IamJustAnInterface.class);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.out.println(ifi.implementMe("Buddy"));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
what happens on the client:&lt;br /&gt;
I have intentionally put a sleep in the service interface implementation class to capture the stacks&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SocketNativeIO.readBytesPinned(FileDescriptor, byte[], int, int, int)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SocketNativeIO.socketRead(FileDescriptor, byte[], int, int, int) line: 32&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SocketInputStream.read(byte[], int, int) line: 129&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;BufferedInputStream.fill() line: 218&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;BufferedInputStream.read1(byte[], int, int) line: 258&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;BufferedInputStream.read(byte[], int, int) line: 317&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpClient.parseHTTPHeader(MessageHeader, ProgressSource, HttpURLConnection) line: 690&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpClient.parseHTTP(MessageHeader, ProgressSource, HttpURLConnection) line: 633&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpURLConnection.getInputStream() line: 1195&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpURLConnection.getResponseCode() line: 379&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpClientTransport.readResponseCodeAndMessage() line: 198&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpTransportPipe.process(Packet) line: 151&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpTransportPipe.processRequest(Packet) line: 83&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;DeferredTransportPipe.processRequest(Packet) line: 78&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.__doRun(Tube) line: 587&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber._doRun(Tube) line: 546&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.doRun(Tube) line: 531&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.runSync(Tube, Packet) line: 428&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Stub.process(Packet, RequestContext, ResponseContextReceiver) line: 211&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SEIStub.doProcess(Packet, RequestContext, ResponseContextReceiver) line: 124&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SyncMethodHandler.invoke(Object, Object[], RequestContext, ResponseContextReceiver) line: 98&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SyncMethodHandler.invoke(Object, Object[]) line: 78&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SEIStub.invoke(Object, Method, Object[]) line: 107&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;----&amp;gt; proxy and stub creation has been taken care by JDK&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$Proxy19.implementMe(String)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;    &lt;/span&gt;---------&amp;gt; is the remote call to the webservice's method&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;WSClient.main(String[]) line: 15&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;---------&amp;gt; is our client main method&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
what happens on the server side&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Thread.sleep(long)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;------&amp;gt; just sleeps for 10 sec before it sends out the response&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;IamAnImplementer.implementMe(String) line: 11&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;---&amp;gt; call to the interface method which was exposed as a service&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;NativeMethodAccessorImpl.invoke0(Method, Object, Object[])&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Method.invoke(Object, Object[]) line: 597&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;InstanceResolver$1.invoke(Packet, Method, Object[]) line: 235&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;InvokerTube$2.invoke(Packet, Method, Object[]) line: 135&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;EndpointMethodHandler.invoke(Packet) line: 246&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;SEIInvokerTube.processRequest(Packet) line: 82&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.__doRun(Tube) line: 587&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber._doRun(Tube) line: 546&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.doRun(Tube) line: 531&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Fiber.runSync(Tube, Packet) line: 428&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;WSEndpointImpl$2.process(Packet, WebServiceContextDelegate, TransportBackChannel) line: 232&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpAdapter$HttpToolkit.handle(WSHTTPConnection) line: 460&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;HttpAdapter.handle(WSHTTPConnection) line: 233&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;WSHttpHandler.handleExchange(HttpExchange) line: 95&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;WSHttpHandler.handle(HttpExchange) line: 80&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Filter$Chain.doFilter(HttpExchange) line: 65&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;AuthFilter.doFilter(HttpExchange, Filter$Chain) line: 65&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Filter$Chain.doFilter(HttpExchange) line: 68&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ServerImpl$Exchange$LinkHandler.handle(HttpExchange) line: 557&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Filter$Chain.doFilter(HttpExchange) line: 65&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ServerImpl$Exchange.run() line: 529&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ThreadPoolExecutor$Worker.runTask(Runnable) line: 886&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ThreadPoolExecutor$Worker.run() line: 908&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Thread.run() line: 662&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;----&amp;gt; the publisher start a thread starts&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;The document style implementation is all the same way as above except the style declared in the remote&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; interface class will change to DOCUMENT.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;br /&gt;&lt;/span&gt;
The WSDL will be different for each of these implementations although there seems to be no change in the execution path i.e. stack traces shown above.&lt;br /&gt;
&lt;br /&gt;
In Java EE7, there is support to implement RESTful webservices through the API called JAX-RS.&lt;br /&gt;
These are best suited when there is no need for state maintenance, can rely on underlying server caching mechanism and the content will not change dynamically and for light weight message exchanges like handsets, portable communication devices etc,. The RESTful services do not require XML messages or WSDL based API implementations.. They depend/implement the REST verbs like PUT/GET/POST/DELETE.. the implementation is very simple - a root reosource class annotated with the @PATH tells where the implemented java class is located and its methods annotated with the verbs like @GET, @Producer etc., tells which type of request handling will be done, what kind of text will be produced and the output etc., the servlet mapping defined the application's web.xml will tell the resource path and the mapped classes ro invoke.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;soap:address location="http://localhost:7777/ws/hi"&gt;&lt;/soap:address&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java String, StringBuilder and StringBuffer</title><link>http://tech-wikis.blogspot.com/2015/11/java-string-stringbuilder-and.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 25 Nov 2015 02:51:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-4537990812726465413</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
What is so different between String, StringBuffer, StringBuilder ?&lt;br /&gt;
&lt;br /&gt;
Strings are simple, constant size and represents a series of characters.&lt;br /&gt;
Since they are constants, strings can not be changed and you can simply exchange them.&lt;br /&gt;
StringBuilders make them a bit flexible and changeable. While StringBuilder and StringBuffer provides some similar features, StringBuffer is better when it is multi-threaded usage as the methods are synchronized.&lt;br /&gt;
&lt;br /&gt;
A simple example:&lt;br /&gt;
&lt;br /&gt;
public class StringAndStringBuilder {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public static void changeString(StringBuilder sb){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sb.delete(0, sb.length());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sb.append("changed");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;public static void changeString(String s){&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;s="changed";&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public static void main(String[] args) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StringBuilder sb=new StringBuilder("nothing");&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; changeString(sb);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println("value after change via stringbuilder "+ sb);&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;String s = new String("nothing");&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;changeString(s);&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;System.out.println("value after change via string "+ s);&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
output:&lt;br /&gt;
value after change via stringbuilder changed&lt;br /&gt;
value after change via string nothing&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java Synchronization</title><link>http://tech-wikis.blogspot.com/2015/11/java-synchronization.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Wed, 25 Nov 2015 02:13:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-6584072479250386704</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets see how synchronization works in Java. Below is a sample program which has three parts&lt;br /&gt;
- TestSynchronization is a the main class&lt;br /&gt;
- TestThread is a private class extends Thread.&lt;br /&gt;
- IamSynchronized is one more private class which has synchronized code logic. one part is just a synchronous block and the other is a synchronous method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class TestSynchronization {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public static void main(String args[]) {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; IamSynchronized IS = new IamSynchronized();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; TestThread T1 = new TestThread( "Thread - 1 ", IS );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; TestThread T2 = new TestThread( "Thread - 2 ", IS );&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;try{Thread.sleep(60000);}catch(Exception e){}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; T1.start();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; T2.start();&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class TestThread extends Thread {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;private Thread t;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;private String threadName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;IamSynchronized IS ;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;TestThread(String name, IamSynchronized is){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;threadName = name;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IS = is;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void run() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;IS.justIterate();&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; System.out.println("calling sync method - Thread: "+threadName);&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; IS.syncMethod();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println("Thread " +threadName + " done");&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void start ()&lt;br /&gt;
&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println("Starting " + &amp;nbsp;threadName );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (t == null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; { t = new Thread (this, threadName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;t.start ();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class IamSynchronized {&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public void justIterate(){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; synchronized(this){&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;try {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i = 5; i &amp;gt; 0; i--) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println("Iteration -- &amp;nbsp; " &amp;nbsp;+ i );&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;Thread.sleep(1000);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}} catch (Exception e) { &amp;nbsp; &amp;nbsp;System.out.println("Interrupted"+e); &amp;nbsp;}&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public synchronized void syncMethod(){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;try {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i = 5; i &amp;gt; 0; i--) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println("Iteration -- &amp;nbsp; " &amp;nbsp;+ i );&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;Thread.sleep(1000);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;} catch (Exception e) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println("Interrupted"+e);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Lets see how the locking works and how the control flow happens when 2 parallel threads trying to execute the same logic.&lt;br /&gt;
&lt;br /&gt;
Starting Thread - 1&lt;br /&gt;
Starting Thread - 2&lt;br /&gt;
I am in the non synchronous part of justIterate method - Thread Thread - 1&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 5&lt;br /&gt;
I am in the non synchronous part of justIterate method - Thread Thread - 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- THREAD 2 IS BLOCKED BY THREAD1&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 4&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 3&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 2&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 1&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 5&lt;br /&gt;
calling sync method - Thread: Thread - 1&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;          &lt;/span&gt; &amp;nbsp;-- THREAD 1 IS BLOCKED BY THREAD2&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 4&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 3&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 2&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync block Iteration -- &amp;nbsp; 1&lt;br /&gt;
calling sync method - Thread: Thread - 2&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;          &lt;/span&gt; &amp;nbsp;-- THREAD 2 IS AGAIN BLOCKED BY THREAD1 BUT IN SYNC MTHOD&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 10&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 9&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 8&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 7&lt;br /&gt;
I am Thread Thread - 1 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 6&lt;br /&gt;
Thread Thread - 1 &amp;nbsp;done&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 10&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt; &amp;nbsp;-- SINCE THREAD1 RELEASES LOCK, THREAD2 CONTINUES&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 9&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 8&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 7&lt;br /&gt;
I am Thread Thread - 2 &amp;nbsp;in sync method Iteration -- &amp;nbsp; 6&lt;br /&gt;
Thread Thread - 2 &amp;nbsp;done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below stack trace gives an idea on how the locks being handled by the JVM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
"Thread - 2 " prio=6 tid=0x000000000b550800 nid=0x2478 waiting for monitor entry [0x000000000d48f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: BLOCKED (on object monitor)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.justIterate(TestSynchronization.java:47)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - waiting to lock &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:24)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;br /&gt;
&lt;br /&gt;
"Thread - 1 " prio=6 tid=0x000000000b550000 nid=0x18c4 waiting on condition [0x000000000d17f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: TIMED_WAITING (sleeping)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.sleep(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.justIterate(TestSynchronization.java:49)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - locked &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:24)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
--------------------------------------------------&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
"Thread - 2 " prio=6 tid=0x000000000b550800 nid=0x2478 waiting on condition [0x000000000d48f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: TIMED_WAITING (sleeping)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.sleep(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.justIterate(TestSynchronization.java:49)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - locked &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:24)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;br /&gt;
&lt;br /&gt;
"Thread - 1 " prio=6 tid=0x000000000b550000 nid=0x18c4 waiting for monitor entry [0x000000000d17f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: BLOCKED (on object monitor)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.syncMethod(TestSynchronization.java:56)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - waiting to lock &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:26)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
--------------------------------------------------&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
"Thread - 2 " prio=6 tid=0x000000000b550800 nid=0x2478 waiting for monitor entry [0x000000000d48f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: BLOCKED (on object monitor)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.syncMethod(TestSynchronization.java:56)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - waiting to lock &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:26)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;br /&gt;
&lt;br /&gt;
"Thread - 1 " prio=6 tid=0x000000000b550000 nid=0x18c4 waiting on condition [0x000000000d17f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: TIMED_WAITING (sleeping)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.sleep(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.syncMethod(TestSynchronization.java:58)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - locked &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:26)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
--------------------------------------------------&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
"Thread - 2 " prio=6 tid=0x000000000b550800 nid=0x2478 waiting on condition [0x000000000d48f000]&lt;br /&gt;
&amp;nbsp; &amp;nbsp;java.lang.Thread.State: TIMED_WAITING (sleeping)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.sleep(Native Method)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at IamSynchronized.syncMethod(TestSynchronization.java:58)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - locked &lt;0x00000007d5fbab18&gt; (a IamSynchronized)&lt;/0x00000007d5fbab18&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at TestThread.run(TestSynchronization.java:26)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; at java.lang.Thread.run(Thread.java:722)&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Eclipse MAT - Analyzing heap dumps</title><link>http://tech-wikis.blogspot.com/2015/10/eclipse-mat-analyzing-heap-dumps.html</link><author>noreply@blogger.com (sridhar)</author><pubDate>Tue, 13 Oct 2015 08:52:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-7952927324764064689.post-3060512762609181467</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;Eclipse Memory Analyzer Tool is one of the best tools to analyze JVM heap dumps and to understand the memory allocations, memory leaks etc., Below listed are kind of pointers to what MAT gives and what they actually mean in analyzing the heap dump&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;The Overview report is the best one to start. It gives&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;size &lt;/b&gt;of your heap dump - which could be very less than the XMX or in most of the cases a bit larger than the XMX. The first case examples are - OOM thrown not in the heap but other areas like perm space, TLA or may be it just could not allocate a large char array say gt. 2GB while there is still lot of free space or sometimes not able to dump large collection of objects which are pending with finalizer thread.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Classes&lt;/b&gt;: number of classes loaded&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Objects&lt;/b&gt;: number of objects loaded&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Class Loaders&lt;/b&gt;: number of class loaders&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Unreachable objects histogram:&lt;/b&gt; these are normally removed during analysis but can be set not to by using preference 'keep_unreachable_objects'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;The overview report also gives pointers on where to look..&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Histogram &lt;/b&gt;- gives the number of instances per class.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;you can obtain the shallow &amp;amp; retained sizes (shallow heap is the mem. occupied by one object of a class. retained heap is the sum of shallow sizes of all the objects of a class)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;you can calculate the approx. or precise retained size of a class or package. group the histogram view at package level or a class loader..&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;you can also explore the top packages or class loaders by going through outgoing references. outgoing references are basically the tree nodes or leaves that a specific object refers to.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;Incoming references of an object are basically all the links i.e. references that kept the object alive&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Dominator tree -&lt;/b&gt; is an object graph showing all the dominators list. it is basically showing all the 'dominating' links of an object tree.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;top consumers - &lt;/b&gt;it is similar to grouping the histogram view by packages. But nice report to know which packages are the top consumers of the memory. So that we can further explore which classes of the top consuming packages are being instantiated or retaining more space and what are their immediate dominators or gc roots&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;duplicate classes - &lt;/b&gt;gives the list of duplicate classes loaded by different class loaders. If your perm gen space is filling up then probably this view will give good indication on what classes are being loaded and duplicate list.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;In addition to above, there are 2 good reports given by MAT&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Leak Suspects:&lt;/b&gt;It points out what are the biggest objects occupying the memory. They may or may not be the leaks but worth to begin the investigation with. It tells how many instances and memory consumed by each instance. you can also get the gc root information like which gc root like a thread, class loader etc., have instantiated the objects. (This can be obtained from leak hunter report.)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;It also gives system &amp;amp; thread overview, top consumers, class histograms.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;Top Components: &lt;/b&gt;use this if there are no heavy objects found by leak suspects. This report will give detailed analysis for all the objects occupying gt. 1% of heap.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;b style="font-size: 14px; line-height: 20px;"&gt;Finalizers: &lt;/b&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;this is one more important feature to see what the finalizers are doing. Finalize methods will be executed to free up the object. sometimes if there a long running code in finalize method or a lock in the finalize method could delay in cleaning up the heap. This could result in large&amp;nbsp;accumulation of objects pending for finalization. in MAT, go to Java Basics -&amp;gt; Finalizer Overivew to view these stats. If Finalizer Overview does not show any data then check the thread which is doing finalization like 'Finalizer thread' in weblogic and check how much space it has retained. If that does not show any significant memory held and the heap dump is not the same size as reported in verbose GC logs just before the dump then live monitoring of class histogram is the option. It could be that there are huge number of objects loaded and not live and waiting to get finalized.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;you can also query the heap using OQL, analyze threads to see thread stacks, URLs, thread states etc., java collection usage,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;Knowing all the above, A quick way to analyze the heap dump is take a look at the leak suspects after getting a high level idea from overview report. see if there&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;are any large collection of an objects is being loaded and by which class loader. now get the path to gc roots (or merge shortest path option for top instances by retained size) from histogram if not given in the suspects report, to find out who is/are holding these&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;objects in the memory. once we know who is holding, now see what the object contains i.e. the content. sometimes there will be a single object holding large amount of memory like some big xml report generation or&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;there could be large collection of small objects occupying the memory. In the second case see why so many instances rather than the size of each instance.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item></channel></rss>