[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Load Testing cgiapp



Dan Horne wrote:
>>The question stands though - is there a way to "cache" the query 
>>information for all users?  Example: the app can be called from 
>>3 different domains, and using the domain information, load 3 
>>different sets of information and store them for every request 
>>(changes every 15 minutes).  Does anything do this?  It's built 
>>in to some application servers (like ColdFusion - which has lots 
>>of faults, but does cache data in memory for all users very well).
> 
> 
> Well, you could use one of the Cached::* modules and do something like
> (untested):
> 
> sub complex_query {
>     my $self = shift;
>     my @args = @_;
>     my $key = 'complex_query:' . join(',' @args);
> 
>     my $cache = new Cache::FileCache( );
>     my $rs    = $cache->get($key);
>     return $rs if defined($rs);
> 	
>     my $statement = 'select ....';
>     $rs = $self->dbh->selectall_arrayref($statement, \%attr, @args);
>     $cache->set($key, $rs, "10 minutes");
>     return $rs;
> }

But you'll really need to benchmark stuff like this. Maintaining a separate
cache, especially in a non-persistant environment can have some heavy overhead
(especially using a file based cache system). Most databases are very, very fast
for simple primary key select statements. It all depends on how complicated the
queries are, how much effort it takes to transform the data and how often the
data changes.

-- 
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.