Rojan punn

Greenhorn
+ Follow
since Nov 29, 2011
Rojan likes ...
Eclipse IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rojan punn


HashMap map<String ,Card> =new HasHMap<String,Card>();

puclic class card{

private String deck;

getDeck(){
}
setDeck(String strdeck)
this.deck=strdeck;
}

}

card crd=new card();
crd.setDeck("deck1");

map.put("deck name ",crd);

this runs fast and consume less memory . if you have lots of arraylist searching and elements on your way..
11 years ago
256 is too small try 512.
I dont think class unloading is a wise because loading it again will cause lots of time?
try marking much of the method as final(utility methods) although not a good practise.Just for testing.
definietly logging in server side or client side is the cause of very poor perfromance.
try to figure out what you need to store in the memory and what you nee not to.
11 years ago
-Xms and -Xmx willl be used to inistalise max memory pool and min memory pool.This can be used for any application.it is your chice how you application should behave by providing java options.

I would say keep the initial siz and max size to same value and try.So this way when jvm startsup it will have all the memory it need till the end.
There is no way you can give a thread based memory allocation in a single jvm(as far i know). you can try tlab opion but highly inefficiant if threads are not using the allocated memory (not running) good side of this is that you will have a chunk of memory only for the your thread running.
Maximum memory for you login application can be changed to 1024 if you want and see this has any effect.

But following also need to be checked.

1) memory leak-
closing connection .resultset and statemets after use preferably in finally if posible.
avoid declaring class level variables for evrything,
2) avoid keeping data into the memory.
3) need to identify where you hold chunks of data into memory?
4) try different gc mechanisms
I have no clue what effect awt windows have on you jvm interms of memory

Regards,
Rojan
11 years ago

Hi,

Is this testing really for your application which runs in production env?Or just to learn abot the GC mechanism?Is this for a multi threaded env?
I wanst aware about G1 GC's existance in jdk6 .

The test really doesnt give an actaul performance figures .you will have a better idea if you make your program as a thread and register as a service in windows.and monitor it with defferent parameters and code cahnges.

from the picture provided the g1 GC has a very inconsisten use of Heap/or a very large amount of heap is used at a time ? which is not good for real time systems as other threads may run slowly in this case.
but the cms picture has a consistent use of heap .
So if you want to find out which is good you really have to experiment with these as you are doing now.Any way also have a look at the below lnk if you havent seen it already.

http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html

Rojan
11 years ago

@Bear Bibeault .IS it a Pre mature optimization really?

Sorry if i dint ask the size of the application here..

It is well known that selecting 100 column is much slower than selecting 10 cloumns.So Is it not good to think usr will not need all columns always?

I am not questioning you ..problem here is about the design of the application...

Thinking all possible overhead (at least expected ones)is also a good way of design i believe.

Is above not true?
12 years ago
It will create a connection But if you load the entire data the page loading will be very slow and It is ok to create a connection if you are closing it after use.
And there is no way we can get the data with out a connection.
12 years ago

Selecting all coulmn values can be an overhead .What is the problem in creating the SQL dynamically eg. if you are a web developer you can create a check box with column name as name of check box and create dynamic sql in java script and pass it to you java backend?
12 years ago
Arun,

your post drag me back some 9 years back when i first started my job search in Bangalore in 2002.
It is not very easy to contribute to open source projects as you need to uderstand them first and you need to suggest the changes you need to implement and this needs approval from the project manager of that project.
I would say you spent more time in completing yous java certifications and then start the job search extensively.Certfications improve your chance to get a job significantly(at least in India)
And you will have more java knowledge when you prepare for a Certifcations.
If you havent got a job throgh Campus then i would suggest you to try job application to small companies (which some time dont pay well) and look for big one after you got some experience.

Wish you all the best


12 years ago
Hi,

What is the server capacity?
Out of memory error suggest jvm cant allocate any more heap space .
Try some of the Memory analyzer tools(VisualVm,J console etc.)
256 looks to me like a very small amount.But it depends on the size of application and real time users.
Do you have any tool to track memory leak?and prints the memory leak on the trace file?
It is very good to have a java class which can keep track of opened resultset ,connection and gives an error or warning if the objects are not closed properly.
If its a problem with unclosed object the same problem haoppens at some stage even if you allocate 512 MB memory.

12 years ago
Disable all the GC verbose and add the below in the start up option

-XX:+UseParNewGC
-XX:+DisableExplicitGC
-XX:NewRatio=2
12 years ago

I thought any variables created in java has an address in memory and JVM knows how to get the value and set the value for variable using getField and setfield method using memory address as reference point.
But byte code just document the name of the varibale you create.
Is this wrong?
12 years ago

Like our friends said there is no easy way to improve performance!!

Did you try running the same query in the production DB server itself?If not i would suggest to do that first. and check the time taken to execute the query
Do you have a DB server in same machine as web server?
12 years ago
Hi,

I use -XX:+UseParNewGC
-XX:+DisableExplicitGC

It is performing quite well
12 years ago
Hi,

I am not very sure about the all of the below ,

set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=691200000 -Dsun.rmi.dgc.server.gcInterval=691200000
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:gc.log
set JAVA_OPTS=%JAVA_OPTS% -XX:LargePageSizeInBytes=5m -XX:ParallelGCThreads=20 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:ThreadStackSize=1024

but try the blow java_opts
-XX:+UseParNewGC
-XX:+DisableExplicitGC

is the second JAVA_OPT is really required in your settings?

It is worth try romoving all your above java option and put the one i provided.

Are you using any loggers?
Are you updating db at any point in this process?

I think the large size of string can be a cause of the issue.Is there any way to build the string in smll chuncks?
12 years ago