Re: is 40 MB RAM enough?

2007-08-28 Thread Iapain

> could you run it and check the output.

14.28 MB


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Kenneth Gonsalves


On 27-Aug-07, at 8:18 PM, Iapain wrote:

>> what is your RAM usage? How did you tweak apache to achieve that?
>
> I didnt check RAM usage, but site always work like express instead i
> did clean coding and tried to optimize my code.

this is the command that webfaction uses to check RAM usage:

  "ps -u yourusername -o rss,pid,command"

could you run it and check the output. Apparently they run this  
command now and then, and if it shows over 40 MB, you get a notice  
from them.


-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Iapain

> what is your RAM usage? How did you tweak apache to achieve that?

I didnt check RAM usage, but site always work like express instead i
did clean coding and tried to optimize my code.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Kenneth Gonsalves


On 27-Aug-07, at 4:07 PM, Graham Dumpleton wrote:

>> in for more RAM?
>
> BTW, have you also made sure you have read:
>
>   http://blog.webfaction.com/tips-to-keep-your-django-mod-python- 
> memory-usage-down

yes

>
> Maybe your size problems are due to not turning debug off.

it's off

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Kenneth Gonsalves


On 27-Aug-07, at 3:05 PM, Iapain wrote:

> Yes it is, I am running a huge site on webfaction 40 MB, performance
> wise its excellent.

what is your RAM usage? How did you tweak apache to achieve that?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Graham Dumpleton

On Aug 27, 12:57 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a site on WebFaction with 40 MB RAM. It is a very small site
> in the sense that it is used for administering an organisation, so
> would have just 2-3 users at a time, mainly doing admin stuff. The
> only load is when pdf reports are being generated. Leaving apache
> untweaked, the RAM usage shoots up - well over the 40 MB limit. I set
> MaxRequestsPerChild to 3. Even then, the limit gets crossed pretty
> fast. The question is: do I go on trying to tweak Apache? Or do I go
> in for more RAM?

BTW, have you also made sure you have read:

  
http://blog.webfaction.com/tips-to-keep-your-django-mod-python-memory-usage-down

Maybe your size problems are due to not turning debug off.

Graham


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Iapain

Yes it is, I am running a huge site on webfaction 40 MB, performance
wise its excellent.


On Aug 27, 7:57 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a site on WebFaction with 40 MB RAM. It is a very small site
> in the sense that it is used for administering an organisation, so
> would have just 2-3 users at a time, mainly doing admin stuff. The
> only load is when pdf reports are being generated. Leaving apache
> untweaked, the RAM usage shoots up - well over the 40 MB limit. I set
> MaxRequestsPerChild to 3. Even then, the limit gets crossed pretty
> fast. The question is: do I go on trying to tweak Apache? Or do I go
> in for more RAM?
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: is 40 MB RAM enough?

2007-08-27 Thread Graham Dumpleton

On Aug 27, 4:47 pm, Paul Rauch <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Kenneth Gonsalves schrieb:> Hi,
>
> > I have a site on WebFaction with 40 MB RAM. It is a very small site
> > in the sense that it is used for administering an organisation, so
> > would have just 2-3 users at a time, mainly doing admin stuff. The
> > only load is when pdf reports are being generated. Leaving apache
> > untweaked, the RAM usage shoots up - well over the 40 MB limit. I set
> > MaxRequestsPerChild to 3. Even then, the limit gets crossed pretty
> > fast. The question is: do I go on trying to tweak Apache? Or do I go
> > in for more RAM?
>
> you might want to try another webserver,
> maybe lighttpd and then run django as fastcgi.
> at least its said to be more performant.
>
> http://www.djangoproject.com/documentation/fastcgi/

In terms of memory consumed, in practice using fastcgi wouldn't make
that much difference. This is because by far the bulk of memory used
is by the Django application itself.

If the increase in memory is due principally to the PDF generation,
and the incidence of PDF generation is low, they would be better off
factoring out the PDF generation into a separate script if they can,
which is then executed from the Django application using os.system or
the popen modules. This will match better with how WebFaction
calculates memory usage, as they only have a problem with long running
processes over the 40MB limit if I remember correctly. By factoring it
out into a script, the memory consuming process is then ephemeral and
memory only gets consumed for a short time. As a result, it wouldn't
matter if for that short time it goes over 40MB in size. Obviously if
the one script is consuming absolute huge amounts of memory, then they
may have an issue.

The only other solution which may work within the bounds of
WebFaction's memory limits is to use mod_wsgi with Apache instead of
mod_python. If you have a 4 process limit on long running processes,
ensure you are using 'worker' MPM in Apache and limit the number of
Apache child processes to 2. Then use mod_wsgi daemon mode to have one
daemon process with many threads which runs your Django instance. Also
create a second daemon process with mod_wsgi and delegate only the
subset of URLs from your Django application which generate the PDFs to
this second daemon process.

