eZ Community » Forums » Developer » What is the overall impact of adding...
expandshrink

What is the overall impact of adding attributes to classes?

What is the overall impact of adding attributes to classes?

Wednesday 21 August 2013 10:53:02 am - 2 replies

Hi guys,

I have a little concern about my site.

There is a custom class - called "Product" - which has a number of attributes. 51 to be precise. A product is basically the "article" class, with extra fields.

As new features are added, I find myself adding to these attributes. That figure could reach 70-80 within 12 months because of planned development work.

Can anyone give an idea about the impact of this? The obvious problems I can think of are scaleability and site management. Is there also a performance hit from having a large number of attributes?

Right now there are 8000 "Products", that figure is set to double in the next 12 months.

Whenever I add a new class attribute I always feel like it's a lazy solution to the problem, and I should be doing something more clever...

Wednesday 21 August 2013 4:25:01 pm

First off, the facts. The content of the attributes are stored in the ezcontentobject_attribute table in the database. This table contains one record for each version of each translation of each attribute of each class. This can amount to a whole lot of records, and this table in generally thought of as the bottleneck of the eZ Publish architecture today. So for your Product class with 8000 objects and 51 attributes (and let's say an average of 4 versions pr.object, one translation?), you'll have about 1.6 million records representing products. In 12 months you'll have around 5 million.

There are several ways of dealing with this:

  • Reduce number of versions kept in the database for the Product class. This is configurable pr.class in ini.
  • Remove outdated attributes in the classes.
  • Do you import many of the attributes from external systems? Import them instead to a custom table, and link to the object via a custom datatype.
  • Do you have multiple attributes where the content is not very dynamic? Move them out in a custom table, as above.

Wednesday 21 August 2013 4:57:03 pm

Thanks for the response

I just ran the following:

 SELECT avg(version) FROM `ezcontentobject_attribute`

Average of 3.03 versions, that was a good guess!

And this:

 SELECT count(*) FROM `ezcontentobject_attribute`

Gives 2,126,345 rows.

One of the planned developments is to add another language - at the moment everything is English, so doubling the products actually means having 4x the objects when a new language is added.

The idea of moving some attributes to a custom table sounds promising. I will look into that.

Thanks

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from