12/04/2011

JVM CodeCache

The main parts of memory of JVM are Heap, Perm Space and Code Cache. On one hand Heap and Perm sizes are well known as we need to set these sizes quite often, but on the other hand the Code Cache remains not so well known.

With the introduction of JIT (Just in time compiler) I believe in JDK 1.2 version, not all code was compiled to machine code from the byte code at a time. This compilation is completely different from javac compilation we have to convert Java source files to byte codes. The JVM, maintains a certain number that a method should be called (executed), before it decides to compile the code and cache it. By default its 1500 executions but can be overridden using -XX:CompileThreshold=10000. The initial calls to methods when not cached are just executed in interpreted fashion.

So where does code cache fits in all this? Well code cache is part of memory where all the compiled code is cached. There are options (-XX:ReservedCodeCacheSize=32m) to set the size of this cache memory. This memory stays outside of heap memory. So if you decide to make your system reach to peak performance early, by using some extra amount of memory, you should look at these options. Reducing the CompileThreshold and increasing the CodeCache Size, might help you to make your application the peak performance stage faster.

More details on various option configurations:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

7/28/2009

Apache CXF Proxy Setting for Client with httpConduit

Many times its required to run the webservice clients from within the company firewall. This require to go through a proxy, in Apache CXF webservice framework you can specify the Proxy setting for client code in cxf.xml file. You will need to place this file in the class path of your client application. Here is the setting one will require put



<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:conf-sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">

<http-conf:conduit name="*.http-conduit">
<http-conf:client ProxyServer="http://www-url-to-my-proxy.com" ProxyServerPort="80" />
<http-conf:proxyAuthorization>
<conf-sec:UserName>username</conf-sec:UserName>
<conf-sec:Password>password</conf-sec:Password>
</http-conf:proxyAuthorization>
</http-conf:conduit>

</beans>

7/18/2009

Why do we need GUICE ?

I was looking at one of the tech videos on GUICE framework. As I am not very familiar with this framework and I had some time on hand , I decided to go ahead and see this presentation.

Here are the important features discussed for Guice in this presentation

1. Dependency Injection
2. Modularize Code
3. Guice Servlet dispatcher
4. AOP – for transactions
5. Introspection for various Modules to see if dependency is broken

We can achieve all this features using Spring Framework and Maven. I guess maven is excellent tool to develop code in Modular fashion. You can divide your application in modules and these can be used across any other applications (if well defined). Plus Spring Framework provides the pretty good dependency injection and AOP.

So overall I am not sure as “Why GUICE ?”, when we can get the better things done through already well established framework. May be I will need to do some hands on to be able to find a better answer to this question


7/16/2009

Scala

The scripting languages are gaining grounds at much more rapid pace. The scripting languages such as Groovy, and more recently Scala has added advantage as they give a mix of static language, dynamic language and functional language. I have worked on Groovy before during my with Grails framework, (which i believe is pretty good framework) but recently i have come across the Scala language. Currently my understanding of this language is kind of limited. But initial impression of this language seems to be very promising to me. Here is one of the interesting blog post i found, it gives comparision between Scala features and Groovy features. It also discusses other important features of Scala.

http://www.khelll.com/blog/scala/scala-is-my-next-choice

Ora 911 invalid characters in sql statement

If you get this error please make sure that the sql statement does not have any special characters in it. One of the most common issue is of adding
a semi colon ; at the end of sql statement.