storing mail messages

Hello can anyone tell me how and where to store mail messages?? My question is, what does yahoo and gmail people do to store millions of mail messages?? Where do they store them? Do they make use of database apps or is thr any other way such as xml files or something? If they use database then is thr is any optimal way to store?? Can anyone explain me the concept pls?
I am not able to find any topic related to this on the web. can anyone pls suggest a link if they know?

Loader.
Up arrow icon