1

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.

Zee
  • 41
  • 2
  • 8
  • Is PostgreSQL an option? It supports LISTEN/NOTIFY. How about Web Socket? – Neil McGuigan Mar 06 '15 at 20:38
  • Does JSP have server-side shared memory? If so, you could update that to say that a message is pending. Or, better yet, record which user(s) have messages pending. Then, the server does not need to check the database when AJAX pokes it; it only checks this shared memory. Then, only if needed, it can connect to the database. – Rick James Mar 06 '15 at 22:29
  • Another approach is to have memcached hold the desired info. – Rick James Mar 06 '15 at 22:29

0 Answers0