The Car PC: Server-side software
2007-11-10 00:02 by Ian
My Mp3 collection at home is large. About 19,000 files large, and growing monthly. Weighing in at about 200GB, storing it all in the car would be technically possible, but unattractive for several reasons.
First, it would require the use of a traditional hard drive. A bulky fragile monster that gobbles electrical current. I want this thing to be as low-power as practical without any moving parts. Factor in the blazing Phoenix summers and the temperature-cycling that it induces and we have a prime scenario for warranty abuse. No thank you. I’ll stick to flash.
The basic trade-off is availability vs storage space. I want theoretical access to every Mp3 on my computer, even if I know I will never listen to it. I’m just irrational that way. But I’m not going to pay for 200GB+ of flash drive. A 16GB buffer should do nicely.
The solution? Since the car will have regular internet access, I will take advantage of my hosting provider’s database servers.
Here is the scheme: There are three computers involved. My server at home (BASE), my hosting server at CrystalTech (NET), and the PC in my car (ROAM).
There are three databases involved, one in each of the three computers: BASE-DB, NET-DB, and ROAM-DB.
BASE runs a PHP script mediated by crontab. This script checks the actual Mp3 files (which are located on BASE) and parses their relevant information and uploads it to NET-DB.
NET-DB is used to feed the user-interface at my main site (http://jsparx.net), and the user-interface running on ROAM. From that point, the user can search and select music that he/she wants. Doing so makes modifications to NET-DB.
Every 10-minutes, BASE reads NET-DB and uploads the requested files to NET. Upon successful completion of a transfer, BASE modifies NET-DB appropriately.
ROAM periodically updates ROAM-DB to mirror NET-DB. In doing so, it immediately has access to what music was uploaded. When the request was found to have originated from ROAM, ROAM will download the selected music from NET.
This script will eventually be expanded to make BASE mirror NET-DB to its own BASE-DB. It will store the archive of all the logs, GPS coordinates and other good stuff that I don’t have room to store on either NET-DB or ROAM-DB. Since BASE-DB never gets accessed to do any actual latency-critical work, it will function as the archival DB where space and uptime are both large.
The script performs a few house-keeping tasks on NET and NET-DB. After a given number of days on the server, the music is considered stale and deleted. NET-DB is updated to reflect this. Additionally, an Mp3 scan constantly checks for fmatch-failures against NET-DB and deletes bogus entries as it finds them.
The code is downloadable here:
Next: Installing PHPbb3 on CrystalTech servers