tags:

views:

37

answers:

2

My drupal site gets very heavy and slow as new modules are loaded. Some of these modules aren't needed except for the store section of the site.

I'm thinking to create a store sub-domain and somehow load those modules only in that sub-domain.

  • Does that mean that I have to install drupal twice, once on store.mydrupalsite.com and once on mydrupalsite.com?
  • In the store sub-domain, will I have to re-install the basic modules in addition to the specialized store modules, or is there a way to get the store sub-domain to somehow inherit modules from the main site?
  • What if the user is already logged in on the main site. Will they need to re-login on the store sub-domain, or is there a way to share the database?
  • Is there any real benefit to this idea, or am I over complicating things?
  • If I'm over complicating things, what should I be doing instead
+5  A: 

If you create a second site on a different domain, you're essentially creating a second, separate site with different user stores, different configuration, and different databases.

The one thing you wouldn't have to do is reinstall Drupal or redownload all the modules: Drupal supports something called multisite confgurations, which allows you to have multiple sites running off the same Drupal install. If you make sure the modules you want to share for both sites are in the sites/all folder, all you'll need to do is create a new folder for each website in the sites folder with the domain you want.

For example, if you have mydrupalsite.com and store.mydrupalsite.com, you'd create two folders in the sites folder called mydrupalsite.com and store.mydrupalsite.com. In those folders, you'd have settings.php and a files folder which contains all the files for that specific site.

You can read more about Drupal's multisite feature on Drupal.org.

All that said, what you're describing is probably not the best way: syncing two sites together with disparate user and data stores is a real pain to maintain. And unless a module calls hook_init() or other global hooks, it's loaded on demand when a page actually uses one of the hooks it implements.

With that said, there is a module in core, Throttle, which will let you specify which modules to turn off when the site gets congested.

But Throttle only goes so far. You should probably start to look into caching mechanisms, like Boost, Memcached, Varnish, or even Pressflow if you want to get the most performance out of your Drupal installation.

Mark Trapp
+4  A: 

If you look in the settings.php, it has a very good explanation of what is called multisite.

From settings.php:

 * The configuration file to be loaded is based upon the rules below.
 *
 * The configuration directory will be discovered by stripping the
 * website's hostname from left to right and pathname from right to
 * left. The first configuration file found will be used and any
 * others will be ignored. If no other configuration file is found
 * then the default configuration file at 'sites/default' will be used.
 *
 * For example, for a fictitious site installed at
 * http://www.drupal.org/mysite/test/, the 'settings.php'
 * is searched in the following directories:
 *
 *  1. sites/www.drupal.org.mysite.test
 *  2. sites/drupal.org.mysite.test
 *  3. sites/org.mysite.test
 *
 *  4. sites/www.drupal.org.mysite
 *  5. sites/drupal.org.mysite
 *  6. sites/org.mysite
 *
 *  7. sites/www.drupal.org
 *  8. sites/drupal.org
 *  9. sites/org
 *
 * 10. sites/default
 *
 * If you are installing on a non-standard port number, prefix the
 * hostname with that number. For example,
 * http://www.drupal.org:8080/mysite/test/ could be loaded from

So. You would make a directory store.example.com and place a settings.php only for that domain. Inside that directory, create a directory modules and place all the modules in there that should appear only for that domain.

berkes