Re: shared memory

[prev] [thread] [next] [Date index for 2005/03/15]

From: Martin Moss
Subject: Re: shared memory
Date: 17:47 on 15 Mar 2005
--- André Warnier <aw@xxxxxx.xxx> wrote:
> Jonathan Vanasco wrote:
> > 
> > look into memcached -- http://danga.com/memcached/
> 
> Thank you for the link, I didn't know that module,
> and I'll keep it in 
> mind for some other projects.
> But it is slightly off the mark as far as the issue
> below is concerned.
> Maybe it was my mentioning "data in tables" that was
> confusing.  My 
> problem is not to speed up database access, it is to
> share data (stored 
> in memory tables, or say arrays) between Apache
> children/threads.
> 

I haven't used Memchache yet, but it has nothing to do
with databases....
It CAN be used to prevent database load, OR it could
be used to prevent too much access to flocking
files...
Consider the Example at the top of that link

sub get_foo_object {
   my $foo_id = int(shift);
   my $obj = $::MemCache->get("foo:$foo_id");
   return $obj if $obj;

   $obj = $::db->selectrow_hashref("SELECT .... FROM
foo f, bar b ".
                                   "WHERE ... AND
f.fooid=$foo_id");
   $::MemCache->set("foo:$foo_id", $obj);
   return $obj;
}


your subroutine would be

sub get_foo_object {
   my $foo_id = int(shift);
   my $obj = $::MemCache->get("foo:$foo_id");
   return $obj if $obj;

   #####
   #get $obj from your flocked file mechanism that you
are already using.......
    ##########
   
    $obj=get_from flockfiles($foo_id)


   $::MemCache->set("foo:$foo_id", $obj);

    return $obj;
}

It depends on how you've implemented the existing
mechanism I guess.... The above seems expect
instantiated Objects...

Personally I'm curious as to why you don't want to use
a database....

Regards

Marty


Send instant messages to your online friends http://uk.messenger.yahoo.com 

(message missing)

shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 16:35 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 16:37 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 17:07 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 22:53 on 15 Mar 2005

Re: shared memory
Martin Moss 17:47 on 15 Mar 2005

Re: shared memory
Perrin Harkins 18:04 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 19:11 on 15 Mar 2005

Re: shared memory
Perrin Harkins 19:48 on 15 Mar 2005

Re: shared memory
Dan Sully 19:53 on 15 Mar 2005

Re: shared memory
jonathan vanasco 00:30 on 17 Mar 2005

Re: shared memory
Jonathan Vanasco 20:05 on 15 Mar 2005

Re: shared memory
Perrin Harkins 20:14 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 22:26 on 15 Mar 2005

Re: shared memory
Perrin Harkins 22:31 on 15 Mar 2005

Re: shared memory
=?ISO-8859-1?Q?Andr=E9_Warnier?= 23:26 on 15 Mar 2005

Re: shared memory
Jonathan Vanasco 23:40 on 15 Mar 2005

Re: shared memory
Eric Wilhelm 23:50 on 15 Mar 2005

Re: shared memory
Perrin Harkins 00:29 on 16 Mar 2005

Re: shared memory
Scott Gifford 03:29 on 16 Mar 2005

Re: shared memory
William McKee 14:36 on 18 Mar 2005

Re: shared memory
Perrin Harkins 00:30 on 16 Mar 2005

Re: shared memory
jonathan vanasco 00:40 on 16 Mar 2005

Re: shared memory
Perrin Harkins 00:50 on 16 Mar 2005

Re: shared memory
Ofer Nave 01:20 on 16 Mar 2005

Re: shared memory
jonathan vanasco 01:56 on 16 Mar 2005

Re: shared memory
Perrin Harkins 01:06 on 17 Mar 2005

Generated at 16:59 on 18 Mar 2005 by mariachi v0.52