Drupal: many fields / content types are equal to * many * tables, and after the dot makes MySQL very slow

When I create more and more fields and content types, I see that Drupal creates a huge number of tables (> 1k) in MySQL and after the point my system becomes very slow.

I tried some MySQL performance tuning tips, but nothing improved performance significantly. Enabling caching provides good interface speed, but if I try to edit the content type from the admin admin code, it will take forever!

How do you deal with this? How do you scale Drupal?

+4
source share
3 answers

If a huge number of tables has become a database performance bottleneck, I have to agree with Rimian. You can programmatically define your own content types and then develop your own content type model using the Node API.

API documentation and an example of how to do this: http://api.drupal.org/api/drupal/developer--examples--node_example--node_example.module/6

The code stream is basically:

  • Make Drupal Recognize Your Content Type
  • Define the fields that must be completed using the forms API
  • Determine how each of the Node API functions should behave (view, load, save, etc.).

This allows you to control how things are stored, but it still gives you the opportunity (and all the modules provided) to use the hook system for calling Node APIs.

Obvious drawbacks are absent in all functions / modules that directly depend on CCK for their functionality. But with> 1k tables (which means a huge amount of content types and fields), it looks like you're already at that level of user experience.

+2
source

I worked on a Drupal 5 site with over a million nodes, and this was a serious problem.

If you scale Drupal to the enterprise level, do not use CCK for your fields and do not create your own content model using the node API. It is actually quite easy.

0
source

The devel module offers a performance monitoring tool that will show you all requests executed on time, showing which hooks and modules are called by them, etc.

Just don't work in production.

0
source

Source: https://habr.com/ru/post/1311225/


All Articles