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.

Patch written by iSampo of Mearra

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

onaz’s picture

Issue summary: View changes

typo fix

iSampo’s picture

Title: Domain User module slow when having lots of domains » Domain User and Domain Alias modules are slow when having lots of domains
FileSize
1.43 KB

As 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.

agentrickard’s picture

Status: Needs review » Needs work

That second patch needs its own issue.

iSampo’s picture

Title: Domain User and Domain Alias modules are slow when having lots of domains » Domain User module is slow when having lots of domains

Issue for Domain Alias is found here: Domain Alias is slow when having lots of domains.

Tharna’s picture

Here is additional patch that enables the caching for domains and domain aliases to database (or any advanced caching you are using, like memcached).

agentrickard’s picture

6.x is closed to new features. This would have to go into 7.x first.

agentrickard’s picture

Issue summary: View changes