Re: Strange FastCGI problems

2007-12-06 Thread TP

No, not using @user_passes_test anywhere. Thanks though!

On Dec 6, 1:43 pm, yml <[EMAIL PROTECTED]> wrote:
> TP are you using  @user_passes_test decorator with urlresolvers (url,
> reverse ...). I had a problem similar to what you are describing and I
> finally find out that this problem was infact related to the bug
> described there:http://code.djangoproject.com/ticket/5925
>
> I hope that help
>
> On Dec 6, 3:31 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Dec 6, 12:40 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > > I thought I needed multiple Apache's since I frequently have several
> > > concurrent requests. The actual dynamic python processing is quick,
> > > but since clients could be connected for relatively long (slow
> > > connections, etc), I thought I'd need multiple Apache's talking to
> > > each. Since Django says it's not officially thread safe, I'm using the
> > > prefork MPM in Apache.
>
> > Even in 'prefork' mode of Apache, there are multiple processes
> > handling requests and so concurrent requests is not a problem. The
> > problem with prefork though is that you can end up with lots of
> > process, all consuming the maximum your Django application will use.
>
> > For memory constrained VPS systems, using 'worker' MPM is a better
> > choice as you cut down on the number of Apache child processes and
> > therefore memory, with concurrency then coming from multithreading,
> > but also from fact that multiple processes still may also be running.
>
> > You might have a read of:
>
> >  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
> > which talks about the different process/threading models that Apache
> > provides and how mod_wsgi makes use of them and extends on them.
>
> > In respective of thread safety of Django, where does it say it is 'not
> > officially thread safe'. I know that it is implied through fact they
> > suggest prefork when using mod_python, but they also don't say to
> > avoid mod_python on Windows, which is multithread, plus FASTCGI
> > examples give examples using multithreading. So, there is actually
> > conflicting information on the issue.
>
> > As explained in:
>
> >  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> > the situation seems to be that there are no known current issues with
> > Django itself in respect of multithreading. Thus, any multithread
> > problems are more likely to come from the application built by a user
> > using Django. So, it is just a matter of testing your application so
> > you are satisfied that there isn't a problem.
>
> > > I looked at mod_wsgi and decided to try fastcgi since the Django docs
> > > explicitly support it. But, given my problems perhaps I'll try
> > > mod_wsgi next.
>
> > That there is nothing in Django documentation about mod_wsgi is more
> > to do with no one offering up anything to add which mentions it. The
> > Django documentation on mod_wsgi site is reasonably comprehensive and
> > maybe even a link to that would be a good start. I haven't offered
> > anything up myself for the Django site as believe that it has to be
> > the Django developers/community that first need to work out whether
> > they see it as a viable option and when they are happy add a link to
> > it.
>
> > FWIW, people are using mod_wsgi quite happily with Django. I know of a
> > couple of notable Django sites which are delaying looking at moving
> > until mod_wsgi 2.0 is released as that will be the first version which
> > allows Python code to be used to implement Apache HTTP authentication
> > provider. For what those sites do, having that feature is critical and
> > they can't move away from mod_python until mod_wsgi provides an
> > equivalent mechanism.
>
> > Graham
>
> > > On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > > > > I've been using Django for the past few months and had great results
> > > > > with Apache and mod_python. However, I'd like to try and reduce the
> > > > > amount of memory that is used by having multiple Apache's each with
> > > > > their own copy of my application. I decided to try mod_fastcgi in
> > > > > Apache and Django's FastCGI server capability.
>
> > > > Why have multiple Apache's if using mod_fastcgi. You should be able to
> > > > hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> > > > BTW, you might also want to look at mod_wsgi. Allows you to run Django
> > > > in separate process of their own just like FASTCGI, but everything
> > > > still managed by Apache without the need for you to separately start
> > > > Django or use any supervisor system to keep it running.
>
> > > > 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 

Re: Strange FastCGI problems

2007-12-06 Thread yml

TP are you using  @user_passes_test decorator with urlresolvers (url,
reverse ...). I had a problem similar to what you are describing and I
finally find out that this problem was infact related to the bug
described there:
http://code.djangoproject.com/ticket/5925

I hope that help

