Firefox PHP

DNS Cache

Posted by elfyn 
DNS Cache
April 26, 2003 06:10PM
I've been thinking about the need for speed. Phorum is very fast, but it can be made faster...On every forum post Phorum attempts a DNS lookup (if the installed PHP version supports gethostbyaddr, and dns_lookup is enabled) and if there are a lot of users posting, heavy network traffic, system load &c so you can be left waiting a short while for the post to be processed.

So, what I was thinking would be a good new feature in Phorum 5 would be a DNS cache (either standard built-in). I already have a hacked version of 3.4 doing this, using a table in the database, and it works very well and you certainly notice the difference on high-traffic systems.

Now, I have this as part of the base code, but was wondering what you guys thought? Add-on plugin or standard feature?
Re: DNS Cache
April 26, 2003 06:24PM
I'm not sure if thats really needed.
If you are really having speed-issues because of DNS-Lookups, then you could just disable this feature or (if its your own webserver) add a local dns-server which does caching on its own.

if you still want to add this, then I would prefer it as a plugin though I don't really know how to make a real mod of it. afaik there is only one place to change in post.php to call another function instead of the gethostbyaddr, right?
Re: DNS Cache
April 26, 2003 06:36PM
Yup! A few constants in .../constants.php and a function (phorum_dns_cache) in .../common.php
Re: DNS Cache
April 26, 2003 10:55PM
I must say that this is going a bit too far IMO. If your servers are having DNS issues, that is a problem to be solved by either turning off DNS lookups in Phorum 5 or fixing your server. I just don't see this as a thing that the core Phorum should do.

NOw, as for a module, this is how you do it ;)

Turn off DNS lookups. Write a module that hooks into the "post" hook that does the lookup (with caching) and replaces the value in the message before it is posted.
Sorry, only registered users may post in this forum.

Click here to login