You are not logged in.

  • Index
  •  » Django
  •  » What's the typical memory footprint size for Django?

#1 2007-07-24 00:09:09

Catalyst
Member
Registered: 2007-07-23
Posts: 4

What's the typical memory footprint size for Django?

I've been running into a few issues with the amount of memory Django is using.

I've only set up a few basic apps, like the poll from the djangoproject.com tutorial and the Now time tutorial from djangobook.com, plus the admin.

With just these three things going Django is taking up about 38 megabytes of memory, my limit on WebFaction is 40.

Because of the amount of memory these applications were taking up, I ran through the information here and tried to optimize Django so it wouldn't take up as much, but it doesn't seem to get the memory footprint size down to a safe margin below the 40 limit.

http://blog.webfaction.com/tips-to-keep … usage-down

Make sure that you set DEBUG to False in settings.py: Did this.

Use "ServerLimit" in your apache config: This is set to 2.

Use "stop/start" instead of "restart" when you want to free all the memory: Did this, it helps and then I start accessing my Django apps again and everything goes right back up to what it was.

Check that no big objects are being loaded in memory: Nothing I could see here.

Serve your static data from our main server: Configured this.

Use "MaxRequestsPerChild" in your apache config: Set this to 100.

Find out and understand how much memory you're using: Did this, after I start accessing my Django apps, it shoots up to around 36/38 megabytes.

So what's the deal? My Web site isn't even open to the public right now, I'm barely playing around with the apps, but this puppy is chewing through memory like there's no tomorrow.

How much memory does Django typically need to run apps and actually receive traffic from the outside?

Am I missing something in my configuration?

Any help or advice you guys can offer would be much appreciated.

Slowly trying to unbecome a Django n00b. ;-)

Last edited by Catalyst (2007-07-24 00:10:12)

Offline

 

#2 2007-07-24 09:36:29

remi
Member
From: London
Registered: 2006-09-19
Posts: 741
Website

Re: What's the typical memory footprint size for Django?

A simple "Hello world" site seems to use around 28MB so you're not much over that ...
I'm not sure if you can reduce it much more apart from checking which objects you load in memory (list of objects) and check if any of them is quite big.

Cheers,

Remi.


WebFaction - Smarter web hosting

Offline

 

#3 2007-07-24 10:30:43

Catalyst
Member
Registered: 2007-07-23
Posts: 4

Re: What's the typical memory footprint size for Django?

Hey Remi, thanks for the quick response.

Do you think that if I went with your shared hosting plan 2, which offers 80 megabytes, that I could run a few more Django apps and open my Web site to the public and get a fair amount of traffic?

Or should I just go to shared hosting 3 and get 120 megabytes of memory?

I'm trying to find the sweet spot for memory usage for Django, what most users experience as far as memory they need.

Thanks again for your help.

Last edited by Catalyst (2007-07-24 10:31:25)

Offline

 

#4 2007-07-24 10:51:19

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: What's the typical memory footprint size for Django?

If you set ServerLimit to 1 in your httpd.conf you should be able to deploy 3 Django projects on a shared 1 plan. If you can tell me how many Django projects you'd like to deploy and how (Value of DEBUG in settings.py and ServerLimit in httpd.conf, for example.) and any special requirements that you may have (memcached, for example.) we'll be able to point you in the right direction. smile


-David Sissitka

Offline

 

#5 2007-09-25 08:29:44

ickmund
Member
Registered: 2007-09-23
Posts: 4

Re: What's the typical memory footprint size for Django?

Sorry for the necromancy here, but I thought it would be better then a new thread.

On a Shared 1 plan, with a fairly simple app (product listing, no cart or anything), with static media served by apache directly, I should be able to have a ServerLimit at 3? Opening the app in the browser, without further interaction, the process jumps to 13MB. So with some interaction, I guess it would go further up, and with 3 users at the same time, it would top 40MB.

However, on average, the load will be much lower. So I guess my question is wether 40MB is a hard limit or average over time?

Furthermore, a more technical Django question: My httpd-processes dosen't go back to their initial idle state at 2 something MB after I have accessed the site. They stay at 13MB or so until I stop/start apache. Is there something I've missed in my configuration?

//Magnus

Offline

 

#6 2007-09-25 08:34:54

IAIHMB
Member
From: Hudson, Florida.
Registered: 2006-09-19
Posts: 1362

Re: What's the typical memory footprint size for Django?

Hello Magnus,

ickmund wrote:

However, on average, the load will be much lower. So I guess my question is wether 40MB is a hard limit or average over time?

It's a hard limit.

ickmund wrote:

Furthermore, a more technical Django question: My httpd-processes dosen't go back to their initial idle state at 2 something MB after I have accessed the site. They stay at 13MB or so until I stop/start apache. Is there something I've missed in my configuration?

That's normal, after your first request your instance of Apache's memory usage should jump and then stabilize. smile


-David Sissitka

Offline

 

#7 2007-10-04 12:28:09

rbolt
Member
From: San Diego, CA
Registered: 2007-05-04
Posts: 4
Website

Re: What's the typical memory footprint size for Django?

I set server limit to be one for my Django app not long ago, and it's still nice and responsive and fast and now way under the memory usage limit...

Offline

 
  • Index
  •  » Django
  •  » What's the typical memory footprint size for Django?

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson