views:

47

answers:

2

Hi Guys; I have a large chat application in the build process and i'm confused about how to solve this issue .. i need to show the online status of 10 users on a page at a given time for which i'm using a database query and every time someone visits the page the query is executed and returns the user who are online ... problem is the online information is set in the database through another application therefore i have to query it to know who is online no matter what . Is there any way i can adopt to make things go faster?

I'm also using ibatis for my queries and DAO's.

Regards; Mohammad Umair

A: 

Having good indexes could help, but it can also help having the information in memory. Since the information is quite volatile, it's not important to have it saved when for example your app server goes down. (when that happens, everyone's disconnected anyway)

You could try using a java caching framework, write your own simple cache or try using a nosql or in-memory database if you have that option.

Kurt Du Bois
+1  A: 

My key point would be not to confuse efficiency with performance.

  1. How long does these 10 database calls take for your client to make?
  2. How does this scale to many users? (Of course, you should do some automated load testing of your application to find this out)
  3. Are they calls that block the Client UI? If so, can you spin them off to their own thread or make the call itself asynchronous?

See also: iBATIS Cache Models

Catchwa