[vworld-tech] Database usage
Brian Hook
hook_l at pyrogon.com
Tue Feb 10 10:53:46 PST 2004
> Either is good, amazingly large/complex web sites are run straight
> out of a db (with a cache layer for common elements).
Right, there was a "database is God" thread on Mud-dev a while ago on
this subject, but my gut instinct is that hammering the DB for every
object access would be bad with, say, 1000 players connected, but
since I don't have the ability to connect 1000 players and measure the
results, I'd be curious if others that are doing "database is God"
schemes are having okay performance.
> If your memory footprint can be huge, consider a serialization
> method so objects can 'save themselves' and only hit the db on
> instantiation/disposal.
Yeah, memory usage is up to physical limit of the machine (2GB right
now, but easily expanded if we need to go to 64-bit). The cache is a
real basic unbounded one, a la:
function Room.get( room_id )
{
if Room.rooms[ room_id ] ~= nil then
return Room.rooms[ room_id ];
end
Room.rooms[ room_id = TRAP_load_room( room_id )
return Room.rooms[ room_id ]
}
So first time use will hit the DB. I store very few instances in the
DB, the only thing persisted are players and their contents.
Everything else is cleared and reset on a server restart.
At the limit the cache will hold the entire DB in memory, which may or
may not be a problem (I haven't had a chance to sit down and work out
the typical memory footprint for a room, item, mob, etc.).
Thanks,
Brian
More information about the vworld-tech
mailing list