[Tilesathome] Distributing tiles at home server chores?
Frederik Ramm
frederik at remote.org
Thu May 17 23:52:54 BST 2007
Hi,
prepare for a solid round of backseat driving ;-)
The dev server cannot cope with running the tiles at home server. I don't
know why exactly that is. Let's summarize what the tiles at home server does:
A. Managing the re-render queue
A1. accepting re-render requests
A2. handing them out to clients
A3. watching whether they really get completed
B. Accepting tile uploads
B1. unzip files being delivered
B2. sort them into the filesystem, update metadata MySQL
C. Serving tiles to web browsers
C1. serving through Apache from file system
C2. serving through 404 handler script (if Apache doesn't find the file,
do a database lookup)
D. Statistics and cleanup jobs
Tasks "A" and "D" are negligible; "A" could conceivably be run on a
totally different server with only little overhead, but it probably
isn't even worth the effort to outsource it as the request queue only
receives and dispatches one request every five seconds (on average).
"B" is very i/o intensive. There is considerable potential for
optimising the code, but still "B" will have to create thousands of
files on the hard disk for every tileset uploaded, and in addition write
stuff to the database. The load doesn't become smaller if we consider
that numerous processes do "B" at the same time, needlessly vying for
resources.
"C" has massively improved since tiles are on the hard disk as opposed
to in a BLOB in MySQL. I assume, but cannot prove, that "C" is only slow
because there's so much "B" going on.
So in my eyes, "B" is the main culprit.
Unless we manage to drastically optimise the software at this point, we
should think about distributing "B" to more than one server. How could
this be done?
I could imagine that tiles could be distributed in a "striped" fashion -
one server takes all level-12 tiles where x mod 3=0, one those with x
mod 3=1, and one those with x mod 3=2 and so on. But how would a slippy
map then load tiles from these servers? It could be done via a proxy,
but it will probably be difficult to configure an Apache or Squid with
the rules required to find the right server of origin for a tile:
* if z==12 compute x mod 3 and select server 0,1,or 2
* if z>12 compute relevant level-12 tile x coordinate (x/2**(z-12)) mod
3 and select server 0,1,or 2
* z<12 - special case, probably only have one server with all these tiles
Any thoughts?
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00.09' E008°23.33'
More information about the Tilesathome
mailing list