mercredi 31 décembre 2014

Update UI(JSP page for Monitor) when certain Activities take place in a Web Application (in Tomcat)

The requirement is that I need to design a JSP page where a user logs in and monitors activities going on in the Application. For example: a user logged in, an account was created, a user logged out, left a comment and so on.


Initially my design was such that, I used polling to query the database regularly to check activities logged(in log table) recently and display that. I made Ajax calls every 1 minute to fetch latest data from table and added that to the activity list in the JSP page.


Polling is working but it has the disadvantage of putting pressure on the Database Server. I was wondering if there is a better approach, something similar to Observer Pattern or Publish-Subscribe pattern. Or should I maintain a Cache of these messages? In that case it will quickly grow and eat memory if its a heavily used application.


At the moment I could think of something similar to Echo server, where all important messages are sent to the Echo Server, and all the clients listening to the Echo Server will receive the message. However the feasibility of implementing this is under question.


Aucun commentaire:

Enregistrer un commentaire