On Jun 26, 12:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-06-25 at 19:39 -0700, ZebZiggle wrote:
> > Howdy!
>
> > Emails were taking 15s to send each. Upon investigation it came down
> > to CachedDnsName in django.core.mail. Specifically, the
> > socket.getfqdn() call. Also, it *always* happened, not just on
> > startup. So it seems the call was timing out and the cache wasn't
> > effective.
>
> > The strange part is, it works fine in a dev environment or from the
> > production command line, but under apache/mod-python the killer time
> > delay kicks in.
>
> > Any idea what could be different here?
>
> If that file is being reimported a lot because the Python processes are
> restarting it will be run each time. You could try printing the PID --
> os.getpid() -- or something similar to verify that.

Remembering that under mod_python to get a 'print' statement to appear
in the Apache error log promptly you need to flush the stream Thus:

   import sys, os
   print os.getpid(), "Some message"
   sys.stdout.flush()

To see in what way mod_python may be the cause, might suggest running
your Apache with the Apache configuration:

  StartServers 1
  ServerLimit 1

This will ensure that only one Apache child process is run and thus
that each request goes to the same process. If there is therefore a
delay because of this DNS caching setup, it should only occur on the
first request and not subsequent requests. If instead it occurs on
every request, then something more serious is happening.

An alternative to changing Apache configuration is to stop Apache and
run it in debug mode.

  apachectl stop
  httpd -X

In this mode it runs everything in one process, ie., not even a
separate child process.

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

Reply via email to