I have an application in JSP, using MYSQL database and Apache 6.0 server.
Interfaces : Admin and Client
Requirement : Admin should get all the client names who are logged in. There is one text-box, if admin enters any message in text-box and clicks on any client, that message should display on the client browser.
Current Implementation : Once admin clicks on the client name in database I am updating a column named 'status' with the text box value. (Initial value of 'status' column keeping as FALSE). On client side I have set interval method which is calling a servlet using ajax (every second) and executing a query which checks the 'status' value, if it's NOT FALSE I have a function which shows the retrieved value on the page.
Issue : Due to the one connection per client per second, MYSQL is taking 100% CPU usage and crashing down. I have around 200 clients using the application simultaneously.
I need an alternative and efficient solution for this.
Any help will be really appreciated.