I have a site with around 8000 domains. I've discussed with Ken Rickard about DA not being designed for that number and it kind of shows. Luckily, issues are solvable.
We have a blogging platform that people can register on and start blogging on. Each user will get their own subdomain being their blog. The system also has a central hub for the platform being the default domain.
Domain User and Domain Alias modules both have the issue of not being very fast when domain count rises above – let's say 1000. The modules implement the domainload hook and do a query per domain – in our case 8000 extra queries per page, 16000 if Domain Alias is enabled.
There is a patch to cache domain_lookups in D7. We used that as an example and created a similar one for Domain User D6, patch attached. Basically when the first domainload hook is triggered, we load all the domain_user data from database and store it in a static array. This means that query count per request for domain user drops from n to 1. The solution however consumes some PHP memory, keep that on mind. Performance-wise it's a lifesaver for us, though.
Do create the same patch for Domain Alias as well when you need one.
Comment | File | Size | Author |
---|---|---|---|
#4 | 0001-Add-caching-to-domain_domains-and-domain_aliases.patch | 2.74 KB | Tharna |
#1 | domain_alias_list-static-cache.patch | 1.43 KB | iSampo |
domain_user_domainload-static-cache.patch | 1.21 KB | onaz |
Comments
Comment #0.0
onaz CreditAttribution: onaz commentedtypo fix
Comment #1
iSampo CreditAttribution: iSampo commentedAs said above, the problem is also existing on Domain Alias module when the domains are loading their information from the database one by one. Patch attached with the same kind of static caching as in the patch above.
Comment #2
agentrickardThat second patch needs its own issue.
Comment #3
iSampo CreditAttribution: iSampo commentedIssue for Domain Alias is found here: Domain Alias is slow when having lots of domains.
Comment #4
Tharna CreditAttribution: Tharna commentedHere is additional patch that enables the caching for domains and domain aliases to database (or any advanced caching you are using, like memcached).
Comment #5
agentrickard6.x is closed to new features. This would have to go into 7.x first.
Comment #5.0
agentrickardAdded link to http://drupal.org/node/1004504