Hi,

>From: Chas. Owens [mailto:chas.ow...@gmail.com] 
>Sent: Monday, April 04, 2011 6:40 AM

>My bet is you don't have enough RAM to hold all of that data; your OS
>is being forced to use swap.  Your poor machine is so swamped it is
>taking that long to get back to normal.

>Each key in your hash is probably taking up around fifteen bytes and
>each value is probably around four bytes (if not eight).  You have
>165,000,006 entries.  That means you need around 3 gigabytes of RAM
>for the data alone.  That doesn't count the hash that holds the data,
>perl itself, or any other programs you may be running.


You have a good point. I could not think of anything else, and suspected it 
might be the cause.

But: The servers that I have tested have light load and have large memory (at 
least 10 times more than the process that I ran would need). I choose those 
numbers to simulate memory use similar to my real process. Since "top" command 
on Linux almost always shows "used" value that nearly match the "total" and 
Linux like to use any spare memory to cache disk blocks, I can hardly tell. 
"free -m " did show that less than half of the total memory is used. So I don't 
believe the server is swamped. 




Thanks








-----Original Message-----
From: Chas. Owens [mailto:chas.ow...@gmail.com] 
Sent: Monday, April 04, 2011 6:40 AM
To: TAO, NENGBING [AG/1005]
Cc: beginners-digest-h...@perl.org; beginners@perl.org
Subject: Re: Excessive wait time after fork

On Sat, Apr 2, 2011 at 12:06, TAO, NENGBING [AG/1005]
<nengbing....@monsanto.com> wrote:
> Hi,
>
>        I noticed that after fork, the wait time is excessive (my other
> test waited for hours). Is this a known problem, how to get around it?
snip
> child 3 AFTER  sub call :Sat Apr  2 10:45:01 2011 numKeys:4000001
> child 4 BEFORE sub call : Sat Apr  2 10:44:54 2011
> child 4 AFTER  sub call :Sat Apr  2 10:45:04 2011 numKeys:5000001
> child 5 BEFORE sub call : Sat Apr  2 10:44:54 2011
> child 5 AFTER  sub call :Sat Apr  2 10:45:06 2011 numKeys:6000001
> child 1 BEFORE sub call : Sat Apr  2 10:44:54 2011
> child 1 AFTER  sub call :Sat Apr  2 10:45:41 2011 numKeys:20000001
> child 2 BEFORE sub call : Sat Apr  2 10:44:54 2011
> child 2 AFTER  sub call :Sat Apr  2 10:45:56 2011 numKeys:30000001
> child 0 BEFORE sub call : Sat Apr  2 10:44:54 2011
> child 0 AFTER  sub call :Sat Apr  2 10:48:45 2011 numKeys:100000001   #
snip

My bet is you don't have enough RAM to hold all of that data; your OS
is being forced to use swap.  Your poor machine is so swamped it is
taking that long to get back to normal.

Each key in your hash is probably taking up around fifteen bytes and
each value is probably around four bytes (if not eight).  You have
165,000,006 entries.  That means you need around 3 gigabytes of RAM
for the data alone.  That doesn't count the hash that holds the data,
perl itself, or any other programs you may be running.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
This e-mail message may contain privileged and/or confidential information, and 
is intended to be received only by persons entitled
to receive such information. If you have received this e-mail in error, please 
notify the sender immediately. Please delete it and
all attachments from any servers, hard drives or any other media. Other use of 
this e-mail by you is strictly prohibited.

All e-mails and attachments sent and received are subject to monitoring, 
reading and archival by Monsanto, including its
subsidiaries. The recipient of this e-mail is solely responsible for checking 
for the presence of "Viruses" or other "Malware".
Monsanto, along with its subsidiaries, accepts no liability for any damage 
caused by any such code transmitted by or accompanying
this e-mail or any attachment.


The information contained in this email may be subject to the export control 
laws and regulations of the United States, potentially
including but not limited to the Export Administration Regulations (EAR) and 
sanctions regulations issued by the U.S. Department of
Treasury, Office of Foreign Asset Controls (OFAC).  As a recipient of this 
information you are obligated to comply with all
applicable U.S. export laws and regulations.

Reply via email to