Monday, 21 November 2011
Wednesday, 16 November 2011
Tuesday, 15 November 2011
Saturday, 12 November 2011
Friday, 11 November 2011
Hinernate Lazy Load vs Select Statements.
Select statements are very expensive in Hibernate as discussed in my last post on Hibernate Performance. Therefore, the best alternative to avoid selects statements is not to use Lazy loading. Lazy loading does not come without a price, lazy loading is very memory intensive operation and should be used with extensive care.
Wednesday, 9 November 2011
Template Method Design Pattern
abstract class Fruit {
// Is the implementation of a template method which will be used in all the subclasses.
// This pattern is implemented by a Implementation Inheritance.
public final void eat(){
System.out.println("I am eating :" + this.getClass().getName());
}
abstract void cut();
}
class Apple extends Fruit{
@Override
void cut() {
System.out.println("This is how we cut : " + this.getClass().getName());
}
}
class Banana extends Fruit{
@Override
void cut() {
System.out.println("This is how we cut : " + this.getClass().getName());
}
}
public class TemplateMethodPattern {
public static void main(String args[]){
Fruit apple = new Apple();
apple.eat();
apple.cut();
Fruit banana = new Banana();
banana.eat();
banana.cut();
}
}
// Is the implementation of a template method which will be used in all the subclasses.
// This pattern is implemented by a Implementation Inheritance.
public final void eat(){
System.out.println("I am eating :" + this.getClass().getName());
}
abstract void cut();
}
class Apple extends Fruit{
@Override
void cut() {
System.out.println("This is how we cut : " + this.getClass().getName());
}
}
class Banana extends Fruit{
@Override
void cut() {
System.out.println("This is how we cut : " + this.getClass().getName());
}
}
public class TemplateMethodPattern {
public static void main(String args[]){
Fruit apple = new Apple();
apple.eat();
apple.cut();
Fruit banana = new Banana();
banana.eat();
banana.cut();
}
}
Thursday, 3 November 2011
Wednesday, 2 November 2011
HQL with Spring JDBC
After doing some more research the following is my suggestion to improve
performance. I am not sure how easily it's possible, if its' really
possible.
I would recommend using "HQL with Spring JDBC".
Spring JDBC basically makes using JDBC easier but still uses JDBC, so we
can get good performance.
HQL helps us write standard queries which mean we can get cross platform
flexibility as well.
What do you think? Is this combination possible?
performance. I am not sure how easily it's possible, if its' really
possible.
I would recommend using "HQL with Spring JDBC".
Spring JDBC basically makes using JDBC easier but still uses JDBC, so we
can get good performance.
HQL helps us write standard queries which mean we can get cross platform
flexibility as well.
What do you think? Is this combination possible?
Hibernate Performance.
After reading a few posts on the internet the following are my
conclusions:
1. Insert or Update operations in Hibernate work fairly good (not as
good as JDBC but close). So we do not need to do any improvement around
those operations other than just doing inserts in batch and avoid
Updates as they are costly anyways.
2. Select operation is very costly in Hibernate as compared JDBC. The
reason is hibernation of Data in objects. We can not avoid selects and
the way we program in hibernate we do a lot of them. The only way around
this problem is caching. We need to attach hibernate with a cache or
enable it if its already present in Hibernate.
3. Another improvement is to use Opportunistic locking by marking our
selects transactions as read-only.
So, basically Hibernate has an overhead and so will spring. Ease of
programming comes with a cost, now the question is how to reduce the
performance cost and keep achieving our Benchmark targets.
conclusions:
1. Insert or Update operations in Hibernate work fairly good (not as
good as JDBC but close). So we do not need to do any improvement around
those operations other than just doing inserts in batch and avoid
Updates as they are costly anyways.
2. Select operation is very costly in Hibernate as compared JDBC. The
reason is hibernation of Data in objects. We can not avoid selects and
the way we program in hibernate we do a lot of them. The only way around
this problem is caching. We need to attach hibernate with a cache or
enable it if its already present in Hibernate.
3. Another improvement is to use Opportunistic locking by marking our
selects transactions as read-only.
So, basically Hibernate has an overhead and so will spring. Ease of
programming comes with a cost, now the question is how to reduce the
performance cost and keep achieving our Benchmark targets.
Subscribe to:
Posts (Atom)
Azure OpenAI Architecture Patterns & Deployment Patterns
Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...
-
Setting up a MPI cluster on Ubuntu involves the following steps: 1. Install OpenMPI on all machines. $sudo apt-get install libopenmpi-de...
-
Very Useful Link: http://people.cc.ku.edu/~grobe/intro-to-LSL/index.html#particle Using the Linden Script Language This page is a short...
-
float p_size = 0.1; default { state_entry() { llSay(0, "Hello, Avatar!"); llSetPrimitiveParams( [ PRIM_...