|Web Server and Database Server|
How do you know when should seperate the web server from database server
My Company plans to have several websites (for our own server) which using the same MySQL database (aprox 30,000 products) with PHP. We are also using imail for the email (aprox. 100-150 employers)
Do you think should I put them in one machine or two or three?
What we are going to do with this server is Microsoft Windows 2000/2003, PHP, MySQL, iMail.
Any help appreciated.
You have to look at the numbers. How is your CPU usage looking? How is your database memory usage? How many emails are being sent per day?
In a perfect world, you should definitely have each section of your site (web, database, email) on different servers. Email is one area that people tend to underestimate. If you're sending out a lot of batch emails, it can cripple a web server (especially with inefficient code). At the very minimum, you should have at least 2 servers (web & database).
Agree with mattglet about making sure the e-mails are handled efficently. It was a huge bottle neck in our system before we realized it and optimized the code to handle e-mails in threads.
you can always work with "one server".
you can pick a dual processor server (centrino)
then go to a dual xeon....and you could increase the number of CPUs.
apart from that you could also spend 2000 dollars a month on a blow-up sun server or itanium with 16 gigabyte ram.
it is easier if you have one powerful server than lots of standard servers.
most hosts also make you pay for internal traffic, e.g. between the database and the webserver.
Well, if the only separation you are considering is web/database, just try one server. If it works for your needs, great. If you need more power, then migrating a database is a job that will only take a couple hours at most.
The only other thing to consider is getting a second server for security issues. Your web server is available to the web, external and visible ip address: hackable target. If an offender had to first get through the web server and then hack through to the rest of the network from there, it slows them down some at the very least.
If you don't see an obvious need to have two boxes dedicated to their own task (web and db), you may very well not have the need.
One major reason for having them on different machines is so you can scale either piece when it becomes a bottleneck. Generally when the DB starts to become a bottleneck, it should be on it's own machine which is specifically built for the task of serving a database. That generally means as many hard drives and CPU's as possible as well as tons of RAM for starters. Additionally, you can tune the database to take full advantage of the servers resources without worry of affecting the web service side of things.
Generally a good web server is mostly about raw CPU performance, with disk speed as a distant second. A moderate amount of ram will usually be fine.
I have built systems where the database server's disks (6 of them) are totally maxed out in terms of IO at any given time, yet most aspects of the web site, including the database performance for most users seems fine. The web server (a different machine) is on a server who's disk is NOT being starved, so it behaves fine. The DB server is mostly servicing user request/queries from cache (RAM), so end user performace still seems to zip along. Since it's a multi-cpu box, the disk io (jornaling processes), the process causing disk io, and user queries don't have to share a cpu, again decreasing negative effects. If both machines were on the same box, the disk IO would affect the web server, maybe severly. On a well tuned db in a two server system like this, most (all?) users don't even know this disk IO is maxed out and backlogged. Things just hum right along.
Don't know if that helps, but it's one example of where two servers are helpful.
If this is an internal web server, it may be fine to have both on the same machine, although it all depends on the type and amount of queries the web pages request.