Monday, September 29, 2014

Tuning

Change one parameter at a time
Measure and reconfigure by levels: For the same reasons that you should only change one parameter at a time, tune one level of your system at a time. You can use the following list of levels within a system as a guide:

Hardware
Operating System
Application Server and Requester
Database Manager
SQL and XQuery Statements
Application Programs

Understand the problem before you upgrade your hardware: Even if it seems that additional storage or processor power could immediately improve performance, take the time to understand where your bottlenecks are.



For how one affects the other, let's assume that you have a slow CPU but lots of RAM. That means that you can store quite a few of those numbers in memory - about half a billion of them on a typical 32 bit machine. But processing/computation/etc on those numbers will be slower.

On the other hand if you have a fast CPU but a small amount of RAM, processing of the numbers will be fast, but from time to time the machine will need to drag them from disk (and put them back again to make room for more), which is many times slower than taking them from RAM.

A basic example might be an image editing program. I load up my 20MB jpeg, the program reads the entire image, and the OS keeps that in RAM for you (all working memory looks the same to the program, the OS decides if it goes to the page/swap file on disk or RAM). So the image is in RAM waiting to be processed, but I go for coffee before telling the program to apply so silly filter, so the CPU isn't doing anything. I come back, apply the filter to add some bubbles to the image, and the CPU goes to 100% and even more memory gets used because it keeps the preprocessed image in memory,


More RAM = you can run more apps concurrently

More CPU = you can run more complex calculations/operations


It's the same relationship as your brain have with a book. The faster brain = the faster your read, the bigger the book = the more pages it can contain.


No relationship. Think of it in terms of doing some heavy-duty number-crunching. RAM is how many of those numbers can be stored for faster retrieval, whereas CPU is how fast those numbers can have mathematical operations performed on them.

For how one affects the other, let's assume that you have a slow CPU but lots of RAM. That means that you can store quite a few of those numbers in memory - about half a billion of them on a typical 32 bit machine. But processing/computation/etc on those numbers will be slower.

On the other hand if you have a fast CPU but a small amount of RAM, processing of the numbers will be fast, but from time to time the machine will need to drag them from disk (and put them back again to make room for more), which is many times slower than taking them from RAM.

So really, each affects the other, and for best performance you need both to be good. However, this totally depends on what each application is actually doing, and there are other factors (such as disk speed, processor caches, etc) which we needn't go into too much detail about for now, but which you should be aware will complicate things.



If the program is disk-intensive, speed is proportional to the disk.
If the program is oriented towards calculations : speed is (mostly) proportional to the CPU, since the memory cache nowadays is pretty intelligent and fast.
Else speed is (mostly) proportional to memory.


The relationship between RAM and processor and why programs run faster is simply because with more RAM, more data to be processed can get to the processor faster.


I believe you are referring to IO operations for processing purposes, and I'll attempt to give a simplified layman answer.

Assume the processor is a meat-grinder in a factory, and assume RAM, hard disk are like the conveyor belt system feeding unprocessed meat to the grinder to be ground.

Assume the conveyor belt has two parts -> the slow-but-wide part, and the fast-but-narrow part. The former alludes to the hard disk big storage but slow speed, and the latter is referring to memory's small storage but high speed characteristics.

So...

HARD DISK CONVEYOR (WIDE BUT SLOW) -> RAM CONVEYOR (NARROW BUT FAST) -> GRINDER (PROCESSOR)

When your increase your RAM, it is like widening the RAM conveyor, thus the grinder can potentially receive much more at one go for processing.

If your RAM is low, it means that while the RAM conveyor is fast, it is extremely narrow, thus the volume of meat pouring into the grinder is little. At the same time, meat might potentially choke at the hard disk conveyor points (in short meat that is supposed to be on the RAM conveyor in a well-optimized system is actually still on the hard disk conveyor - a.k.a paging/swap file).

To sum an answer all up in a hopefully easy to understand sentence :

The relationship between RAM and processor and why programs run faster is simply because with more RAM, more data to be processed can get to the processor faster.

If the size of the system memory is equivalent to how wide the RAM conveyor is, then the Frontside Bus (FSB) is equivalent to how fast the RAM conveyor goes.

Whew! Hope this answers your question!


Split single application in several processes with non-shared memory (not a threads; but processes). First process can run DB and second can run other part of the project. You can use RMI or shared memory or sockets to communicate between processes.




\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
it sounds like your talking about having different methods within a single application run under different JVMs. This is not possible.

If you want to use different JVMs for different applications, you'll have to manually specify the path to the particular JRE when you start an app. Example:

$PATH_TO_FIRST_JVM/bin/java -jar application1.jar
$PATH_TO_DIFFERNT_JVM/bin/java -jar application2.jar


There are several insightful answers here, but something that interests me the driving requirement for running multiple JVMs. Why do you believe you need to do this? If you are looking for parallel processing, you might want to consider a multi-threaded application as opposed to running multiple JVMs. Since each JVM could very likely require significant resources and you'd like to have communication between paths of execution, this may very likely be a better solution for your needs.



Tuning Java virtual machines
jvm maximum size for 32 bit and 64 bit
Determine the type of JVM on which your application server is running.
Need help regarding multiple JVM in a single server///////////////////////////////////////////////////////


http://www.cacheonix.com/articles/How_to_Distribute_Java_Application_on_Multiple_JVMs.htm
http://stackoverflow.com/questions/8098158/re-architect-application-to-run-on-multiple-serversjvms-to-enhance-performance

http://hadoop.apache.org/////////////////////////////////for cluster one solution
http://stackoverflow.com/questions/8098158/re-architect-application-to-run-on-multiple-serversjvms-to-enhance-performance// same problem
http://www.coderanch.com/t/580009/Performance/java/multiple-JVM-single-server// same problem

// http://maintainj.com/userGuide.jsp?param=runtime//// important concept



http://www.ramkitech.com/2012/10/tomcat-clustering-series-simple-load.html

http://www.coderanch.com/t/234337/threads/java/performance-improves-multithreading///multithreading
http://scalibq.wordpress.com/2012/06/01/multi-core-and-multi-threading//////multithreading


Event Publishing captures changed-data events and publishes them as WebSphereR MQ messages that can be used by other applications to drive subsequent processing.
WebSphere
R
MQ message queues to target systems.

Coding to interface provides reusability and polymorphism.As far as class implements interface,the interface or abstract class can be passed to parameter instead of class that implements the interface.
public class Polymorphism{
void run();
Void Bark();
Energy getEnergy(Polymorphism test);
Public abstract class EnergySynthesis implements Polymorphism{
abstract void Energy();
Void Bark(){
 getEnergy(){

}
void run(){
getEnergy();

}public EnegyGeneartion extends EnergySynthesis  {
Energy getEnergy(Polymorphism test){
return new Energy( test);
}
MainClass{

EnegyGeneartion test=new EnegyGeneartion ();
test.getEnergy(test);
test.Bark()
.
.
.
.
.
//here in Energy getEnergy(Polymorphism test) any class can be passed as parameter that implemets interface (Polymorphism .


}

No comments:

Post a Comment