Glen Koundry wrote:
I have a few small, frequently accessed database tables and my goals are:
a. Fast access. Which is why I want to have the data loaded in memory.
I agree, these tables should be loaded into memory. However storing them into
$Session / $Application loads them onto disk. I would recommend populating
these tables in global.asa Script_OnStart to a global hash like %FAST_DATA,
and if your process serves enough requests, then there will be performance benefits
realized.
b. Easy access. Having the tables stored in a hash is much more convenient than getting it via DBI or DBM.
I agree.
c. Access from all sessions. As far as I can tell storing the data in the
$Application object is the only way to do this.
Try the global hash approach. If you want this to be really fast, but read-only,
then you can populate it when global.asa is compiled, outside an event, and then
use Apache::ASP->Loader() to precompile your web application. For more on this
topic, please see:
http://www.apache-asp.org/tuning.html#Precompile%20Sfb36ef6e
Note that this approach would populate the data once when the server is
starting up, so the data is read only. Updates to these tables would
require that the web server be restarted ( which is fine for many applications ).
Another approach would be to use CacheDB, and then use $Response->Include({ Cache => 1
})
to cache this data for your use. This was you could leave the StateDB to the
faster SDBM_File, and use a CacheDB setting of DB_File for your larger data sets.
The caching API is nice because you can cause it to expire, thus allowing a
per server refresh without having to restart the web server.
Regards,
Josh
________________________________________________________________________
Josh Chamas, Founder | NodeWorks - http://www.nodeworks.com
Chamas Enterprises Inc. | NodeWorks Directory - http://dir.nodeworks.com
http://www.chamas.com | Apache::ASP - http://www.apache-asp.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]