On Dec 6, 3:31 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Dec 6, 12:40 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > I thought I needed multiple Apache's since I frequently have several
> > concurrent requests. The actual dynamic python processing is quick,
> > but since clients could be connected for relatively long (slow
> > connections, etc), I thought I'd need multiple Apache's talking to
> > each. Since Django says it's not officially thread safe, I'm using the
> > prefork MPM in Apache.
>
> Even in 'prefork' mode of Apache, there are multiple processes
> handling requests and so concurrent requests is not a problem. The
> problem with prefork though is that you can end up with lots of
> process, all consuming the maximum your Django application will use.
>
> For memory constrained VPS systems, using 'worker' MPM is a better
> choice as you cut down on the number of Apache child processes and
> therefore memory, with concurrency then coming from multithreading,
> but also from fact that multiple processes still may also be running.
>
> You might have a read of:
>
>  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>
> which talks about the different process/threading models that Apache
> provides and how mod_wsgi makes use of them and extends on them.
>
> In respective of thread safety of Django, where does it say it is 'not
> officially thread safe'. I know that it is implied through fact they
> suggest prefork when using mod_python, but they also don't say to
> avoid mod_python on Windows, which is multithread, plus FASTCGI
> examples give examples using multithreading. So, there is actually
> conflicting information on the issue.
>
> As explained in:
>
>  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> the situation seems to be that there are no known current issues with
> Django itself in respect of multithreading. Thus, any multithread
> problems are more likely to come from the application built by a user
> using Django. So, it is just a matter of testing your application so
> you are satisfied that there isn't a problem.
>
> > I looked at mod_wsgi and decided to try fastcgi since the Django docs
> > explicitly support it. But, given my problems perhaps I'll try
> > mod_wsgi next.
>
> That there is nothing in Django documentation about mod_wsgi is more
> to do with no one offering up anything to add which mentions it. The
> Django documentation on mod_wsgi site is reasonably comprehensive and
> maybe even a link to that would be a good start. I haven't offered
> anything up myself for the Django site as believe that it has to be
> the Django developers/community that first need to work out whether
> they see it as a viable option and when they are happy add a link to
> it.
>
> FWIW, people are using mod_wsgi quite happily with Django. I know of a
> couple of notable Django sites which are delaying looking at moving
> until mod_wsgi 2.0 is released as that will be the first version which
> allows Python code to be used to implement Apache HTTP authentication
> provider. For what those sites do, having that feature is critical and
> they can't move away from mod_python until mod_wsgi provides an
> equivalent mechanism.
>
> Graham
>
> > On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > > > I've been using Django for the past few months and had great results
> > > > with Apache and mod_python. However, I'd like to try and reduce the
> > > > amount of memory that is used by having multiple Apache's each with
> > > > their own copy of my application. I decided to try mod_fastcgi in
> > > > Apache and Django's FastCGI server capability.
>
> > > Why have multiple Apache's if using mod_fastcgi. You should be able to
> > > hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> > > BTW, you might also want to look at mod_wsgi. Allows you to run Django
> > > in separate process of their own just like FASTCGI, but everything
> > > still managed by Apache without the need for you to separately start
> > > Django or use any supervisor system to keep it running.
>
> > > 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: Strange FastCGI problems

2007-12-05 Thread Graham Dumpleton

On Dec 6, 12:40 pm, TP <[EMAIL PROTECTED]> wrote:
> I thought I needed multiple Apache's since I frequently have several
> concurrent requests. The actual dynamic python processing is quick,
> but since clients could be connected for relatively long (slow
> connections, etc), I thought I'd need multiple Apache's talking to
> each. Since Django says it's not officially thread safe, I'm using the
> prefork MPM in Apache.

Even in 'prefork' mode of Apache, there are multiple processes
handling requests and so concurrent requests is not a problem. The
problem with prefork though is that you can end up with lots of
process, all consuming the maximum your Django application will use.

For memory constrained VPS systems, using 'worker' MPM is a better
choice as you cut down on the number of Apache child processes and
therefore memory, with concurrency then coming from multithreading,
but also from fact that multiple processes still may also be running.

You might have a read of:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

which talks about the different process/threading models that Apache
provides and how mod_wsgi makes use of them and extends on them.

In respective of thread safety of Django, where does it say it is 'not
officially thread safe'. I know that it is implied through fact they
suggest prefork when using mod_python, but they also don't say to
avoid mod_python on Windows, which is multithread, plus FASTCGI
examples give examples using multithreading. So, there is actually
conflicting information on the issue.

As explained in:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

the situation seems to be that there are no known current issues with
Django itself in respect of multithreading. Thus, any multithread
problems are more likely to come from the application built by a user
using Django. So, it is just a matter of testing your application so
you are satisfied that there isn't a problem.

