Wow! So Python will eat RAM until restarted? That changes the way I am
thinking about this problem.

So the trick will be tweaking the number of processes and the number of
requests allowed between a restart. I know one item requests a big chunk of
memory is dynamic PDF generation.

So lets say this is the real RAM pig and eats up 80mb. If I've got 3
processes that could account for 240mb on it's own which you say will never
get given back? However - it should never exceed this as once grabbed that
RAM will be available to my app.

Even caching won't reduce this as there is always the possibility on all
three processes being hit at the same time with nothing in the cache.

So my memory usage will always statistically converge on:
(Amount of RAM used by most expensive request) x (Maximum simultaneous
Django processes)

and nothing I do with within Django itself can reduce this.

Does that sounds about right?

Andy

On Wed, Apr 8, 2009 at 1:31 AM, Malcolm Tredinnick <malc...@pointy-stick.com
> wrote:

>
> On Tue, 2009-04-07 at 15:20 -0700, andybak wrote:
> > I've got no really huge tables - the entire db is under 6meg and the
> > site isn't even public yet so traffic is minimal. Memory just doesn't
> > seem to go down. (until the process get's restarted by maxchild or by
> > me killing it).
>
> That's completely normal behaviour for Unix-like memory management. Once
> memory is freed, it is returned to the process for later reuse (so a
> subsequent malloc() call by that process will reuse memory that is had
> earlier freed). This helps avoid some causes of memory fragmentation and
> allows for contiguous large blocks to be malloc-ed by other processes.
>
> It's also precisely why long running processes are often designed to
> have their memory using portions restart periodically. It's the act of
> exiting the process at the system level which returns the memory to the
> system pool.
>
> Regards,
> Malcolm
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to