0

we have to implement a monitoring module to existing web application. The purpose of the application is to record time taken at each method executed at run time and saving to 2 monitoring tables. As there are many method invocations happening in the application, we can't save to table every time a method is executed.We have used spring aop to intercept time.We used redis to cache data, and in every ten minutes, take the data from cache and save in the database.But redis seems to be a troublesome ideas as it keep making new connections and this give the application a nightmare.Is there any alternative way to do this.We considered about writing to a file and taking data from the file periodically.But that also seemed to be a resource consuming solutions.

asked Jul 22, 2012 at 3:40
5
  • 1
    Surely your database can log the time for every transaction? Commented Jul 22, 2012 at 3:57
  • 1
    Are you looking for speed or less consumption of resources? Use the RAM is always faster than using the hard disk. In another hand, you can try another caching solutions. Commented Jul 22, 2012 at 4:04
  • @PaulVargas,I think Its good idea. Commented Jul 22, 2012 at 5:01
  • @EJP idea is one table records all the transaction data, like time taken at each method and other table keeps computational record like avg,max,min time for one specific method.first table data will be deleted periodically Commented Jul 22, 2012 at 5:03
  • I understand the idea. The point is that all the data is already in the database. All you have to do is perform queries on the logs. You don't have to collect the data. Commented Jul 23, 2012 at 2:18

1 Answer 1

1

I would suggest storing everything in your Java application. If all you want is a few stats, you can keep track of this information in a HashMap and write it every 10 minutes to the database from another thread. Min/Max/Avg time won't take much memory, and you can reset stats once it's written to the database.

If that doesn't suite your needs for some reason, Redis should be fast, and can even help you compute your statistics. I'd setup a connection pool to prevent it from making a new network connection each time. Then, I'd use asynchronous writes (pipelining) in your Redis client to speed up writes. Jedis and JRedis both support this.

answered Jul 22, 2012 at 15:19
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.