Saturday, August 8, 2009

Best practice for DB server and web server?

Hi guys,



I%26#039;m setting up a sales information system, and I%26#039;m using MS SQL 2000 for my DB and PHP.. My question is, what is the best practice for server setup. Is it much faster to host the web server and the DB server on the same machine or to have them hosted on a separate machine. The system is already working fine, the codes are already optimize. Right now I%26#039;m having problem with the speed of the quiries specially for long long date ranges. thanks..



Best practice for DB server and web server?





Separate these two into your data base server and web server. Windows never has handled multiple use servers right.



Best practice for DB server and web server?



If your performance tuning first check the queries themselves, its most likely that you have slow queries, look at the slow query log in MS SQL or its performance stats to help track down the slow queries. Try adding indexes to the the columns in the tables where there is a performance bottleneck. Indexes should resolve most of your read performance issues. You can determine which columns should be indexed by how your joins are written index the columns in the join or in the where clause.



You can always move the db server to its own box, but until you can isolate the problem you will probably still have a slow query performance.



. I%26#039;ve seen this type of issue before and 9 out of 10 times, figuring out which query is the bottleneck, re-writing it and then adding the necessary indexes fixes the issue good luck! .



Other Replys:There is no rule on whether one should host the DB and web server on the same or different machines.



In performance problems always look for the bottleneck. In your case your queries are the bottleneck. If you move your DB to another machine, they will also take long time to process hence you should keep the DB and your web application on the same machine and try to optimise your queries.



Optimising queries is a whole world by itself. Most usually you should be careful on locks being issued as you query your data. Make yourself familiar with optimising SQL Server queries so that you know what%26#039;s causing them to be slow.



Hope this helps.

No comments:

Post a Comment