Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Loading to Memory

Reply
Thread Tools

Loading to Memory

 
 
hillgoogle@charter.net
Guest
Posts: n/a
 
      08-24-2011
On my unix box I want to load some data into memory using one program
and then retrieve it using another.

Anyone have any examples of how I can load that to my unix machine
memory?

Mike
 
Reply With Quote
 
 
 
 
Michael Vilain
Guest
Posts: n/a
 
      08-24-2011
In article
<(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> On my unix box I want to load some data into memory using one program
> and then retrieve it using another.
>
> Anyone have any examples of how I can load that to my unix machine
> memory?
>
> Mike


In Unix, you have to create a shared region of memory and coordinate
access to it somehow. Oracle does this with their SGA. There may be a
way to do this using a CPAN module but it all depends on how much memory
you're talking about. Oracle requires special OS configuration, at
least on Solaris, to allow the OS to permit an application to allocate
shared memory in the GB range. Don't know how you'd do this in Linux.
How you coordinate access the the shared memory once it's created is
something you'll have to work out. This is a rather advanced
programming topic. You'll have to do a lot of reading and trial coding
to get something you want. Perl may not be the best tool for this.

The modules I got when I searched the CPAN library span are for using
shared memory for persistence between sessions. Not really what you're
looking for since it's being used to implement sessions.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]


 
Reply With Quote
 
 
 
 
JŘrgen Exner
Guest
Posts: n/a
 
      08-24-2011
(E-Mail Removed) wrote:
>On my unix box I want to load some data into memory using one program
>and then retrieve it using another.
>
>Anyone have any examples of how I can load that to my unix machine
>memory?


Just an idea: you may want to search for IPC (interprocess
communication) using shared memory. Maybe this will get you some
pointers.

jue
 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      08-25-2011
On 2011-08-25 00:49, (E-Mail Removed) wrote:

> On my unix box I want to load some data into memory using one program
> and then retrieve it using another.
>
> Anyone have any examples of how I can load that to my unix machine
> memory?


What do you need to do exactly? Any good OS cleverly caches the file
system, so maybe you can just use a file?

--
Ruud
 
Reply With Quote
 
Tobias Nissen
Guest
Posts: n/a
 
      08-25-2011
(E-Mail Removed) wrote:
> On my unix box I want to load some data into memory using one program
> and then retrieve it using another.
>
> Anyone have any examples of how I can load that to my unix machine
> memory?


You're not very clear about what problem you are trying to solve. In
this generality I'd suggest using a key-value store like memcached┬╣ or
redis┬▓. Both have packages available on all major Linux/Unix
distributions and are pretty easy to set up and use.

┬╣ http://memcached.org/
http://search.cpan.org/~mdorman/Memc...ched/Client.pm
┬▓ http://redis.io/
http://search.cpan.org/~melo/Redis-1.904/lib/Redis.pm

 
Reply With Quote
 
hillgoogle@charter.net
Guest
Posts: n/a
 
      08-25-2011
Thanks all. Specifically, I'm looking at getting output from Memory
instaed of a DB because memory is volatile and I it read it faster.
So ... I would insert data from my DB (mysql) and then my app would
read data NOT from the DB, but the memory. Right, when the machine
went down I would re-load to memory, or when I had updates from the
DB.

@Tobias ... I'll look at those links, ty!

@Others ... Anything else?

TY, Mike
 
Reply With Quote
 
Tobias Nissen
Guest
Posts: n/a
 
      08-26-2011
(E-Mail Removed) wrote:
> Thanks all. Specifically, I'm looking at getting output from Memory
> instaed of a DB because memory is volatile and I it read it faster.
> So ... I would insert data from my DB (mysql) and then my app would
> read data NOT from the DB, but the memory. Right, when the machine
> went down I would re-load to memory, or when I had updates from the
> DB.


That's one of the use cases of memcached. However, when using memcached
one tries to take the burden of the DB not only because of the "memory
is faster" argument, but also to avoid doing the same computations over
and over again. Using memcached requires changes to your source code
and in most cases program structure.

If you just want quick access and don't have complex computations to
do, just upgrading your RAM could be enough. Modern DBs are doing
their own caching (in memory) and they are doing it well.
 
Reply With Quote
 
Ted Zlatanov
Guest
Posts: n/a
 
      08-26-2011
On Thu, 25 Aug 2011 15:31:55 -0700 (PDT) (E-Mail Removed) wrote:

h> Thanks all. Specifically, I'm looking at getting output from Memory
h> instaed of a DB because memory is volatile and I it read it faster.
h> So ... I would insert data from my DB (mysql) and then my app would
h> read data NOT from the DB, but the memory. Right, when the machine
h> went down I would re-load to memory, or when I had updates from the
h> DB.

h> @Tobias ... I'll look at those links, ty!

h> @Others ... Anything else?

As Tobias suggested memcached is your best bet today IMHO. It's
extremely easy to install, configure, use locally and remotely, and
understand. I've used it in production with 16GB of memory allocated to
it (specialized status monitoring application) and it has performed
flawlessly *without a restart*, no memory leaks or any other issues for
almost a year or continuous usage.

Ted
 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      08-27-2011
On 2011-08-25 00:49, (E-Mail Removed) wrote:

> On my unix box I want to load some data into memory using one program
> and then retrieve it using another.
>
> Anyone have any examples of how I can load that to my unix machine
> memory?


Check out CHI, which is in the Task::Kensho list.

http://search.cpan.org/perldoc?CHI
http://search.cpan.org/perldoc?Task::Kensho

--
Ruud

 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-27-2011
On Thu, 2011-08-25, (E-Mail Removed) wrote:
> Thanks all. Specifically, I'm looking at getting output from Memory
> instaed of a DB because memory is volatile and I it read it faster.
> So ... I would insert data from my DB (mysql) and then my app would
> read data NOT from the DB, but the memory. Right, when the machine
> went down I would re-load to memory, or when I had updates from the
> DB.


All of that is the job of the database software (and it might delegate
that work to the OS, which caches disk accesses in memory).

If you have nothing better to do, and you know that in a few seconds
you will want to access some part of the database, it *might* make
sense to do "dummy reads" from the database, or perhaps a
"cat the_database_file >/dev/null". Or it might not.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
order of iframe loading with document loading ofir Javascript 0 12-03-2007 12:06 PM
loading image -> detect when image is done loading edfialk Javascript 0 05-10-2007 07:28 PM
[OT] Is loading the second Java application faster than loading the first? David Segall Java 2 01-02-2007 04:41 PM
Image loading using javascript. Handling timeouts and parrallel loading under IE zborisau@gmail.com Javascript 4 08-28-2005 02:02 PM
Differences between Sony Memory Stick & memory Stick Pro vs Memory Stick Duo? zxcvar Digital Photography 3 11-28-2004 10:48 PM



Advertisments