Monday, 26 October 2015

Microservices with Spring

Spring cloud is set of tools that helps you to build your application in "Microservice way". Here is short tutorial that spring published. More about microservices in dzone article.

Thursday, 14 May 2015

WARNING: Could not initialize OpenglES emulation, using software renderer

When I am running android emulator(from Android studio) I am getting bellow error:

emulator: WARNING: Could not initialize OpenglES emulation, using software renderer

This was due my switchable graphics, so my laptop has two video cards. And by default intel video was used. When I switched to the ATI video everything worked great.

Sunday, 15 March 2015

Simple example of Google Analytics API usage

Publishing my old note, of how to use Google Analytics Core Reporting API (v2)

Saturday, 14 March 2015

Hunting Memory Leaks in Java & memory problems notes

Good article about general approach of finding leaks
http://www.toptal.com/java/hunting-memory-leaks-in-java

1) In every jvm should be enabled following flags, to gather statistics:

-XX:-PrintGCDetails 
-XX:+PrintGCTimeStamps-Xloggc:gc.log or -verbose:gc
2) To read gc logs https://github.com/chewiebug/GCViewer
metrics:
throughout - the percent that your application works vs garbage collector
largest pause - the pause when gc works and your app is not responding

3) most used ways to solve memory problems

a) solve memory leaks problems, see article
b) Xmxn - enlarge heap size
c) change garbage collector algo, in general about GC's
Parallel GC - bad largest pause but good throughout
CMS - good pause but bad throughout
G1 - soon will be default, should be used from jvm8+, for jvm 7 still not so good


sometimes:
-XX:OldSize - the amout of data alive after Major GC, should be:
   for Parallel GC  XX:OldSize = LiveSet * (1,2 - 1,5)
   for CMS GC XX:OldSize = LiveSet * 2
^where LiveSet - amout of memory after Major GC

More links:
 

More about verbosegc

Dump heap to file when java.lang.OutOfMemoryError is throw 

-XX:+HeapDumpOnOutOfMemoryError and use Heap Analyzer tool

Sunday, 25 January 2015

Disable jsp compilation on Tomcat

For performance reasons it could be useful to disable jsp compilation (in runtime), and do pre-compilation. In tomcat you can disable it in the tomcat\conf\web.xml, see line with org.apache.jasper.servlet.JspServlet.