File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Improving application Performace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Improving application Performace" Watch "Improving application Performace" New topic

Improving application Performace

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152

I need some help in order to choose the best approach for the performace of my website.
Currently we display menus and its corressponding sub-menus on the Page.Logic which we have implemented right now is: whenever user clicks on the main menu, we go to the Database and retrieves its corresponding sub-menus. This is done for each click on the the main menu or parent menu.Now, I would love to know what would be the better approach, per the performance is concerned, keep doing the same thing or bring the entire menu and its submenu when user logs in and place it in session scope.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15084

What do you think yourself... ?

Ofcourse it will be faster if you just get it from the database once and cache it in memory.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You can even cache just the drop-down using oscache
Sirish Kumar Gongal Reddy
Ranch Hand

Joined: Oct 25, 2004
Posts: 109
Hi Sahil Sharma,
As per my knowledge the good design is to maintain our application with limited no.of connection objects,to maintain the connection object on the heap is very expensive right ?
As per your application the intaraction with the database is more it improves the network traffic,it's consumes one connection per each time to intaract wiht the database.
My suggetion is reduse the contacts wiht the database that give you good efficiency on your application.
G Sirish Reddy.,
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Moving to Performance forum...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
srinivas kalluri

Joined: Sep 16, 2005
Posts: 3
When you are getting the submenus data for the first time from the database cache the data in the session object, and use the cached data when you need it for the next time. This would reduce the database interactions each time you click the menu to get the submenu.
I agree. Here's the link:
subject: Improving application Performace
It's not a secret anymore!