Hi all, My web server could have 500 clients.Each client sends its information to my server after every 2 mins.Server stores the information in the database. The information sent by client after every 2 mins ,may or may not change.So in my opinion,it is not a very good design,to update the database after a message from the client comes.Instead server can update a xml file after receiving a message from the client.After that say after every one hour,the server will update the database by taking values from the xml.
Is it a good approach?can i do something else.Please express your views.
No. You've gone from one transactional data store to two data stores, one of which is not transactional. Every query (from every application that might connect to your database, not just from your web app) now has to query an XML file and the database, since the database is always out of date.
This sounds a lot like an early optimization. Web server, servlet containers and RDBMS's all have well understood optimizations routes. Write your application to hit the DB as often as you need, then tune the infrastructure if performance is poor. [ August 31, 2006: Message edited by: Paul Sturrock ]
Its not clear that whether clients will access the data entered by other clients. It can be in one of the two ways,
1) If it is to store the data, and will not be modified by other clients then storing the data in xml file and updating the database is fine, but that depends on your db and way of accessing the xml file. The performance factor plays a major role. Just think about writing into file and writing or modifying the database, will not they take same time?
2) If other clients will modify and see the data entered by clients, then storing or updating the data in DB directly would be better. Because it will promise ACID properties. you can use Hibernate or EJB if you want to really improve the time. If there is no application server , then go for Spring + Hibernate.
3) If you are maintaing in the file, think about the state of the server before crash ( if at all any) and after crash ....
Any way to maintain the consistancy state, it would be better to update the database.
So now I can conclude that,there is no harm in hitting the DB although there are 500+ clients sending data after every one or two minutes.Please confirm the above statements are true or not.
No idea. All I could say is probably not. It is very difficult to say anything about performance without knowing what your application is doing and the environment it is deployed in. Even if we did know these things, performance questions are very difficult to quess up front. This is the sort of thing you own performance testing will discover. Prototype your application and test it to see. [ August 31, 2006: Message edited by: Paul Sturrock ]