In other words, one daemon process is used to run all parts of the
application except for the URLs which do the PDF generation. These
URLs are instead delegated to run in a distinct daemon process.
Because the PDF daemon process isn't handling all URLs for the
application, it will not accumulate any cached modules and data
related to the URLs not being handled, thus the base memory should be
less for that process. This will give you greater headroom for the
memory consuming PDF operations. Because the PDF URLs are in a
separate daemon process, one can also set a small value for maximum
number of requests for that process to keep restoring memory usage
back to a low level in case there is memory usage creep.

By using daemon mode of mod_wsgi you have also moved the Python
application out of the main Apache child processes and thus those
process will be smaller and as a result may handle static file
requests better.

Because mod_wsgi gives you these more flexible means of delegating
what runs in what processes, it will be interesting if this might
affect in the future, when mod_wsgi starts to be adopted more, how
WebFaction determines how much memory you use. For example, if you can
restrict Apache to using 2 child process to handle static files and
for proxying to the daemon processes, with these process then being
small, eg < 10MB, one could possibly argue that you should be allowed
a greater memory limit for the daemon process running the Python
application. Ie., instead of allow 4 * 40MB process, why not allow 2 *
20MB + 2 * 60MB processes. That is calculate it across all processes
as a combined total rather than put a maximum on the size of any one
process.

BTW, choosing one system over another based on perceived performance
is not a good idea. The differences in performance between mod_python,
mod_wsgi or fastcgi solutions get totally swallowed up as soon as you
load on a big Django application, especially one that uses a database,
as the bottleneck is then elsewhere. You are therefore better off
choosing a solution based on ease of configuration and management and
for the options it has for controlling memory usage and security.

Graham



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en

Re: is 40 MB RAM enough?

2007-08-27 Thread Paul Rauch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Kenneth Gonsalves schrieb:
> Hi,
> 
> I have a site on WebFaction with 40 MB RAM. It is a very small site  
> in the sense that it is used for administering an organisation, so  
> would have just 2-3 users at a time, mainly doing admin stuff. The  
> only load is when pdf reports are being generated. Leaving apache  
> untweaked, the RAM usage shoots up - well over the 40 MB limit. I set  
> MaxRequestsPerChild to 3. Even then, the limit gets crossed pretty  
> fast. The question is: do I go on trying to tweak Apache? Or do I go  
> in for more RAM?
you might want to try another webserver,
maybe lighttpd and then run django as fastcgi.
at least its said to be more performant.

http://www.djangoproject.com/documentation/fastcgi/

greetz Paul Rauch
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iQIVAwUBRtJziBG67lyyQrltAQJ+hxAAi0lv+SXvEtsVT8jPodvjNd6wQ5aXK0Ko
tIe4D6vZZo79Ybo/hQbCX3yaVszQF4pD0uNNoLlJ6u9iFq7YD/KlgIqUb/I88qAg
tNr4SzvslgdDUzU0a87208NKwvb6dkfhCyao6BfMeSEMIjUmuzmDJ3p808ms0reO
2Eued66vg1yMwb8aGxsdxkDb3qrBF3gLN4K3VKSGoCKtsSFVMs82zgCSzyC+zXrG
zFTqQKxJp78zwx/G6dZS+29sDhDXVRKXWh31+WrYnbZzrj88bq1I8TGWvap70bqa
hmR4weVZ/4aP4WZthEs6oGW83VrmoltG2/1il5OyXrLMifH00uyBs+Jffj8VO1jf
4wpvO4IMG25kYjJx4RLV37jb/D1nyw2OEdzF8Pg1rnzqf7XTREy3cAAlLyb0vUHD
c0PLeOW/dy1UfpWcuA5zNoRiOTi7xUlX5BTZB0Z1ypHG2SAO7WHnhlRHZhUICOPz
uebgqMGEFMQczD/QEQiAmTdi4QyiBQd6ltP+wXS83H7oS+OHpazxjXKFMZ2067DK
owJbyNfZZ2vFE6mUpxGap+jre8AVn6JxHWVPlEfTgIOxJ4kSk8Y1fK1T+vEAXNTT
Rqn2wEqS0lu/LIg6GQCemQ4ikZNX0Om1DQHXrzt3dKQyC/bFvCALToavgyKx3KeY
7E2Mu828F+A=
=SCSn
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



is 40 MB RAM enough?

2007-08-26 Thread Kenneth Gonsalves

Hi,

I have a site on WebFaction with 40 MB RAM. It is a very small site  
in the sense that it is used for administering an organisation, so  
would have just 2-3 users at a time, mainly doing admin stuff. The  
only load is when pdf reports are being generated. Leaving apache  
untweaked, the RAM usage shoots up - well over the 40 MB limit. I set  
MaxRequestsPerChild to 3. Even then, the limit gets crossed pretty  
fast. The question is: do I go on trying to tweak Apache? Or do I go  
in for more RAM?
-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---