> I looked at mod_wsgi and decided to try fastcgi since the Django docs
> explicitly support it. But, given my problems perhaps I'll try
> mod_wsgi next.

That there is nothing in Django documentation about mod_wsgi is more
to do with no one offering up anything to add which mentions it. The
Django documentation on mod_wsgi site is reasonably comprehensive and
maybe even a link to that would be a good start. I haven't offered
anything up myself for the Django site as believe that it has to be
the Django developers/community that first need to work out whether
they see it as a viable option and when they are happy add a link to
it.

FWIW, people are using mod_wsgi quite happily with Django. I know of a
couple of notable Django sites which are delaying looking at moving
until mod_wsgi 2.0 is released as that will be the first version which
allows Python code to be used to implement Apache HTTP authentication
provider. For what those sites do, having that feature is critical and
they can't move away from mod_python until mod_wsgi provides an
equivalent mechanism.

Graham

> On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > > I've been using Django for the past few months and had great results
> > > with Apache and mod_python. However, I'd like to try and reduce the
> > > amount of memory that is used by having multiple Apache's each with
> > > their own copy of my application. I decided to try mod_fastcgi in
> > > Apache and Django's FastCGI server capability.
>
> > Why have multiple Apache's if using mod_fastcgi. You should be able to
> > hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> > BTW, you might also want to look at mod_wsgi. Allows you to run Django
> > in separate process of their own just like FASTCGI, but everything
> > still managed by Apache without the need for you to separately start
> > Django or use any supervisor system to keep it running.
>
> > 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: Strange FastCGI problems

2007-12-05 Thread TP

I thought I needed multiple Apache's since I frequently have several
concurrent requests. The actual dynamic python processing is quick,
but since clients could be connected for relatively long (slow
connections, etc), I thought I'd need multiple Apache's talking to
each. Since Django says it's not officially thread safe, I'm using the
prefork MPM in Apache.

I looked at mod_wsgi and decided to try fastcgi since the Django docs
explicitly support it. But, given my problems perhaps I'll try
mod_wsgi next.


On Dec 5, 8:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
>
> > I've been using Django for the past few months and had great results
> > with Apache and mod_python. However, I'd like to try and reduce the
> > amount of memory that is used by having multiple Apache's each with
> > their own copy of my application. I decided to try mod_fastcgi in
> > Apache and Django's FastCGI server capability.
>
> Why have multiple Apache's if using mod_fastcgi. You should be able to
> hang multiple FASTCGI hosted applications hanging off the one Apache.
>
> BTW, you might also want to look at mod_wsgi. Allows you to run Django
> in separate process of their own just like FASTCGI, but everything
> still managed by Apache without the need for you to separately start
> Django or use any supervisor system to keep it running.
>
> 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: Strange FastCGI problems

2007-12-05 Thread Graham Dumpleton

On Dec 6, 12:04 pm, TP <[EMAIL PROTECTED]> wrote:
> I've been using Django for the past few months and had great results
> with Apache and mod_python. However, I'd like to try and reduce the
> amount of memory that is used by having multiple Apache's each with
> their own copy of my application. I decided to try mod_fastcgi in
> Apache and Django's FastCGI server capability.

Why have multiple Apache's if using mod_fastcgi. You should be able to
hang multiple FASTCGI hosted applications hanging off the one Apache.

BTW, you might also want to look at mod_wsgi. Allows you to run Django
in separate process of their own just like FASTCGI, but everything
still managed by Apache without the need for you to separately start
Django or use any supervisor system to keep it running.

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
-~--~~~~--~~--~--~---



Strange FastCGI problems

2007-12-05 Thread TP

I've been using Django for the past few months and had great results
with Apache and mod_python. However, I'd like to try and reduce the
amount of memory that is used by having multiple Apache's each with
their own copy of my application. I decided to try mod_fastcgi in
Apache and Django's FastCGI server capability.

While running with FastCGI, every now and then I get a random
exception 'RegexURLResolver' object has no attribute
'get_and_delete_messages'. In months of running my application with
mod_python I've never seen this.

I have another web app running under mod_python and it works fine
every time with FastCGI.

I'm using Apache 2.2.3, Centos, python 2.4.3, Django from SVN from
about early October 2007, flup 1.0, and mod_fastcgi 2.4.6.

Can anyone offer any pointers into what might be going wrong?

Thanks!

Tom
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---