2

I have a serious problem with the core's taxonomy module (Drupal 7): I have some vocabularies containing all together about 140,000 tags. I do not show these tags anywhere or use them for filtering or anything like it. At this point they are used only for a solr search index. It would be nice to show all nodes that have a certain tag as well, but I am not using this feature yet. Each node does not have more than 20 tags.

But nevertheless the taxonomy module eats all my memory so that the whole site is broken. I get the message

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to     
allocate 75 bytes) in .../modules/taxonomy/taxonomy.module on line 1022 

Does that mean, taxonomy module is not capable to deal with vocabularies that big? What am I supposed to use instead of taxonomy module to deal with big vocabularies?

  • how many modules do you have installed? also, when does this blow up? when you specifically access a page or randomly? any more details? – au_stan Jan 3 '13 at 12:48
  • The problem occurs on any page, every time. I have many modules installed, but the site worked fine with moderate memory usage for a long time. I have all caches enabled and worked a whole lot on performance optimisation. The problem occurred directly after I added the big vocabulary, and it is gone after I deleted about 80.000 terms. – user5950 Jan 3 '13 at 14:42
  • 4
2

Nope, the taxonomy module can handle as many terms-per-vocab as your hardware will allow it to (within some reasonable theoretical bounds I'm sure, but certainly 140,000 terms would not be too much these days).

The 'problem' is in your server configuration. Quite simply you don't have enough available memory for the taxonomy module to process as many records as it needs to.

Try increasing the PHP memory_limit setting gradually and hopefully you'll be able to come to an acceptable compromise between your available memory and the size of your vocabularies.

Just to preempt what I think your response will be - you're already allocating 256MB, which might be a large (even outrageous) amount of maximum memory to give to a single PHP script, but the fact that you're getting out of memory errors means it's simply not enough for your site and needs to be increased (unless you want to optimise the core taxonomy module which I don't think would be much fun).

If you're on shared hosting, the first thing to do would be to get the site on a dedicated server/VM. That should make a good bit of difference.

  • But does that mean that I need more than 256 MB for each visitor? The site is on a virtual Server, that has 4 GB, but this would be enough for only 16 users. – user5950 Jan 3 '13 at 12:29
  • memory_limit is just that...a limit. PHP won't try to use more than that per script, but it won't necessarily use all of it either. Presumably the out of memory errors happen on a specific page (if it's happening on every page then you've got bigger problems, there's nothing in the taxonomy module that would run anything to suck all the memory out on every single page load) so a decent caching strategy would also help a lot – Clive Jan 3 '13 at 12:36
  • @Clive - true its possible to increase memory but something smells funny here. 256MB for php is (IMHO) out of control. i run servers that handle large data outputs via php with only 96MB (REST services and the like). i've seen issues with modules before when there are tons of modules installed. some module accessing taxonomy info ends up blowing up apache/php. – au_stan Jan 3 '13 at 12:47
  • 1
    @austin Couldn't agree more, something doesn't smell quite right. Actually the best suggestion would probably be 'set XHProf loose on the site' - find the bottlenecks, backtrack, and see where the problem is really coming from. If it genuinely is the taxonomy module, though, only extra resource allocation on the machine itself will help (other than optimising core code, etc) – Clive Jan 3 '13 at 13:09
  • 2
    @Clive - that seems to be the best bet here. just disable and move down the line. i just have this feeling that some module is unnecessarily accessing EVERY term. Or trying to load every term into an array to parse or something like that. – au_stan Jan 3 '13 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.