Resolved: CachedDnsName - very slow under apache/mod_python ...
Upgraded mod_python to latest version and upgraded python 2.4.x ... problem gone away. Go figure. Thanks all! --~--~-~--~~~---~--~~ 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: CachedDnsName - very slow under apache/mod_python ...
This gets even more weird. I copied the send_mass_mail() code from django.core.mail into my module so I could orchestrate it. I changed the DNS_NAME lookup to a hardcoded string and then got the 15s delay on the smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) line?! So, perhaps the cache hit is working on subsequent tries, but only slow the first time through. There still seems to be a problem on with any of the bind operations, including SMTP(). Yet, it works fine from the command line or dev. I tried it on another site I run and it's fine also. Just something weird about this one configuration. I'm sure this is not a django problem anymore ... any apache/mod- python/network experts in the house? -S --~--~-~--~~~---~--~~ 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: CachedDnsName - very slow under apache/mod_python ...
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 -~--~~~~--~~--~--~---
Re: CachedDnsName - very slow under apache/mod_python ...
On Jun 25, 11:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > (for example, a setting for the fqdn so that we don't even do the lookup > if the setting exists). I like that idea. I should be able to just set DNS_NAME myself from the calling module. Let me investigate. Thx guys, Sandy --~--~-~--~~~---~--~~ 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: CachedDnsName - very slow under apache/mod_python ...
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. I remember hearing second-hand about this happening to somebody else and wasn't paying enough attention at the time to realise it might be a real problem. It's worth tweaking a bit if you can work out the circumstances (for example, a setting for the fqdn so that we don't even do the lookup if the setting exists). (Every time I look at that code, I remember how much I dislike DNS_NAME as the constant. Darn backwards compatibility hack!) Regards, Malcolm -- I've got a mind like a... a... what's that thing called? http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: CachedDnsName - very slow under apache/mod_python ...
I'm not sure. Each Apache instance may have to populate this, so it could be noticed several times. Keep investigating! Thinking more about it, perhaps CachedDnsName should only lazily loaded if settings.DEBUG==True. It's not really fair to expect an end user to have to wait for this timeout just because they are the first one to trigger a mail to be sent. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CachedDnsName - very slow under apache/mod_python ...
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? Cheers, Sandy --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---