books
Free Books / Computers / Practical mod_perl /

previous page: 14.1.1.1. Potential drawbacks of memory-sharing restrictions
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 14.1.3. Defining the Maximum Unshared Memory Size Threshold

14.1.2. Defining the Maximum Memory Size Threshold




Description

This section is from the "Practical mod_perl" book, by Stas Bekman and Eric Cholet. Also available from Amazon: Practical mod_perl

No less important than maximizing shared memory is restricting the absolute size of the processes. If the processes grow after each request, and if nothing restricts them from growing, you can easily run out of memory.

Again you can set the MaxRequestsPerChild directive to kill the processes after a few requests have been served. But as we explained in the previous section, this solution is not as good as one that monitors the process size and kills it only when some limit is reached.

If you have Apache::GTopLimit (described in the previous section), you can limit a process's memory usage by setting the $Apache::GTopLimit::MAX_PROCESS_SIZE directive. For example, if you want processes to be killed when they reach 10 MB, you should put the following in your startup.pl file:

$Apache::GTopLimit::MAX_PROCESS_SIZE = 10240;

Just as when limiting shared memory, you can set a limit for the current process using the set_max_size( ) method in your code:

use Apache::GTopLimit;
Apache::GTopLimit->set_max_size(10000);

For Apache::SizeLimit, the equivalents are:

use Apache::SizeLimit;
$Apache::SizeLimit::MAX_PROCESS_SIZE = 10240;

and:

use Apache::SizeLimit;
Apache::SizeLimit->setmax(10240);

 

Continue to:

  • prev: 14.1.1.1. Potential drawbacks of memory-sharing restrictions
  • Table of Contents
  • next: 14.1.3. Defining the Maximum Unshared Memory Size Threshold

Books by Stas Bekman:















TOP
previous page: 14.1.1.1. Potential drawbacks of memory-sharing restrictions
  
page up: Practical mod_perl | by Stas Bekman and Eric Cholet
  
next page: 14.1.3. Defining the Maximum Unshared Memory Size Threshold

Topics

  • Animals
  • Architecture
  • Arts
  • Business
  • Computers
  • Crafts
  • Fairy Tales
  • Finance
  • Flora and Plants
  • Cooking
  • Gardening
  • Health and Healing
  • History
  • Home Improvements
  • Languages
  • New Age
  • Novels
  • Real Estate
  • Reference
  • Religion
  • Science
  • Society
  • Sports
  • Travel
  • Outdoors


Search

My Books

Headaches Begone! A Systemic Approach To Healing Your Headaches
Don't Let Your Bike Seat Ruin Your Sex Life Book

Discover

  • Answers FAQ

[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007-2021 StasoSphere.com