Jump to content

PHP and MySQL - when do you need more than one database?


doug

Recommended Posts

I'm not about to actually attempt a project that requires large scaling, but was wondering, just in general, what sites with massive scaling (like hundreds of thousands or even millions of users) do to achieve that?I assume a large part of the problem is the database. At some point, if all your SQL requests are made to one database on one server things just get to busy with requests to serve well.Is one way this is handled by breaking things up into multiple databases, and serving different databases on different servers?Like consider user records. Instead of keeping all the users in one big database, do larger projects employ strategies such as keeping all A users in one database, the B users in another, etc?For something like a large forums server, instead of storing all the tables for the forum content and all the tables for users records in one database, is there an advantage to storing the forums content in one database and the user records in another database?I'm just curious about the practical limitations of a single database and when you should consider breaking it up into multiple databases.Thanks,doug

Link to comment
Share on other sites

Note that I'm no expert at this so you should probably wait for other users' input as well.When do you need more than one database? Most of the time you don't. It's better to reduce the number of databases you have on a server. But for big companies, like Sun Microsystems, of course they have more than one database. Sun, for example, probably would have a database for their community, a database for their bug tracker, a database for their main site (which includes their users, their products, etc.) and so on and so forth. That was just an example.SQL requests are made to a database server (and large companies have several database servers like the example above). The database server has several hard drives. It's a good idea to spread your data files as well as your index files across multiple hard drives. For example, for forum software, you should put every table pertaining to users on one hard drive, put every table pertaining to messages on another hard drive, put the index files on another hard drive, etc. A hard drive can only handle a certain number of reads and writes per minute. If you put all the tables and indexes on one hard drive, your application's performance will not be very good.http://en.wikipedia.org/wiki/Wikipedia#Software_and_hardwareThat's a good article on how Wikipedia can handle so many page requests per second.

Link to comment
Share on other sites

Having multiple databases also provides another level of organisation, so say if you needed to backup the user database but not the bug list then you could just copy one database file instead of picking through the tables trying to find the right ones.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...